DateTime value in X-Axis

Hi

I have a problem displaying > 5000 record in line chart.

The data in record are as follow:
Price DateTime
795.0700000 2007-12-14 00:00:01.857
795.6000000 2007-12-14 00:00:03.860
795.4300000 2007-12-14 00:00:05.860

I want to display Price in Y-Axis and DateTime in X-Axis. But X-Axis doesn't seem to draw the data correctly eventhough I tried to adjust DateTime range and Interval of DateTime.

Below are the sample code I used:

hartControl1.Indexed = true;
mDataBindModel = new ChartDataBindModel(this.mFeedDs, "");
ChartSeries series = this.chartControl1.Model.NewSeries("Market");

mDataBindModel.XName = "Time";
mDataBindModel.YNames = new string[] { "Price" };
series.Type = ChartSeriesType.Line;

series.SeriesModelImpl = mDataBindModel;
series.Style.DisplayShadow = false;


this.chartControl1.Series.Add(series);

this.chartControl1.PrimaryXAxis.DrawGrid = false;

this.chartControl1.PrimaryXAxis.RangeType = ChartAxisRangeType.Set;
this.chartControl1.PrimaryXAxis.ValueType = ChartValueType.DateTime;
this.chartControl1.PrimaryXAxis.DateTimeFormat = "HH:MM";
this.chartControl1.PrimaryXAxis.DateTimeRange = new ChartDateTimeRange(DateTime.Now.AddDays(-1), DateTime.Now, 5, ChartDateTimeIntervalType.Hours);


this.chartControl1.PrimaryYAxis.RangeType = ChartAxisRangeType.Set;
this.chartControl1.PrimaryYAxis.Range.Min = 700;
this.chartControl1.PrimaryYAxis.Range.Max = 900;

this.chartControl1.PrimaryYAxis.Range.Interval = 50;
this.chartControl1.PrimaryYAxis.DrawGrid = false;

this.chartControl1.Text = "";
this.chartControl1.PrimaryYAxis.Title = "";

I hope someone can help me to solve the problem.

Regards,
Aung















form_sample.zip

1 Reply

SR SubhaSheela R Syncfusion Team December 19, 2007 12:24 PM UTC

Hi Aung,

I apologize for the delay in responding.
I have created a sample with line chart that describes how to set DateTime in X-axis. Please refer to the link below that illustrates the same.
http://websamples.syncfusion.com/samples/Chart.Windows/F70527/main.htm

Please let me know if it helps.

Regards,
Subhasheela R




Loader.
Up arrow icon