Reputation: 911
In my C# application im using a point chart.On y axis the chart needs points like 10,20,30 etc.. to update. And x axis having time values (minutes) to update.
I found an example in google, but in that example having only values on X axis and Y axis.How to update time instead of values? . Please refer my code below,
private void Form1_Load(object sender, EventArgs e)
{
chart1.Series.Clear();
var series1 = new System.Windows.Forms.DataVisualization.Charting.Series
{
Name = "Series1",
Color = System.Drawing.Color.Green,
IsVisibleInLegend = false,
IsXValueIndexed = true,
ChartType = SeriesChartType.Point
};
this.chart1.Series.Add(series1);
for (int i=0; i < 100; i++)
{
series1.Points.AddXY(i, f(i));
}
chart1.Invalidate();
}
private double f(int i)
{
var f1 = 59894 - (8128 * i) + (262 * i * i) - (1.6 * i * i * i);
return f1;
}
If it possible please update the time in this code itself.
Upvotes: 0
Views: 402
Reputation: 809
Delete the line:
IsXValueIndexed=true;
And add a line:
chart1.ChartArea1.AxisX.Title= "Minutes";
Upvotes: 1