This is a migrated thread and some comments may be shown as answers.

How to have a zero based x axis ?

2 Answers 64 Views
ChartView
This is a migrated thread and some comments may be shown as answers.
Stéphane
Top achievements
Rank 1
Stéphane asked on 08 Nov 2018, 08:03 AM

I have the following (simplified) xaml:

<telerik:RadCartesianChart x:Name="chart">
   <telerik:RadCartesianChart.HorizontalAxis >
      <telerik:CategoricalAxis  />
   </telerik:RadCartesianChart.HorizontalAxis>

   <telerik:RadCartesianChart.VerticalAxis>
      <telerik:LinearAxis />
   </telerik:RadCartesianChart.VerticalAxis>
                              
   <telerik:RadCartesianChart.Series>
      <telerik:LineSeries Stroke="Blue"  ItemsSource="<Binding to a double array>"
      </telerik:LineSeries>
   </telerik:RadCartesianChart.Series>
</telerik:RadCartesianChart>

By default the x axis starts from "1" (See picture). How to have the x axis starting at "0" ?

Thanks

 

 

2 Answers, 1 is accepted

Sort by
0
Martin Ivanov
Telerik team
answered on 13 Nov 2018, 07:59 AM
Hello St├ęphane,

To achieve your requirement you can use a ScatterLineSeries with two LinearAxis. This way you will have numerical data on both axes and if the automatically calculate range won't work for you, you can manually define one using the axis Minimum and Maximum properties.

The current result on your side appears because when you populate the chart series with a one dimensional data (array of doubles), the chart will automatically fill the category value of the data points with the index of the data item (starting from 1). So you have categories for, 1, 2, 3, etc., to the count of the array.

Regards,
Martin Ivanov
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Stéphane
Top achievements
Rank 1
answered on 13 Nov 2018, 02:28 PM
Done. Thank you for reply.
Tags
ChartView
Asked by
Stéphane
Top achievements
Rank 1
Answers by
Martin Ivanov
Telerik team
Stéphane
Top achievements
Rank 1
Share this question
or