Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change chart's x axis interval

Tags:

c#

charts

I have a data for each day, there are multiple data entries occuring. If I want to show this as a stackarea chart, excel does this in a perfect way, i.e. displays the date interval on x axis evenly. When I try to do this with MS Charting tool, the interval of on x axis becomes effected by the number of the entries. 03/08/10 36 94
04/08/10 26 104
04/08/10 26 104
05/08/10 28 102
05/08/10 28 102
05/08/10 35 95
05/08/10 35 95

Any ideas, how I can tell AxisX will have a fixed interval?

like image 780
demokritos Avatar asked Nov 02 '10 17:11

demokritos


People also ask

How do I change the x-axis interval in Excel?

On the Format tab, in the Current Selection group, click Format Selection. Under Axis Options, do one or both of the following: To change the interval between axis labels, under Interval between labels, click Specify interval unit, and then in the text box, type the number that you want.

How do I change the increments in an axis in Excel?

In the Format Axis dialog box, click Scale, and under Value axis scale, modify any of the following options: To change the number at which the vertical (value) axis starts or ends, for the Minimum or Maximum option, type a different number in the Minimum box or the Maximum box.

Can the x-axis have different intervals?

The X-axis contains either strings of text or a date under each set of data points. You can choose to have this axis only display the text or date at certain intervals, but the process is a little different depending on what kind of axis you have.


2 Answers

If you are using the Microsoft .net charting tools, then your chart has a "ChartArea" Se

Set ChartArea.AxisX.Interval to 1. You will have an interval with a label at each data point.

like image 137
Vivian River Avatar answered Nov 07 '22 04:11

Vivian River


Thanks Rice, but it was the intervaltype I have to tell the days: chartCheck.ChartAreas[0].AxisX.IntervalType = DateTimeIntervalType.Days;

like image 27
demokritos Avatar answered Nov 07 '22 03:11

demokritos