RadChart Step property issue

Thread is closed for posting
2 posts, 0 answers
  1. shunman
    shunman avatar
    77 posts
    Member since:
    Jul 2011

    Posted 15 Jul 2014 Link to this post

    Hello.

    My data source is here.
    ============
    DataSize  || User
    ============
    0              ||   3
    1              ||   1458
    2              ||   20
    6              ||  1
    =============

    I created line chart from programmatically.

    RadChartStorageUsage.PlotArea.XAxis.DataLabelsColumn = "DataSize";
                 
    RadChartStorageUsage.DataSource = _dataTable;
    RadChartStorageUsage.DataBind();
     
    RadChartStorageUsage.PlotArea.XAxis.LayoutMode = Telerik.Charting.Styles.ChartAxisLayoutMode.Normal;
    RadChartStorageUsage.PlotArea.XAxis.AutoScale = false;
    RadChartStorageUsage.PlotArea.XAxis.MinValue = 0;
    RadChartStorageUsage.PlotArea.XAxis.MaxValue = 6;
    RadChartStorageUsage.PlotArea.XAxis.Step = 1;
     
    RadChartStorageUsage.PlotArea.YAxis.AutoScale = false;
    RadChartStorageUsage.PlotArea.YAxis.MinValue = 0;
    RadChartStorageUsage.PlotArea.YAxis.MaxValue = 1423;
    RadChartStorageUsage.PlotArea.YAxis.Step = 1;

    X-Axis show 6 axis 0 to 6, it's correct.
    I expected line will display  0 to 6 along X-Axis.

    but line display 0 to 3 (please refer 11111111111.jpg)

    I would like to draw the line 0 to 6 X-Axis like this 222222222222222222222.jpg  (it drew by ASP.NET Chart control)

  2. Danail Vasilev
    Admin
    Danail Vasilev avatar
    1490 posts

    Posted 17 Jul 2014 Link to this post

    Hi shunman,

    You are trying to display continuous data and not discrete one. Therefore I can suggest that you use DataXColumn property of the series instead of the DataLabelsColumn one of the x-axis. For example:

    ASPX:
    <telerik:RadChart ID="RadChartStorageUsage" runat="server" Height="400px" Width="600px">
        <Series>
            <telerik:ChartSeries Type="Line" DataYColumn="User" DataXColumn="DataSize">
            </telerik:ChartSeries>
        </Series>
    </telerik:RadChart>

    C#:
    protected DataTable GetData()
    {
        DataTable dt = new DataTable();
     
        dt.Columns.Add("ID", typeof(int));
        dt.Columns.Add("DataSize", typeof(int));
        dt.Columns.Add("User", typeof(int));
     
        dt.Rows.Add(1, 0, 3);
        dt.Rows.Add(2, 1, 1458);
        dt.Rows.Add(3, 2, 20);
        dt.Rows.Add(4, 6, 1);
     
        return dt;
    }
     
    protected void Page_Load(object sender, EventArgs e)
    {
     
        //RadChartStorageUsage.PlotArea.XAxis.DataLabelsColumn = "DataSize";
     
        RadChartStorageUsage.DataSource = GetData();
        RadChartStorageUsage.DataBind();
     
        RadChartStorageUsage.PlotArea.XAxis.LayoutMode = Telerik.Charting.Styles.ChartAxisLayoutMode.Normal;
        RadChartStorageUsage.PlotArea.XAxis.AutoScale = false;
        RadChartStorageUsage.PlotArea.XAxis.MinValue = 0;
        RadChartStorageUsage.PlotArea.XAxis.MaxValue = 6;
        RadChartStorageUsage.PlotArea.XAxis.Step = 1;
     
        //RadChartStorageUsage.PlotArea.YAxis.AutoScale = false;
        //RadChartStorageUsage.PlotArea.YAxis.MinValue = 0;
        //RadChartStorageUsage.PlotArea.YAxis.MaxValue = 1423;
        //RadChartStorageUsage.PlotArea.YAxis.Step = 1;
     
    }


    Regards,
    Danail Vasilev
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top