alignment property Null safety

ChartAlignment alignment
final

Aligns the chart title.

The alignment change is applicable only when the width of the chart title is less than the width of the chart.

  • ChartAlignment.near places the chart title at the beginning of the chart

  • ChartAlignment.far moves the chart title to end of the chart

  • ChartAlignment.center places the title at the center position of the chart’s width.

Defaults to ChartAlignment.center.

Also refer ChartAlignment.

Widget build(BuildContext context) {
  return SfCartesianChart(
    title: ChartTitle(
      text: 'Chart Title',
      alignment: ChartAlignment.near
    )
  );
}

Implementation

final ChartAlignment alignment;