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

[Solved] Problem with RadChart

2 Answers 144 Views
Chart (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Trong
Top achievements
Rank 1
Trong asked on 29 May 2008, 07:32 AM
Hi All,
I have problem with RadChart control.
I have DataTable:

    Date           Price             
07/05/2008    2.5   
08/05/2008    1.0                     
09/05/2008    1.55   


When I bind datatable into RadControl, XvalueLabel display range datetime  from
1/7/2008->9/9/2008

I don't know why? and range datetime what is it?

I Want display line chart with Y value: Price Column and X value: Date and XLabel range from "07/05/08" to "09/05/08"

Thanks For All Answer!

2 Answers, 1 is accepted

Sort by
0
alan
Top achievements
Rank 1
answered on 30 May 2008, 07:36 AM
Trong,
This seems like a culture issue to me. Did you try with 15/05/2008? Make sure 07/05/2008 is "2008-May-07" and not "2008-July-05".
0
Trong
Top achievements
Rank 1
answered on 30 May 2008, 08:23 AM

Hi alan,

Thi is my code:

dtSourse structure from Database:

UpdateDate                               Price

2008-05-07 00:00:00.000        2.5

2008-05-08 00:00:00.000        1.0

2008-05-09 00:00:00.000        1.55

My code:

chartPrice.Chart.Series.Clear();

Telerik.Charting.ChartSeries valueSeries = new Telerik.Charting.ChartSeries("VALUE", Telerik.Charting.ChartSeriesType.Line);
chartPrice.Series.Add(valueSeries);DataTable tbl = new DataTable();
DataColumn col = new DataColumn("VALUE");
col.DataType = typeof(object);
tbl.Columns.Add(col);

col = new DataColumn("DATE");

col.DataType = typeof(object);

tbl.Columns.Add(col);

for (int i = 0; i < dtSource.Rows.Count; i++, j++)

{

tbl.Rows.Add(new Object());

tbl.Rows[i][0]=Convert.ToDouble(dtSource.Rows[i]["Price"]);          

tbl.Rows[i][1] = Convert.ToDateTime(dt.Rows[i]["UpdatedDate"]).Date.ToOADate();                     chartPrice.PlotArea.XAxis.AddItem(Convert.ToDateTime(dt.Rows[i]["UpdatedDate"]).Date.ToString());           

        }

valueSeries.DataXColumn = "DATE";

valueSeries.DataYColumn = "VALUE";

chartPrice.DataSource = tbl;

chartPrice.DataBind();  

chartPrice.PlotArea.XAxis.Appearance.ValueFormat = Telerik.Charting.Styles.ChartValueFormat.ShortDate;

chartPrice.PlotArea.XAxis.AutoScale = true;       

chartPrice.PlotArea.XAxis. = 1;

chartPrice.PlotArea.XAxis.IsZeroBased = false;

But chart display some problem, link detail chart

: ChartPrice

http://cid-5956e24e43a23017.skydrive.live.com/self.aspx/Public/chart.JPG

 http://2wvneq.blu.livefilestore.com/y1pSEEMEF66naYkyEP8q0GrZ-R8M4QDwoa65qIB8iDLUz-irH0ylB4VE_5HobP8u4ZpKc_6QYx77TYs6OCAXP8aqg/chart.JPG

Please help me!

Tags
Chart (Obsolete)
Asked by
Trong
Top achievements
Rank 1
Answers by
alan
Top achievements
Rank 1
Trong
Top achievements
Rank 1
Share this question
or