child: SfCartesianChart(
onActualRangeChanged:
(args) {
if (args.orientation == AxisOrientation.horizontal)
{
// You can get the x axis
maximum value pixel point here. This is the x axis right side pixel value.
So, opposed y-axis started from this position.
double visibleMax
= seriesController
.pointToPixel(CartesianChartPoint(args.visibleMax, 0))
.dx;
// You can get the x axis
minimum value pixel point here.
double visibleMin = seriesController
.pointToPixel(CartesianChartPoint(args.visibleMin,
0))
.dx;
// You can get the
x axis width here.
double xAxisWidth = visibleMax - visibleMin;
}
},
series:
<ChartSeries<_SalesData, double>>[
LineSeries<_SalesData, double>(
dataSource: data,
xValueMapper: (_SalesData sales, _) => sales.sales,
yValueMapper: (_SalesData sales, _) => sales.size,
onRendererCreated: (controller) {
seriesController = controller;
},
)
],
….
)
|