0
votes

I would like to ask you how to set chart intervals as specific points ? I've got in int list called time_list next points (times) for X axis. And I want to have this times on X axis intervals. This is how my chart looks like when I just set the interaval as 1200.

chart

chart.AxisX.Interval = 1200;
chart.AxisX.IntervalType = DateTimeIntervalType.Number;
chart.AxisX.LabelStyle.Format = "";

Instead of this random intervals, I want to have specific time points from my time_list. I add points to chart in this way:

                foreach (int el1 in time_list)
                {
                    if (temp % 2 == 0)
                    {
                        chart1.Series["Signal"].Points.AddXY(el1, 0);
                        chart1.Series["Signal"].Points.AddXY(el1, 1);
                    }

                    else
                    {
                        chart1.Series["Signal"].Points.AddXY(el1, 1);
                        chart1.Series["Signal"].Points.AddXY(el1, 0);

                    }
                    temp++;
                }

And to this added points I want to have x-axis intervals suited to them.

1
What is the chart package are you using? - DanB
System.Windows.Forms.DataVisualization.Charting - MrHause13

1 Answers

0
votes

Try setting the IsXValueIndexed property of the series.

chart1.Series["Signal"].IsXValueIndexed = true;