This is a migrated thread and some comments may be shown as answers.

RadChart Step property issue

1 Answer 15 Views
Chart (Obsolete)
This is a migrated thread and some comments may be shown as answers.
shunman
Top achievements
Rank 1
shunman asked on 15 Jul 2014, 02:09 PM

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)

1 Answer, 1 is accepted

Sort by
0
Danail Vasilev
Telerik team
answered on 17 Jul 2014, 10:14 AM
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.

 
Tags
Chart (Obsolete)
Asked by
shunman
Top achievements
Rank 1
Answers by
Danail Vasilev
Telerik team
Share this question
or