What’s New in 2020 Volume 3: Flutter Charts | Syncfusion Blogs
Live Chat Icon For mobile
Live Chat Icon
Popular Categories.NET  (174).NET Core  (29).NET MAUI  (207)Angular  (109)ASP.NET  (51)ASP.NET Core  (82)ASP.NET MVC  (89)Azure  (41)Black Friday Deal  (1)Blazor  (215)BoldSign  (14)DocIO  (24)Essential JS 2  (107)Essential Studio  (200)File Formats  (66)Flutter  (133)JavaScript  (221)Microsoft  (119)PDF  (81)Python  (1)React  (100)Streamlit  (1)Succinctly series  (131)Syncfusion  (915)TypeScript  (33)Uno Platform  (3)UWP  (4)Vue  (45)Webinar  (51)Windows Forms  (61)WinUI  (68)WPF  (159)Xamarin  (161)XlsIO  (36)Other CategoriesBarcode  (5)BI  (29)Bold BI  (8)Bold Reports  (2)Build conference  (8)Business intelligence  (55)Button  (4)C#  (147)Chart  (131)Cloud  (15)Company  (443)Dashboard  (8)Data Science  (3)Data Validation  (8)DataGrid  (63)Development  (628)Doc  (8)DockingManager  (1)eBook  (99)Enterprise  (22)Entity Framework  (5)Essential Tools  (14)Excel  (40)Extensions  (22)File Manager  (7)Gantt  (18)Gauge  (12)Git  (5)Grid  (31)HTML  (13)Installer  (2)Knockout  (2)Language  (1)LINQPad  (1)Linux  (2)M-Commerce  (1)Metro Studio  (11)Mobile  (507)Mobile MVC  (9)OLAP server  (1)Open source  (1)Orubase  (12)Partners  (21)PDF viewer  (43)Performance  (12)PHP  (2)PivotGrid  (4)Predictive Analytics  (6)Report Server  (3)Reporting  (10)Reporting / Back Office  (11)Rich Text Editor  (12)Road Map  (12)Scheduler  (52)Security  (3)SfDataGrid  (9)Silverlight  (21)Sneak Peek  (31)Solution Services  (4)Spreadsheet  (11)SQL  (10)Stock Chart  (1)Surface  (4)Tablets  (5)Theme  (12)Tips and Tricks  (112)UI  (387)Uncategorized  (68)Unix  (2)User interface  (68)Visual State Manager  (2)Visual Studio  (31)Visual Studio Code  (19)Web  (592)What's new  (332)Windows 8  (19)Windows App  (2)Windows Phone  (15)Windows Phone 7  (9)WinRT  (26)
What’s New in 2020 Volume 3: Flutter Charts

What’s New in 2020 Volume 3: Flutter Charts

At Syncfusion, we are continuously reviewing the constructive questions and comments we receive from our customers, which include various feature requests. From these, we handpicked the most widely requested features and made them available in the Essential Studio 2020 Volume 3 release.

In this blog post, I’ll quickly review the new chart types and features included in the Flutter Charts widget for the 2020 Volume 3 release.

Let’s see them!

New chart types

We extended the Syncfusion Flutter Charts widget to support two more chart types:

Box and whisker chart

The box and whisker chart is used to visualize a group of numerical data through its quartiles. It is also referred to as a box plot. Box plots may also have lines extending vertically from the boxes (whiskers) indicating variability outside the upper and lower quartiles.

Refer to the following code.

 
[Dart]
SfCartesianChart(
  series: <BoxAndWhiskerSeries<ChartData, String>>[
    BoxAndWhiskerSeries<ChartData, String>(
      dataSource: <ChartData>[
        ChartData('Development', [22, 22, 23, 25, 25, 25, 26, 27, 27]),
        ChartData('HR', [22, 24, 25, 30, 32, 34, 36, 38, 39, 41]),
        //...
      ],
      showMean: true,
      xValueMapper: (ChartData data, _) => data.x,
      yValueMapper: (ChartData data, _) => data.y
    ),
  ]
)  

After executing this code example, we will get output like in the following screenshot.

Box and whisker chart
Box and whisker chart

UG link: https://help.syncfusion.com/flutter/cartesian-charts/chart-types#box-and-whisker-chart

