命令安装:npm install echarts --save

在index.html的<head></head>标签中引入echarts

  <script src="https://cdn.staticfile.org/echarts/4.3.0/echarts.min.js"></script>
  或者是在官网直接下载echarts.min.js文件在引入
 
在项目的入口文件man.js中
  import echarts from "echarts"
 
在需要用到的页面中创建实例
  
  <div ></div>
  
  var echarts = require('echarts');
 
    var myChart = echarts.init(document.getElementById('myChart'));
    // 指定图表的配置项和数据
    var option = {
      title: {
        text: '示例'
      },
      tooltip: {},
      legend: {
        data:['销量']
      },
      xAxis: {
        data: ["衬衫","羊毛衫","雪纺衫","裤子","高跟鞋","袜子"]
      },
      yAxis: {},
      series: [{
        name: '销量',
        type: 'bar',
        data: [5, 20, 36, 10, 10, 20]
      }]
    };
    // 使用刚指定的配置项和数据显示图表。
    myChart.setOption(option);

相关文章:

  • 2022-12-23
  • 2021-06-10
  • 2021-12-27
  • 2021-12-06
  • 2022-12-23
  • 2022-12-23
  • 2021-11-28
猜你喜欢
  • 2018-10-22
  • 2021-11-17
  • 2022-12-23
  • 2022-12-23
  • 2021-12-22
相关资源
相似解决方案