Echarts Notes0:安装使用

Echarts Notes0:安装使用

notion image

安装

npm install echarts --save

使用

<div id="echartdemo"></div> import * as echarts from 'echarts'; const initechartsdemo = () => { var chartDom = document.getElementById('echartdemo') as HTMLElement;; var myChart = echarts.init(chartDom, 'dark'); var option; option = { title: [ { text: 'Tangential Polar Bar' } ], polar: { radius: [30, '80%'] }, angleAxis: { max: 4, startAngle: 75 }, radiusAxis: { type: 'category', data: ['a', 'b', 'c', 'd'] }, tooltip: {}, series: { type: 'bar', data: [2, 1.2, 2.4, 3.6], coordinateSystem: 'polar', label: { show: true, position: 'middle', formatter: '{b}: {c}' } } }; option && myChart.setOption(option); }