How to view corner data point without cutting in edge of React Chart?
This article explains how to view corner data point without cutting in edge of the React Chart.
Customize the appearance of corner data point without cutting at the edge
Solution 1:
You can view the edge data point without cutting or overlapping in the chart by setting plotOffset property in the axis.
In the following code example, the plotoffset property is applied for both axis.
Index.js
<ChartComponent
id="charts"
primaryXAxis={{
edgeLabelPlacement: 'Shift',
lineStyle: { width: 2 },
valueType: 'Category',
labelPlacement: 'OnTicks',
plotOffset: 12
}}
primaryYAxis={{
minimum: 0,
maximum: 10,
interval: 2,
lineStyle: { width: 2 },
rangePadding: 'None',
plotOffset: 15
}}
>
<Inject services={[ScatterSeries, Category]} />
<SeriesCollectionDirective>
<SeriesDirective
dataSource={scatterData}
width={2}
xName="x"
yName="y"
type="Scatter"
marker={{
visible: false,
width: 15,
height: 15,
shape: 'Circle',
}}
/>
</SeriesCollectionDirective>
</ChartComponent>
Screenshot:
Solution 2:
You can view the edge data point without cutting in chart by setting rangePadding property as Additional in axis.
In the following code example, the range padding as additional applied for both axis.
Index.js
<ChartComponent
id="charts"
primaryXAxis={{
lineStyle: { width: 2 },
valueType: 'Double',
labelPlacement: 'OnTicks',
rangePadding: 'Additional'
}}
primaryYAxis={{
minimum: 0,
lineStyle: { width: 2 },
rangePadding: 'Additional'
}}
>
<Inject services={[ScatterSeries]} />
<SeriesCollectionDirective>
<SeriesDirective
dataSource={scatterData}
width={2}
xName="x"
yName="y"
type="Scatter"
marker={{
visible: false,
width: 15,
height: 15,
shape: 'Circle'
}}
/>
</SeriesCollectionDirective>
</ChartComponent>
Screenshot:
If you are using a primary x-axis as a DateTime axis, you can use the following solution.
Index.js
<ChartComponent
id="charts"
primaryXAxis={{
valueType: 'DateTime',
labelFormat: 'MMM',
lineStyle: { width: 2 },
rangePadding: 'Additional'
}}
primaryYAxis={{
lineStyle: { width: 2 },
rangePadding: 'Additional'
}}
>
<Inject services={[ScatterSeries, DateTime]} />
<SeriesCollectionDirective>
<SeriesDirective
dataSource={scatterData}
width={2}
xName="x"
yName="y"
type="Scatter"
marker={{
visible: false,
width: 15,
height: 15,
shape: 'Circle'
}}
/>
</SeriesCollectionDirective>
</ChartComponent>
Screenshot:
Solution 3:
You can view the edge data point without cutting in chart by setting minimum and maximum property in axis.
In the following code example, the minimum and maximum is applied for both axis.
Index.js
<ChartComponent
id="charts"
primaryXAxis={{
lineStyle: { width: 2 },
valueType: 'Double',
labelPlacement: 'OnTicks',
minimum: 0,
maximum: 8,
interval: 1
}}
primaryYAxis={{
minimum: 0,
maximum: 12,
interval: 2,
lineStyle: { width: 2 }
}}
>
<Inject services={[ScatterSeries]} />
<SeriesCollectionDirective>
<SeriesDirective
dataSource={scatterData}
width={2}
xName="x"
yName="y"
type="Scatter"
marker={{
visible: false,
width: 15,
height: 15,
shape: 'Circle'
}}
/>
</SeriesCollectionDirective>
</ChartComponent>
Screenshot:
Conclusion
I hope you enjoyed learning how to view corner data point without cutting in edge of 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!