plotOffset does not eliminate gaps
The default sample charts do not start/end at zero value, leaving a gap space on both left and right side of the chart.
plotOffset supposedly should eliminate the gaps, however despite setting it to zero there is still a gap on both left and right side.
See chart attached.
Attachment: plotoffset_bfe810f7.7z
SIGN IN To post a reply.
3 Replies
1 reply marked as answer
SK
Sriram Kiran Senthilkumar
Syncfusion Team
October 12, 2020 12:04 PM UTC
Hi Predrag,
Greetings from Syncfusion. We have analyzed your scenario with the provided information, and we assume that you are using category axis as your x-axis and the default axis label placement value for the category axis is betweenTicks and due to this only there is some space at the start and end of the chart. So, we would like to share some information regarding the labelPlacement property of CategoryAxis available in our chart. When the labelPlacement property is set as LabelPlacement.betweenTicks, the chart will start rendering from the middle of the first axis label and ends at the middle of last axis label and if the labelPlacement property is set as LabelPlacement.onTicks, the chart will start rendering from the left edge (zero value) of the chart area and ends at right edge. The default value of the labelPlacemnt property is betweenTicks.
Please check the code snippets below for further reference.
LabelPlacement.betweenTicks:
|
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: Container(
child: SfCartesianChart(
primaryXAxis: CategoryAxis(
// Axis labels will be placed between the ticks
labelPlacement: LabelPlacement.betweenTicks
)
)
)
)
);
} |
Screenshot
LabelPlacement.onTicks
|
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: Container(
child: SfCartesianChart(
primaryXAxis: CategoryAxis(
// Axis labels will be placed on the ticks
labelPlacement: LabelPlacement.onTicks
)
)
)
)
);
} |
Screenshot
And so, to overcome the reported scenario regarding the charts do not start/end at zero value, leaving a gap space on both left and right side of the chart, kindly set the value of the labelPlacement property to LabelPlacement.onTicks.
For further reference on the labelPlacement property, please check the user guide and API reference below.
UG: https://help.syncfusion.com/flutter/cartesian-charts/axis-types#placing-labels-between-the-ticks
Please get in touch with us if you require further assistance on this.
Regards,
Sriram Kiran
Marked as answer
PC
Predrag Cvetkovski
October 12, 2020 01:44 PM UTC
Thanks Sriram, LabelPlacement.onTicks solved the issue.
SK
Sriram Kiran Senthilkumar
Syncfusion Team
October 13, 2020 04:51 AM UTC
Hi Predrag,
Most welcome. We are always happy in assisting you. Kindly revert us if you have further queries.
Regards,
Sriram Kiran
SIGN IN To post a reply.
- 3 Replies
- 2 Participants
- Marked answer
-
PC Predrag Cvetkovski
- Oct 10, 2020 12:56 AM UTC
- Oct 13, 2020 04:51 AM UTC