How to use box plot echarts for flutter
Hi Team,
I have implemented echart boxplot in flutter, i am stuck in providing data to the boxplot. there is no datatool in echarts configuration. If i provide set of array directly to data, only lines are drawing which is wrong.How to get instance of echarts to apply echarts.datatool.prepareboxplot for data.
Expected:
data : echarts.datatool.prepareBoxplotData([
[850, 740, 900, 1070, 930, 850, 950, 980, 980, 880, 1000, 980, 930, 650, 760, 810, 1000, 1000, 960, 960],
]);
Any help is really appreciated
The instance is named chart :
data: chart.datatool.prepareBoxplotData
That chart instance only not coming. how you will get chart instance and also datatool is not a property of chart in flutter. if you have any sample for boxplot in flutter please provide .
I get your point now. The JavaScript loading order is:
await _controller?.evaluateJavascript('''
$echartsScript
$extensionsStr
var chart = echarts.init(document.getElementById('chart'), $themeStr);
${this.widget.extraScript}
chart.setOption($_currentOption, true);
''');
So I think you can add your data preparation in extraScript and give it a name:
var myData = echarts.datatool.prepareBoxplotData([
[850, 740, 900, 1070, 930, 850, 950, 980, 980, 880, 1000, 980, 930, 650, 760, 810, 1000, 1000, 960, 960],
]);
and use it in option:
data: myData,
The disadvantage is that the data will not change when flutter widget state updates. You know echarts is a JavaScript object, we can't use it in flutter.