Articles in this section
Category / Section

How to set the position of primary and secondary axes of WPF SFChart ?

1 min read

Scaling for the chart bounds is within a single quadrant, but some scenarios demand scaling across the quadrants.

You can achieve this by adjusting the position of axis by using the Origin and ShowAxisNextToOrigin properties in WPF Chart (SfChart). The Origin property manages the axis position and represents the axis value. When this is the primary axis, the corresponding axis is positioned on the secondary axis according to the Origin property's value. You also have to enable the ShowAxisNextToOrigin property to enable the Origin property to work.

Note:

For CategoryAxis, specify the label index as a value for the Origin property as given in the following code example. This value is not a pixel value, but it is an axis value.

XAML

<syncfusion:SfChart.PrimaryAxis>
    <syncfusion:CategoryAxis Origin="137" ShowAxisNextToOrigin="True" EdgeLabelsDrawingMode="Shift"/>
</syncfusion:SfChart.PrimaryAxis>
<syncfusion:SfChart.SecondaryAxis>
    <syncfusion:NumericalAxis Origin="2" ShowAxisNextToOrigin="True" EdgeLabelsDrawingMode="Shift"/>                               
</syncfusion:SfChart.SecondaryAxis>

C#

this.sampleChart.PrimaryAxis = new CategoryAxis();
this.sampleChart.PrimaryAxis.Origin = 137;
this.sampleChart.PrimaryAxis.ShowAxisNextToOrigin = true;
this.sampleChart.SecondaryAxis = new NumericalAxis();
this.sampleChart.SecondaryAxis.Origin = 2;
this.sampleChart.SecondaryAxis.ShowAxisNextToOrigin = true;

 

Change the position of WPF Chart Axis

Conclusion

I hope you enjoyed learning about how to set the position of primary and secondary axes of WPF SFChart.

You can refer to our WPF SFChart featuretour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. You can also explore our WPF SFChart example to understand how to create and manipulate data.

For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.

If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forumsDirect-Trac, or feedback portal. We are always happy to assist you!


Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied