Arslan Kaleem
Arslan Kaleem

Reputation: 1618

how to remove X-Y values in this fl-chart flutter

**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

Upvotes: 5

Views: 5873

Answers (2)

Arslan Kaleem
Arslan Kaleem

Reputation: 1618

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)),
          ),

Upvotes: 11

HenryEl
HenryEl

Reputation: 11

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)),
            ),

Upvotes: 1

Related Questions