How to inverse the chart axis in React Chart?
This article explains how to inverse the chart axis in the React Chart.
Customize the chart axis inversion
You can easily inverse the chart axis by setting the isInversed property to true, causing the highest value of the axis to move closer to the origin and vice versa.
In the following code example, the primary x-axis is inverted.
Index.js
import { createRoot } from 'react-dom/client';
import * as React from 'react';
import { ChartComponent, SeriesCollectionDirective, SeriesDirective, Inject, ColumnSeries
} from '@syncfusion/ej2-react-charts';
const Column = () => {
return (
<chartcomponent id="charts" primaryxaxis="{{" interval:="" 1,="" isinversed:="" true="" }}="" primaryyaxis="{{" minimum:="" 0,="" maximum:="" 50,="" 5="">
<inject services="{[ColumnSeries]}">
<seriescollectiondirective>
<seriesdirective datasource="{data}" xname="x" columnspacing="{0.1}" yname="y" type="Column" fill="#ffc803">
</seriesdirective></seriescollectiondirective>
</inject></chartcomponent>
);
};
export default Column;
const root = createRoot(document.getElementById('sample'));
root.render(<column>);
The following screenshot illustrate the output of the above code snippet.
Screenshot:
For a practical demonstration, refer to the sample of stackblitz
Conclusion
I hope you enjoyed learning how to inverse the chart axis in the React Chart Component.
You can refer to our React Chart feature tour 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 React Chart 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 forums, support portal, or feedback portal. We are always happy to assist you!