SB sample link: https://flutter.syncfusion.com/#/cartesian-charts/chart-types/box-and-whisker/box-and-whisker-chart

Waterfall chart

The waterfall chart shows gradual changes in the quantitative value of an entity that is subjected to changes by increments or decrements. Using the waterfall chart, you can quickly illustrate changes in revenue.

Refer to the following code.

 
[Dart]
SfCartesianChart(
  series: <ChartSeries<ChartData, double>>[
    WaterfallSeries<ChartData, double>(
      dataSource: <ChartData>[
        ChartData(2, 10),
        ChartData(3, -3),
        ChartData(4, 5, true),
        //...
        ChartData(13, -5, false, true),
      ],
      xValueMapper: (ChartData data, _) => data.x,
      yValueMapper: (ChartData data, _) => data.y,
      intermediateSumPredicate: (ChartData data, _) => data.isIntermediate,
      totalSumPredicate: (ChartData data, _) => data.isTotal,
      negativePointsColor: const Color.fromRGBO(229, 101, 144, 1),
      intermediateSumColor: const Color.fromRGBO(79, 129, 188, 1),
      totalSumColor: const Color.fromRGBO(79, 129, 188, 1),
      connectorLineSettings: WaterfallConnectorLineSettings(
        width: 2.5,
        dashArray: <double>[3, 1]
      )
    )
  ]
)

After executing this code example, we will get output like in the following screenshot.

Waterfall chart
Waterfall chart

UG link: https://help.syncfusion.com/flutter/cartesian-charts/chart-types#waterfall-chart

SB sample link: https://flutter.syncfusion.com/#/cartesian-charts/chart-types/waterfall/default-waterfall-chart

Feature enhancements

Exporting

A rendered chart can be exported and saved locally as a PNG image or PDF document for future use. The following code snippet shows exporting a chart as a PNG image.

 
[Dart]
dart_ui.Image data = await _cartesianKey.currentState.toImage(pixelRatio: 3.0);
final bytes = await data.toByteData(format: dart_ui.ImageByteFormat.png);
if (data != null) {
  await Navigator.of(context).push(
    MaterialPageRoute(
      builder: (BuildContext context) {
        return Scaffold(
          body: Center(
            child: Container(
              color: Colors.white,
              child: Image.memory(bytes.buffer.asUint8List()),
            )
          )
        );
      }
    )
  );
}

UG link – https://help.syncfusion.com/flutter/cartesian-charts/export-cartesian-chart

Trackball features

The trackball has the following new feature enhancements in this release.

Marker for trackball

The newly introduced trackball marker feature helps you indicate an exact data point location. You can also add a shape to adorn each data point when the trackball is visible. The trackball marker can be shown or hidden independently and also displayed based on the series marker’s visibility.

Refer to the following code.

 
[Dart]
SfCartesianChart(
  trackballBehavior: TrackballBehavior(
    enable: true,
    markerSettings: TrackballMarkerSettings(
      markerVisibility: TrackballVisibilityMode.visible
    )
  )
)
Trackball marker
Trackball marker

Trackball tooltip overlap

From this Volume 3 release onwards, if there are two or more series data points rendered close to each other, then the trackball tooltips of each data point will not overlap with each other. They will be repositioned automatically. No API is required to enable this feature.

Refer to the following screenshot.
Trackball tooltip overlap

UG link: https://help.syncfusion.com/flutter/cartesian-charts/trackball-crosshair#trackball

SB sample link: https://flutter.syncfusion.com/#/cartesian-charts/user-interactions/trackball/chart-with-trackball

Data label features

The data label feature has the following new enhancements in this release.

Padding for data labels

You can add padding to a data label to move it both vertically and horizontally from its initial position. Logical pixel value is provided as input.

Refer to the following code.

 
[Dart]
SfCartesianChart(
  series: <CartesianSeries<ChartData,num>>[
    SplineSeries<ChartData, num>(
      dataLabelSettings: DataLabelSettings(
        isVisible: true,
        offset: Offset(0, 30)
      )
    )
  ]
)

Refer to the following screenshot.

Padding for data labels

Data label tap callback

This is a callback event. It will be triggered when you tap on a data label of a data point in the series.

