Dalon
Dalon

Reputation: 700

Flutter fl_chart limit amount of titles on x axis

Is it possible to limit the amount of shown titles on the x axis (e.g. max 3 titles) to avoid that titles overlap like in the picture? enter image description here

Upvotes: 0

Views: 792

Answers (1)

Shackleford
Shackleford

Reputation: 620

You can use the bottomTitles parameter when creating your LineChartData object to specify an interval.

bottomTitles: AxisTitles(
    sideTitles: SideTitles(
        showTitles: true,
        interval: 10,
    ),
),

If you want even more control, you can specify a functor for the getTitlesWidget parameter to control exactly which values are labeled and how they're styled.

Take a look at the code sample for Sample 1 here.

Upvotes: 1

Related Questions