JaredNinja - 11 months ago 39

Vb.net Question

I cannot seem to figure out how to solve this challenge:

I have a ChartArea that is fed with data. It used to be 1 data point per meter. So a 5.000 meter measurement had 5.000 data points and 0 to 5000 on the x-axis automatically.

Now the resolution of our measurement device can be changed. So I could get 10.000 data points on a 20km measurement, because the device resolution is set to 2. (one data point per 2 meter).

In this case, my x-axis has labels from 0 to 10.000 (amount of data points). But it should be 0 to 20.000 of course. Like 0,2,4,6,8.....20.000 right?

How could the x-axis be fixed?

Answer

This did not work for me:

```
chart1.ChartAreas[0].AxisX.Interval = 2
```

It only seems to change the amount of labels shown on the x-axis, not the value.

I got it working though. Before I used..

```
Series(0).Points.AddY(data(I))
```

But I changed it to..

```
Series(0).Points.AddXY(I*Double.Parse(resolution), dots(I))
```

Like you said, where resolution is a string containing "2.0"