5

**I am working on fl-chart (line charts) and I want to remove X-Y labels in this chart as well as grey lines to make a clear look of the chart but I didn't find any customisation in this package. So how can I achieve this task if fl-cart has this option or is there any different package available ?
enter image description here

And also I want to achieve this task so if there is any alternative way please tell me

enter image description here

Arslan Kaleem
  • 1,410
  • 11
  • 25

2 Answers2

9

So I figured it out we can simple add this code in LineChartData to remove these titles data:

titlesData: FlTitlesData(
              show: false,
            ),// to disable all tiles in graph

you can also disable required tiles by specifying titles like:

 titlesData: FlTitlesData(
                  bottomTitles: SideTitles(showTitles: false),
                  leftTitles: SideTitles(showTitles: false),
                  rightTitles: SideTitles(showTitles: false),
                  topTitles: SideTitles(showTitles: false),
)

Update: New Way to disbale tiles in new updated lib

titlesData: FlTitlesData(
            leftTitles: AxisTitles(sideTitles: SideTitles(showTitles: false)),
            rightTitles: AxisTitles(sideTitles: SideTitles(showTitles: false)),
            bottomTitles: AxisTitles(sideTitles: SideTitles(showTitles: false)),
            topTitles: AxisTitles(sideTitles: SideTitles(showTitles: false)),
          ),
Arslan Kaleem
  • 1,410
  • 11
  • 25
  • ***UPDATE***: In the later versions, `topTitles` accept `AxisTitles`, and don't take `SideTitles` directly. So in order to achieve that, the following code should work: `FlTitlesData(topTitles: AxisTitles(sideTitles: SideTitles(showTitles: false)))` – Broteen Das Sep 24 '22 at 03:56
  • Thanks @BroteenDas. Updated my answer – Arslan Kaleem Sep 24 '22 at 10:58
1

For fl_chart version 0.55.1+, you have to consider "AxisTitles" before "SideTitle".

thus:

            FlTitlesData(
              bottomTitles:
                  AxisTitles(sideTitles: SideTitles(showTitles: false)),
              leftTitles:
                  AxisTitles(sideTitles: SideTitles(showTitles: false)),
              rightTitles:
                  AxisTitles(sideTitles: SideTitles(showTitles: false)),
              topTitles:
                  AxisTitles(sideTitles: SideTitles(showTitles: false)),
            ),
HenryEl
  • 11
  • 1