We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Axis Range and Interval settings

Hello Guys,

i wanna create a chart with custom x-axis range and interval, but it doesn´t work :(
I had a look at your online documentation and i have written this code:



           ChartArea analogArea = new ChartArea();
            chart1.Areas.Add(analogArea);


            ChartSeries analogSeries = new ChartSeries(ChartTypes.Spline);

            chart1.Areas[0].Series.Add(analogSeries);

            chart1.Areas[0].PrimaryAxis.LabelRotateAngle = 270;


            chart1.Areas[0].PrimaryAxis.IsAutoSetRange = false;

            chart1.Areas[0].PrimaryAxis.ValueType = ChartValueType.DateTime;
            chart1.Areas[0].PrimaryAxis.DateTimeRange = new DateTimeRange(new DateTime(2012, 1, 1, 12, 0, 0), new DateTime(2012, 1, 1, 13, 30, 0));
            chart1.Areas[0].PrimaryAxis.MinimumDateTimeInterval = new TimeSpan(00, 15, 00);
            chart1.Areas[0].PrimaryAxis.DateTimeInterval = new TimeSpan(00, 15, 00);
           

            ChartListData points = new ChartListData();

            points.ChartXValueType = ChartValueType.DateTime;

            points.AddPoint(new DateTime(2012, 01, 01, 12, 00, 00), 1);
            points.AddPoint(new DateTime(2012, 01, 01, 12, 30, 00), 0);
            points.AddPoint(new DateTime(2012, 01, 01, 13, 00, 00), 1);
            points.AddPoint(new DateTime(2012, 01, 01, 13, 30, 00), 0);

            analogSeries.Data = points;

When I did not bind the data to the chart, the chart will be shown correctly!


Why does ist not work? Please help me!


best regards
Fabian Tholl

1 Reply

RA Rajkumar Syncfusion Team August 16, 2012 11:30 AM UTC

Hi Tholl,

Thank you for choosing Syncfusion products.

We would like to inform you that we need to specify the IsIndexed as false, since by default ChartSeries will Indexed Series. Thus it can be resolved by specifying the IsIndexed=false as in below code snippet.

Code Snippet:
[C#]
analogSeries.IsIndexed = false;

Please let us know, if you need any further assistance.

Thanks,
Rajkumar B R

Loader.
Live Chat Icon For mobile
Up arrow icon