Fl_chart: Bar Tooltip Indicators - Option to remove decimal point

Created on 5 Mar 2020  路  3Comments  路  Source: imaNNeoFighT/fl_chart

This is a pretty simple request, I would like to have the option to hide/remove the decimal points:

Screenshot 2020-03-05 at 13 08 43

And while I'm at it, the option to change the tooltip textStyle would be helpful.

Most helpful comment

Hi buddy
Use getTooltipItems inside the LineTouchTooltipData :

LineChartData(
   lineTouchData: LineTouchData(
      touchTooltipData: LineTouchTooltipData(
         tooltipBgColor: Colors.blueGrey.withOpacity(0.8),
         getTooltipItems: (List<LineBarSpot> spots) {
            return spots.map((LineBarSpot spot) {
               return LineTooltipItem(
                  spot.y.toInt().toString(), //any text you want to show
                  const TextStyle(color: Colors.black) //any style you want
               );
            }).toList();
         }
      ),
   )
)

All 3 comments

Hi buddy
Use getTooltipItems inside the LineTouchTooltipData :

LineChartData(
   lineTouchData: LineTouchData(
      touchTooltipData: LineTouchTooltipData(
         tooltipBgColor: Colors.blueGrey.withOpacity(0.8),
         getTooltipItems: (List<LineBarSpot> spots) {
            return spots.map((LineBarSpot spot) {
               return LineTooltipItem(
                  spot.y.toInt().toString(), //any text you want to show
                  const TextStyle(color: Colors.black) //any style you want
               );
            }).toList();
         }
      ),
   )
)

Thank you!

Nope!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kw2019ltd picture kw2019ltd  路  6Comments

BadReese picture BadReese  路  6Comments

davidmarinangeli picture davidmarinangeli  路  3Comments

mahmoudparandeh picture mahmoudparandeh  路  6Comments

jitenders859 picture jitenders859  路  5Comments