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

Generate automatic limits in SfCartesianChart

Hey!
Is it possible to set a default NummericalAxis on the YAxes so the chart will be more usefull and dynamic. Right now i have a minimum and maximum, but the value will depend on the differet users. So the Y-Axe should be established with background in the users value...
I think something like this:
<chart:NumericalAxis Maximum="({Data Binding}+2)" Minimum="({Data Binding} -2)"

This my code now, but the the YAxes nummer, is not dynamic:
chart:SfCartesianChart.YAxes Maximum="40" Minimum="36" Interval="1">
<chart:NumericalAxis.Title>
<chart:ChartAxisTitle Text="Kg. EKM pr. ko"></chart:ChartAxisTitle>
</chart:NumericalAxis.Title>
</chart:NumericalAxis>
</chart:SfCartesianChart.YAxes>
</chart:SfCartesianChart>




4 Replies

SS Sowndharya Selladurai Syncfusion Team March 20, 2023 06:30 AM UTC

Hi  Mathias Pedersen,

Yes, it is possible to set a default NumericalAxis on the Y-axis of the chart so that it can be more useful and dynamic. Instead of using a fixed minimum and maximum, you can set the RangePadding property of the axis to Additional or Round to adjust the range based on the data points and provide a better view of the chart.


Here is an updated code snippet that demonstrates how to set a default NumericalAxis on the Y-axis and use the RangePadding property to adjust the range based on the data points:

<chart:SfCartesianChart>

<chart:SfCartesianChart.XAxes>

  <chart:CategoryAxis>

     <chart:CategoryAxis.Title>

           <chart:ChartAxisTitle Text="Name"/>

      </chart:CategoryAxis.Title>

  </chart:CategoryAxis>

</chart:SfCartesianChart.XAxes>

 

<chart:SfCartesianChart.YAxes>

<chart:NumericalAxis RangePadding="Additional" Interval="20"

  <chart:NumericalAxis.Title>

     <chart:ChartAxisTitle Text="Height(in cm)"/>

  </chart:NumericalAxis.Title>

</chart:NumericalAxis>

</chart:SfCartesianChart.YAxes>

 

<chart:ColumnSeries  ItemsSource="{Binding Data}"

                                       XBindingPath="Name"

                                       YBindingPath="Height"

                                            ShowDataLabels="True">

  </chart:ColumnSeries>

 </chart:SfCartesianChart>






MP Mathias Pedersen replied to Sowndharya Selladurai March 20, 2023 12:00 PM UTC

Hi  Sowndharya Selladurai

Thanks for the answer!
But is it possible to only show some of the data. 

Example in the picture, where i by my self have put minimum and maximum. But i dont find this usefull, because the data point will vary from user to user.example.png



RR Raja Ramalingam Syncfusion Team March 21, 2023 12:01 PM UTC

Hi Mahtias,


We will validate and update you the status on Tomorrow, March 22, 2023.

Regards,
Raja.



RR Raja Ramalingam Syncfusion Team March 22, 2023 07:33 AM UTC

Hello Mathias,


We recommend setting "AppenedInterval" in the RangePadding property, then the visible end range will be appended with an additional interval.


If this option doesn't meet your requirements, you can use the ActualRangeChanged event of the axis. This event is triggered when the actual range of the axis is changed. Here you can modify the Minimum and Maximum properties of the axis as per your requirements.


Best regards,

Raja.


Loader.
Live Chat Icon For mobile
Up arrow icon