Container(
color: Colors.black,
alignment: Alignment.center,
height: 500,
width: MediaQuery.of(context).size.width,
child: ClipRRect(
borderRadius: BorderRadius.circular(40),
child: data.isLoading?Center(child: CircularProgressIndicator(),): SfCartesianChart(
title: ChartTitle(
text: 'Cases Over Time:',
textStyle: ChartTextStyle(
color: Colors.white,
fontFamily: 'CM',
fontSize: 20,
fontWeight: FontWeight.bold)),
backgroundColor: Color.fromRGBO(35, 35, 35, 1),
zoomPanBehavior: ZoomPanBehavior(
enablePinching: true),
/* primaryXAxis: CategoryAxis(
majorGridLines: MajorGridLines(color: Colors.white),
), */
primaryXAxis: CategoryAxis(
title: AxisTitle(
text: 'Dates-',
textStyle: ChartTextStyle(
color: Colors.deepOrange,
fontFamily: 'CM',
fontStyle: FontStyle.italic,
fontWeight: FontWeight.w300)) ),
primaryYAxis: CategoryAxis(
title: AxisTitle(
text: 'Cases-',
textStyle: ChartTextStyle(
color: Colors.deepOrange,
fontFamily: 'CM',
fontStyle: FontStyle.italic,
fontWeight: FontWeight.w300)) ),
plotAreaBorderColor: Colors.amber,
plotAreaBackgroundColor: Colors.grey,
borderWidth: 10,
tooltipBehavior: TooltipBehavior(enable: true,
),
margin: EdgeInsets.fromLTRB(0, 0, 40, 0),
palette: <Color>[Colors.amber, Colors.red, Colors.green],
legend: Legend(isVisible: true,overflowMode: LegendItemOverflowMode.wrap,),
series: <LineSeries<TimeData, String>>[
LineSeries<TimeData, String>(
enableTooltip: true,
name: 'Confirmed cases',
dataSource: <TimeData>[...data.confirmedcasesTimeItems],
animationDuration: 5000,
xValueMapper: (TimeData data, _) => data.date,
yValueMapper: (TimeData data, _) => data.cases,
),
LineSeries<TimeData, String>(
enableTooltip: true,
name: 'Deceased cases',
dataSource: <TimeData>[...data.deceasedcasesTimeItems],
animationDuration: 5000,
xValueMapper: (TimeData data, _) => data.date,
yValueMapper: (TimeData data, _) => data.cases,
),
LineSeries<TimeData, String>(
enableTooltip: true,
name: 'Recovered cases',
dataSource: <TimeData>[...data.recoveredcasesTimeItems],
animationDuration: 5000,
xValueMapper: (TimeData data, _) => data.date,
yValueMapper: (TimeData data, _) => data.cases,
dataLabelSettings: DataLabelSettings(isVisible: false)),
]),
))
now from this code when i remove the title form primaryXaxis and
primaryYaxis and use below code snippet only then tooltip works fine.