I have file to read some values. When i try to put on chart i have some problem.
Chart show me only date and ignore hours in date.
my code here:
chart.Skins = Skins.Metro;
chart.Indexed = false;
this.chart.Text = "UCA";
this.chart.PrimaryYAxis.Title = "CompressiveStrengthMPa";
this.chart.PrimaryYAxis.ValueType = ChartValueType.Double;
this.chart.ShowLegend = false;
this.chart.PrimaryXAxis.ValueType = ChartValueType.DateTime;
this.chart.PrimaryXAxis.IntervalType = ChartDateTimeIntervalType.Days;
this.chart.PrimaryXAxis.LabelRotate = true;
this.chart.PrimaryXAxis.LabelRotateAngle = 90;
this.chart.PrimaryXAxis.Title = "Time";
var series = new ChartSeries("Market");
series.Type = ChartSeriesType.Line;
Random ran = new Random();
this.chart.BeginUpdate();
for (int i = 0; i < reader.Results.Count; i++)
{
ERDataDurabilityUltrasonicInstrument data = reader.Results[i]; // Read from file
series.Points.Add(data.Time, data.CompressiveStrengthMPa); // Add points where data.Time - is DateTime. data.CompressiveStrengthMPa - is double
}
this.chart.EndUpdate();
this.chart.Series.Add(series);
this.chart.Trackball.Visible = true;
zero point:
next point in 01.01.1753 in 16 hour 32 minut
next point in 01.01.1753 in 9 hour 04 minut
last point in 02.01.1753 in 00 hour 00 minut
Chart which i need get. Look at green line
|
this.chart.PrimaryXAxis.IntervalType = ChartDateTimeIntervalType.Hours; |
Hi Gayathri, I have tryed changed interval by hour before write here. That didn't give me nice result. I could send all of my code and file wich i try to read.
also i try to change line code 170-171 on screenshot.
Convert DateTime to double like this
{
series.Points.Add(data.Time.ToOADate(), data.CompressiveStrengthMPa);
series1.Points.Add(data.Time.ToOADate(), data.TransitTime);
}
but i gave the same result in first query to you
|
//Set the Interval range, interval and interval type based on your data points
this.chart.PrimaryXAxis.DateTimeRange = new ChartDateTimeRange(date,
date.AddMinutes(1000), 2, ChartDateTimeIntervalType.Hours); |