0

I have two LineCharts inside one SfCartesianChart, now I have enabled tooltip for both of them but I dont know how to change the one Header for both to two different Headers for each of them, if they are inside each other like this:

series: <ChartSeries>[
            LineSeries<ChartData, String>(
              dataSource: chartData,
              xValueMapper: (ChartData data, _) => data.x,
              yValueMapper: (ChartData data, _) => data.y,
              markerSettings: const MarkerSettings(
                borderColor: Color(0xFFE08055),
                isVisible: true,
                color: Color(0xFFCC6699),
                shape: DataMarkerType.circle,
              ),
              color: chartColor,
              dataLabelMapper: (ChartData data, _) => '${data.y}',
            ),
            LineSeries<ChartData, String>(
              dataSource: rainPercentChartDaily,
              xValueMapper: (ChartData data, _) => data.x,
              yValueMapper: (ChartData data, _) => data.y,
              isVisible: rainLineChart == true && chartData == visitorChartDaily
                  ? true
                  : false,
              markerSettings: const MarkerSettings(
                borderColor: Color(0xFF800080),
                isVisible: true,
                color: Colors.deepOrange,
                shape: DataMarkerType.circle,
              ),
              color: const Color.fromARGB(255, 56, 162, 197),
            ),
          ],
          tooltipBehavior: TooltipBehavior(enable: true, header: chartName),

I define the chartName for each of my charts elsewhere in my code. Right now I somehow need the tooltip of the second LineChart to show me the its header name instead of the header of the first LineChart.

I tried an if check, but with this I'm only be able to change the whole thing instead of the inidividual one. I tried doint individual tooltips, but the LineCharts itselfs doesnt support it, I tried enabling the tooltip of each of them indidually but then it shows nothing. Commenting out the header you can see, that each of them has their own header, but I dont know how to change both of them individually instead of the whole thing.

  • Be aware that the SyncFusion products in the Dart/Flutter pub are *not* open source. They are released under a commercial license that may subject you or your organization to a financial liability, and will affect downstream re-users of your code. – Randal Schwartz Jun 14 '23 at 19:52

0 Answers0