Skip to content

Can not disable the trackball marker for specific series in Cartesian charts #1913

@furuyan

Description

@furuyan

Bug description

I want to disable the trackball marker for specific series in Cartesian charts,
and I implemented code based on this reference.
https://support.syncfusion.com/kb/article/10485/how-to-disable-the-trackball-marker-for-specific-series-in-cartesian-charts

It worked fine in syncfusion_flutter_charts 24.1.46, but in 25.2.5, TrackballMarker is now showing up in all Series.

Steps to reproduce

  1. Drag the chart

Code sample

Code sample
class _MyHomePageState extends State<_MyHomePage> {
  late TrackballBehavior _trackballBehavior;
  @override
  void initState() {
    _trackballBehavior = TrackballBehavior(
        enable: true,
        activationMode: ActivationMode.singleTap,
        shouldAlwaysShow: true,
        builder: (BuildContext context, TrackballDetails trackballDetails) {
            return Container(
              padding: const EdgeInsets.all(3.0),
              decoration: BoxDecoration(
                  border: Border.all(color: Colors.black)
              ),
              child: Text("Custom Tooltip"),
            );
        },
        markerSettings: TrackballMarkerSettings(
          markerVisibility: TrackballVisibilityMode.auto,
        ));
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        backgroundColor: Colors.grey,
        appBar: AppBar(
          title: const Text('Syncfusion Flutter chart'),
        ),
        body: Center(
          child: Container(
            height: 500,
            width: 340,
            child: SfCartesianChart(
                backgroundColor: Colors.white,
                primaryXAxis: CategoryAxis(),
                trackballBehavior: _trackballBehavior,
                series: <LineSeries<_SalesData, String>>[
                  LineSeries<_SalesData, String>(
                      dataSource: <_SalesData>[
                        _SalesData('Jan', 35),
                        _SalesData('Feb', 28),
                        _SalesData('Mar', 34),
                        _SalesData('Apr', 32),
                        _SalesData('May', 40)
                      ],
                      xValueMapper: (_SalesData sales, _) => sales.year,
                      yValueMapper: (_SalesData sales, _) => sales.sales,
                      markerSettings:
                          MarkerSettings(isVisible: true, width: 0, height: 0)),
                  LineSeries<_SalesData, String>(
                      dataSource: <_SalesData>[
                        _SalesData('Jan', 15),
                        _SalesData('Feb', 8),
                        _SalesData('Mar', 14),
                        _SalesData('Apr', 12),
                        _SalesData('May', 20)
                      ],
                      xValueMapper: (_SalesData sales, _) => sales.year,
                      yValueMapper: (_SalesData sales, _) => sales.sales,
                      markerSettings: MarkerSettings(
                          isVisible:
                              false // Setting false to this series to not to render marker for this series.
                          ))
                ]),
          ),
        ));
  }
}

class _SalesData {
  _SalesData(this.year, this.sales);

  final String year;
  final double sales;
}

Screenshots or Video

24.1.46(Correct behavior) 25.2.7(Incorrect behavior)

Stack Traces

Stack Traces
no stack trace

On which target platforms have you observed this bug?

Android, iOS

Flutter Doctor output

Doctor output
[✓] Flutter (Channel stable, 3.19.0, on macOS 14.5 23F79 darwin-arm64, locale ja-JP)
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 15.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2023.2)
[✓] VS Code (version 1.89.1)
[✓] Connected device (4 available)
[✓] Network resources

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingchartsCharts componentfixedFixed and delivered updatewaiting for customer responseCannot make further progress until the customer responds.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions