universal_echarts 1.0.0+4 universal_echarts: ^1.0.0+4 copied to clipboard
A null-safe package that display beautiful charts on both Web and Mobile through Echarts SDK.
import 'package:flutter/material.dart';
import 'package:universal_echarts/universal_echarts.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
visualDensity: VisualDensity.adaptivePlatformDensity,
),
home: MyHomePage(title: 'Flutter Web Demo'),
);
}
}
class MyHomePage extends StatelessWidget {
final String? title;
MyHomePage({this.title});
final option = '''
{
title: {
text: 'ECharts entry example'
},
tooltip: {},
legend: {
data:['Sales']
},
xAxis: {
data: ["shirt","cardign","chiffon shirt","pants","heels","socks"]
},
yAxis: {},
series: [{
name: 'Sales',
type: 'bar',
data: [5, 20, 36, 10, 10, 20]
}]
}
''';
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(title ?? ''),
),
body: UniversalEcharts.drawChart(option));
}
}