selectionGesture property

ActivationMode selectionGesture
final

Data points or series can be selected while performing interaction on the chart.

It can also be selected at the initial rendering using this property.

Defaults to [].

late SelectionBehavior _selectionBehavior;

void initState() {
  _selectionBehavior = SelectionBehavior(enable: true);
  super.initState();
}

Widget build(BuildContext context) {
   return Container(
       child: SfPyramidChart(
          series: PyramidSeries<ChartData, String>(
                 initialSelectedDataIndexes: <int>[1,0],
                 selectionBehavior: _selectionBehavior
             ),
       )
   );
}

Gesture for activating the selection.

Selection can be activated in ActivationMode.none, ActivationMode.singleTap, ActivationMode.doubleTap and ActivationMode.longPress.

Defaults to ActivationMode.singleTap.

Also refer ActivationMode.

late SelectionBehavior _selectionBehavior;

void initState() {
  _selectionBehavior = SelectionBehavior(enable: true);
  super.initState();
}

Widget build(BuildContext context) {
   return Container(
       child: SfPyramidChart(
          selectionGesture: ActivationMode.singleTap,
          series: PyramidSeries<ChartData, String>(
                 selectionBehavior: _selectionBehavior
             ),
       )
   );
}

Implementation

/// Gesture for activating the selection.
///
/// Selection can be activated in `ActivationMode.none`,
/// `ActivationMode.singleTap`,
/// `ActivationMode.doubleTap` and
/// `ActivationMode.longPress`.
///
/// Defaults to `ActivationMode.singleTap`.
///
/// Also refer [ActivationMode].
///
/// ```dart
/// late SelectionBehavior _selectionBehavior;
///
/// void initState() {
///   _selectionBehavior = SelectionBehavior(enable: true);
///   super.initState();
/// }
///
/// Widget build(BuildContext context) {
///    return Container(
///        child: SfPyramidChart(
///           selectionGesture: ActivationMode.singleTap,
///           series: PyramidSeries<ChartData, String>(
///                  selectionBehavior: _selectionBehavior
///              ),
///        )
///    );
/// }
/// ```
final ActivationMode selectionGesture;