TrackballVisibilityMode.auto does not render trackball marker when shape is DataMarkerType.image #2006
Closed
Description
Bug description
TrackballVisibilityMode.auto does not render trackball marker when shape is DataMarkerType.image. It works when shape is DataMarkerType.circle is selected and in the series marker settings isVisible is specified as true.
Steps to reproduce
- In the given code sample, replace shape parameter of markerSettings of TrackballBehavior with DataMarkerType.image and provide and imageProvider for the image object.
- Render the ChartWidget in both cases and see the difference.
Code sample
Code sample
class ChartWidget extends HookWidget {
const ChartWidget({super.key, required this.data,});
final List<_SalesData> data;
@override
Widget build(BuildContext context) {
ValueNotifier<TrackballBehavior> _trackballBehavior = useState(TrackballBehavior(
tooltipDisplayMode: TrackballDisplayMode.none,
lineType: TrackballLineType.none,
activationMode: ActivationMode.singleTap,
shouldAlwaysShow: true,
enable: true,
markerSettings: const TrackballMarkerSettings(
// Setting the marker visibility mode as auto
markerVisibility: TrackballVisibilityMode.auto,
shape: DataMarkerType.circle,
color: Colors.amber,
)),);
log("Build called");
return SizedBox(
height: 400,
child: SfCartesianChart(
onTrackballPositionChanging: (trackballArgs) {
if (trackballArgs.chartPointInfo.seriesIndex == 1) {
log("Index: ${trackballArgs.chartPointInfo.dataPointIndex}");
}
},
primaryXAxis: const CategoryAxis(),
primaryYAxis: const NumericAxis(),
// Enabled trackball behavior for the chart
trackballBehavior: _trackballBehavior.value,
series: <LineSeries<_SalesData, String>>[
LineSeries<_SalesData, String>(
dataSource: data,
name: "Line Series 2",
xValueMapper: (_SalesData sales, _) => sales.year.toString(),
yValueMapper: (_SalesData sales, _) => sales.sales,
width: 2.5,
color: Colors.transparent,
markerSettings: const MarkerSettings(
isVisible:
false // Setting false for the second series to not to render marker for this series.
),
dataLabelSettings: const DataLabelSettings(isVisible: false),
),
LineSeries<_SalesData, String>(
width: 2.5,
color: Colors.pink,
dataSource: data.getRange(0, 3).toList(),
name: "abc",
xValueMapper: (_SalesData sales, _) => sales.year.toString(),
yValueMapper: (_SalesData sales, _) => sales.sales,
markerSettings:
// Enabled and setting the marker width and height to 0 in order to render marker only
// when the trackball is activated.
const MarkerSettings(isVisible: true, width: 0, height: 0),
dataLabelSettings: const DataLabelSettings(isVisible: false),
),
]),
);
}
}
class _SalesData {
_SalesData(this.sales, this.year);
final int year;
final int sales;
}
Screenshots or Video
Screenshots / Video demonstration
[Upload media here]
Stack Traces
Stack Traces
No stack trace
On which target platforms have you observed this bug?
Android, iOS
Flutter Doctor output
Doctor output
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.22.2, on macOS 13.6.7 22G720 darwin-x64, locale en-IN)
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 15.2)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2022.3)
[✓] VS Code (version 1.92.0)
[✓] Connected device (3 available)
! Error: Browsing on the local area network for iPhone. Ensure the device is unlocked
and attached with a cable or associated with the same local area network as this Mac.
The device must be opted into Developer Mode to connect wirelessly. (code -27)
[✓] Network resources
• No issues found!```
</details>