0

I have been facing issues with displaying the tooltip for my line graph which is created from the FL charts package. On touching the line spots of the graph, my tooltip data is being duplicated and I have no idea why. Below attached is an example image and the code for my line chart.

enter image description here

LineChart(
              LineChartData(
                titlesData: FlTitlesData(
                  leftTitles: AxisTitles(),
                  rightTitles: AxisTitles(
                    sideTitles: SideTitles(
                      getTitlesWidget: getTitles,
                      reservedSize: 40,
                      showTitles: true,
                    ),
                  ),
                  topTitles: AxisTitles(),
                  bottomTitles: AxisTitles(),
                ),
                gridData: FlGridData(
                  show: true,
                  drawVerticalLine: true,
                  drawHorizontalLine: true,
                  horizontalInterval: 4,
                ),
                lineTouchData: LineTouchData(enabled: true),
                maxY: 100,
                lineBarsData: widget.weightLogData.map(
                  (d) {
                    List<FlSpot> weights = List.generate(
                      10,
                      (int index) {
                        return FlSpot(double.parse(index.toString()),
                            widget.weightLogData[index].weight!);
                      },
                      growable: false,
                    );
                    return LineChartBarData(
                      dotData: FlDotData(show: false),
                      spots: weights,
                      lineChartStepData: LineChartStepData(
                        stepDirection: 20,
                      ),
                    );
                  },
                ).toList(),
              ),
            ),
Syed A.R
  • 159
  • 1
  • 9

0 Answers0