Hi, I had a question while using the SfCartesian Chart with multiple axis.
I'm creating a mobile app and below is my chart, with two different data series.
As you can see below, the first series has a max of 15 (blue) and second has a max of 60. Because the chart is generated in a way such that the second y-axis has a maximum value of 70, the chart ends up with multiple horizontal lines with random intervals.
I was wondering if there was a way I could align the secondary axis interval with the primary axis in a way such that [maximum value for the secondary axis] would be [maximum value of the primary axis * n]. In the below example, since the maximum value of the primary axis is 20, I would prefer the secondary axis to have a max value of either 60 or 80 so that the grid lines are aligned. Is there a way I could possibly do this?
|
axes: [
NumericAxis(
opposedPosition: true,
name: 'yaxis',
minimum: 0,
interval: 20)
], |
Thank you so much. This would partially solve my issue.
The reason I said "partially" is because, while the second axis will always be larger than the primary axis,
(the primary is avg value while the secondary is a sum)
The primary isn't always 20. I was wondering if there was a way such that I could do sth like belowaxes: [
NumericAxis(
opposedPosition: true,
name: 'yaxis',
minimum: 0,
interval: [PrimaryAxisMaxValue * 4])
],
Thanks
|
int labelCount = 0;
int max = 0;
SfCartesianChart(
onActualRangeChanged: (ActualRangeChangedArgs args) {
if (args.axisName == 'primaryYAxis') {
labelCount = (args.visibleMax / args.visibleInterval).floor();
max = args.visibleMax.floor();
}
if (args.axisName == 'y-axis') {
args.visibleInterval = max * labelCount / labelCount;
args.visibleMax = max * labelCount;
}
}
) |