Eliran Turgeman
Eliran Turgeman

Reputation: 1656

disable grid and axis labels on scatter plot flutter

I am using charts_flutter package and I can't find a way to hide\disable the grid and axis labels.

Relevant code:

class _VennState extends State<VennDiagramWidget> {
  List<charts.Series<VennCircle, int>> circlesList;

  static List<charts.Series<VennCircle, int>> _createRandomCircles() {
    final circles = [
      VennCircle('red', 1, 5, 0.8, 'Venn1'),
      VennCircle('black', 2, 10, 0.5, 'Venn2'),
      VennCircle('green', 3, 20, 1, 'Venn3'),
    ];

    return [
      new charts.Series(
        id: 'circles',
        data: circles,
        domainFn: (VennCircle venn, _) => venn.circleSize,
        measureFn: (VennCircle venn, _) => venn.opacity,
        colorFn: (VennCircle venn, _) {
          if (venn.circleColor == 'red') {
            return charts.MaterialPalette.red.shadeDefault;
          } else if (venn.circleColor == 'black') {
            return charts.MaterialPalette.black;
          }
          return charts.MaterialPalette.green.shadeDefault;
        },
        radiusPxFn: (VennCircle venn, _) => venn.circleSize,
      ),
    ];
  }

  scatterPlot() {
    return new charts.ScatterPlotChart(
      circlesList,
      animate: true,
    );
  }

Right now, that's how it looks

enter image description here

I wish to remove the values labels on both axis and the grid\ticks so I can see only the circles.

Upvotes: 1

Views: 740

Answers (1)

Develocode 777
Develocode 777

Reputation: 1305

Try these options:

charts.ScatterPlotChart(
      seriesList, 
      animate: animate,
      primaryMeasureAxis:
            new charts.NumericAxisSpec(
              showAxisLine: true,
              renderSpec: new charts.NoneRenderSpec(),     
              ),
      domainAxis: 
            new charts.NumericAxisSpec(
              showAxisLine: true,
              renderSpec: new charts.NoneRenderSpec(),
              ),
      );


Upvotes: 1

Related Questions