Refer to the following code.

 
[Dart]
SfCartesianChart(
  onDatalabelTapped: (DataLabelTapArgs args) {
    print(args.seriesIndex);                 
  },
  series: <ChartSeries<ChartData, DateTime>>[
    LineSeries<ChartData, DateTime>(
      dataLabelSettings: DataLabelSettings(
        isVisible: true
      )
    )
  ]
)

UG link: https://help.syncfusion.com/flutter/cartesian-charts/marker-datalabel#data-label

SB sample link: https://flutter.syncfusion.com/#/cartesian-charts/series-features/data-label/default-data-labels

Animate the series dynamically

You can perform initial rendering animation in an existing series by using this feature. On calling the animate method, a particular series will be animated based on the animationDuration property’s value in the series.

Refer to the following code.

 
[Dart]
Widget build(BuildContext context) {
    ChartSeriesController _chartSeriesController;
      return Column(
        children: <Widget>[
          Container(
            child: SfCartesianChart(
              series: <ChartSeries<ChartData, String>>[
                ColumnSeries<ChartData, String>(
                  animationDuration: 2000,
                  onRendererCreated: (ChartSeriesController controller) {
                    _chartSeriesController = controller;
                  }
                )
              ],
            )
          ),
          Container(
            child: RaisedButton(
                onPressed: () {
                  _chartSeriesController?.animate();
                },
                child: Text('Animate'),
            )
          ),
      );
    }

Animate the series dynamicallySB sample link : https://flutter.syncfusion.com/#/cartesian-charts/series-features/animation/series-animation

Select the data points dynamically

The data points in a chart can be selected programmatically by passing the point index and series index values to the selectDataPoints method.

Refer to the following code.

 
[Dart]
SfCartesianChart chart;
SelectionBehavior selection;

@override
Widget build(BuildContext context) {    
  selection = SelectionBehavior(enable: true);  
  chart = SfCartesianChart(
    series: <CartesianSeries>[
      ColumnSeries<ChartData, double>(
        selectionBehavior: selection
      )
    ]
  );
    
  return Scaffold(
    body: Column(
      children: <Widget>[
        FlatButton(
          child: Text('Select'),
            onPressed: select
          ),
        Container(child: chart)
      ]
    )
  );
}

void select() {
  selection.selectDataPoints(1, 0);
}

Select the data points dynamicallySB sample link: https://flutter.syncfusion.com/#/cartesian-charts/user-interactions/selection/dynamic-selection

Anchor range to data points

This new feature is used to determine the value of the axis range, based on the visible data points or based on the overall data points available in the chart. The visible data points can be changed on performing interactions like pinch zooming, selection zooming, and panning, and also on specifying visibleMinimum and visibleMaximum values.

Refer to the following code.

 
[Dart]
SfCartesianChart(
  primaryYAxis: NumericAxis(
    anchorRangeToVisiblePoints: true
  )
)

Anchor range to data pointsSB sample link: https://flutter.syncfusion.com/#/cartesian-charts/user-interactions/zooming-and-panning/pinch-zooming

Breaking changes

The selectionSettings property and the SelectionSettings class have been deprecated. Now, you can use the selectionBehavior property and SelectionBehavior class, respectively, instead of them.

Refer to the following code.

 
[Dart]
SfCartesianChart(
  series: <CartesianSeries<ChartData, double>>[
    ColumnSeries<ChartData, double>(
      selectionBehavior: SelectionBehavior(
        // Enables selection
        enable: true
      )
    )
  ]
);

Conclusion

I hope you now have a clear idea of the various new features and enhancements available for the Syncfusion Flutter Charts widget in the 2020 Volume 3 release. For more details about the bug fixes and other enhancements, check out our release notes.

Browse our documentation to learn more about our Syncfusion Flutter widgets. You can also see Syncfusion’s Flutter app with many examples in this GitHub repo. Don’t miss our demo app in Google Play and the App Store.

If you aren’t a customer yet, you can try our 30-day free trial to check out these features.

Also, if you wish to send us feedback or would like to submit any questions, please feel free to post them in the comments section of this blog post. You can also contact us through our support forumfeedback portal, or Direct-Trac support system. We are always happy to assist you!

googleplay.png

Tags:

Share this post:

Popular Now

Be the first to get updates

Subscribe RSS feed

Be the first to get updates

Subscribe RSS feed