locked
AJAX LINE CHART RRS feed

  • Question

  • User1801805778 posted

    Hi,

    I am not able to get line chart with this code. how to get line chart with datasource

    <ajaxToolkit:LineChart ID="LineChart1" runat="server" 
    ChartWidth="450" ChartHeight="300" ChartType="Basic" 
    ChartTitle="United States versus European Widget Production" 
    CategoriesAxis="2007,2008,2009,2010,2011,2012" 
    ChartTitleColor="#0E426C" CategoryAxisLineColor="#D08AD9" 
    ValueAxisLineColor="#D08AD9" BaseLineColor="#A156AB">
    <Series>
        <ajaxToolkit:LineChartSeries Name="United States" 
        LineColor="#6C1E83" Data="110, 189, 255, 95, 107, 140" />
        <ajaxToolkit:LineChartSeries Name="Europe"  
        LineColor="#D08AD9" Data="49, 77, 95, 68, 70, 79" />
    </Series>
    </ajaxToolkit:LineChart>
        
    Monday, February 17, 2014 2:39 AM

Answers

  • User-933407369 posted

    hi,

    For this issue, I suggest you add the Series to LineChart in advance like below.

    <div>
                <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
                <asp:LineChart ID="LineChart2" runat="server"
                    ChartWidth="1000" ChartHeight="300" ChartType="Stacked"
                    ChartTitle="United States versus European Widget Production"
                    
                    ChartTitleColor="#0E426C" CategoryAxisLineColor="#D08AD9"
                    ValueAxisLineColor="#D08AD9" BaseLineColor="#A156AB">
                   <Series>
                       <asp:LineChartSeries Name="Orders"
                        LineColor="#6C1E83"  />
                    </Series>
                 </asp:LineChart>
            </div>

    Test

    LineChart2.Series[0].Data = new decimal[] { 110, 189, 255, 95, 107, 140 };//y: here you need to convert the datasource to decimal[] collection
    LineChart2.CategoriesAxis = "2007,2008,2009,2010,2011,2012";//string.Join(",", x) LineChart2.ChartTitle = "Title : Customers Vs. No of Orders";

    I test it in IE11 and it works fine in my workaround. 

    For more information:

    http://www.asp.net/ajaxLibrary/AjaxControlToolkitSampleSite/LineChart/LineChart.aspx 

    Hope this helps, thanks.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, February 17, 2014 9:12 PM

All replies