echarts example

by sfshu

HTML

<script src="//cdn.bootcss.com/echarts/3.2.2/echarts.min.js"></script>
<div id="main" style="width: 600px;height:400px;"></div>

JavaScript

var myChart = echarts.init(document.getElementById('main'));

        var option = {
          title: {
            text: 'bar chart'
          },
          tooltip: {
            trigger: 'axis',
            axisPointer: {
              type: 'shadow'
            }
          },
          legend: {
            data: ['Sales', 'Cost', 'Net Sale']
          },
          xAxis: {
            data: ["P1", "P2", "P3", "P3", "P4", "P5"]
          },
          yAxis: {},
          series: [{
              name: 'Sales',
              type: 'bar',
              data: [100, 20, 36, 10, 10, 20]
            },
            {
              name: 'Cost',
              type: 'bar',
              data: [60, 12, 21, 6, 6, 12]
            },
            {
              name: 'Net Sale',
              type: 'line',
              data: [40, 8, 15, 4, 4, 8]
            }
          ]

        };

        // set
        myChart.setOption(option);