Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD

flutter_echarts

a flutter widget to use ech,arts in a reactive way.

bar
boxplot
echarts
funnel
gague
geo
graph
heatmap
kline
line
liquid
map
parallel
pie
radar
scatter
wordcloud
bar3d
line3d
sankey
scatter3d
surface3d
themeriver
overlap

features

reactive updating

the most exciting feature of flutter widgets and react components is that the view could update reactively to the change of data. thanks to ech,arts’ data driving architecture, flutter_echa,rts implemented a reactive way to connect chart with data. the chart will automatically re-render when the data in the option property changes.

two way communication

the onmessage and extrascript properties provide a way to set event communication both from flutter to javascript or in controversy.

configurable extensions

echar,ts has a lot of extensions . the extensions property allows you to inject the extension scripts as raw strings. in this way, you can copy these scripts to your source code, without concerning about the confusing assets dirs.

blog

developing blog

installing

add this to your package’s pubspec.yaml file:

dependencies:
  flutter_echarts: #latest version

now in your dart code, you can use:

import 'package:flutter_echarts/flutter_echarts.dart';  

details see pub.dev .

usage

the flutter_ech,arts itself is very simple to use, just like a common statelesswidget:

details about the option is in the echarts docs or echarts examples

container(
  child: echa,rts(
  option: '''
    {
      xaxis: {
        type: 'category',
        data: ['mon', 'tue', 'wed', 'thu', 'fri', 'sat', 'sun']
      },
      yaxis: {
        type: 'value'
      },
      series: [{
        data: [820, 932, 901, 934, 1290, 1330, 1320],
        type: 'line'
      }]
    }
  ''',
  ),
  width: 300,
  height: 250,
)

for an ios app, you need to add this entry to your info.plist’ <dic> tag:

<key>io.flutter.embedded_views_preview</key>
<string>yes</string>

a full example is here: flutter_echarts_example .

widget properties

option

string

the javascript ech,arts option for the chart as a string. the ech,arts is mainly configured by this property. you could use jsonencode() function in dart:convert to convert data in dart object form:

source: ${jsonencode(_data1)},

because javascript don’t have ''' , you can use this operator to reduce some escape operators for quotas:

echarts(
  option: '''
  
    // option string
    
  ''',
),

extrascript

string

the javascript which will execute after the echarts.init() and before any chart.setoption() . the widget has build a javascriptchennel named messager, so you could use this identifier to send message from javascript to flutter:

extrascript: '''
  chart.on('click', (params) => {
    if(params.componenttype === 'series') {
  	  messager.postmessage('anything');
    }
  });
''',

onmessage

void function(string)

function to handle the message sent by messager.postmessage() in extrascript .

extensions

list<string>

list of strings that coyied from ec,harts extensions, such as components, webgl, languages, etc. you can download them here . insert them as raw strings:

const liquidplugin = r'''

  // copy from liquid.min.js

''';

Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD

Top