My SFCartesianChart labels are specified by the user and can be long, so I'd like to rotate the labels inside the bars. This works great when the chart is transposed, but when not transposed, the only way I see to rotate the text is with labelRotation at 90 or 270, which gives the result below.
Below is my code for the bottom chart. Is there a way to rotate the label and keep it tight to the axis? I experimented with the properties labelAlignment, placeLabelsNearAxis, and others, but they weren't doing what I needed?
SfCartesianChart(
plotAreaBorderWidth: 0,
title: ChartTitle(text: 'Land area of various cities (sq.km)'),
primaryXAxis: CategoryAxis(
labelStyle: const TextStyle(color: Colors.black),
axisLine: AxisLine(width: 0),
labelPosition: ChartDataLabelPosition.inside,
majorTickLines: MajorTickLines(width: 0),
majorGridLines: MajorGridLines(width: 0),
labelRotation: 270,
placeLabelsNearAxisLine: false,
),
palette: const [
Colors.orange,
],
primaryYAxis: NumericAxis(isVisible: false, minimum: 0, maximum: 9000),
series: _getRoundedColumnSeries(),
isTransposed: false,
tooltipBehavior:
TooltipBehavior(enable: true, canShowMarker: false, format: 'point.x : point.y sq.km', header: ''),
)
EDIT
After posting, it occurs to me the above behavior is ideal for labelPosition: ChartDataLabelPosition.outside and that using .inside is incompatible with labelRotation?