SOURCE

console 命令行工具 X clear

                    
>
console
<!DOCTYPE html>
<html>
  <head>
      <meta charset="utf-8" />
          <title>ECharts</title>
              <script src="echarts.js"></script>
                </head>
                  <body>
                      <div id="main" style="width: 600px;height:400px;"></div>
                          <script type="text/javascript">
                                var myChart = echarts.init(document.getElementById('main'));

                                      var option = {
                                              title: {
                                                        text: '哈尔滨亚冬会各国家金牌获得数'
                                                                },
                                                                  xAxis: {
                                                                      type: 'category',
                                                                          data: ['中国', '韩国', '日本', '哈萨克斯坦', '菲律宾', '乌兹别克斯坦', '朝鲜', '中国台北', '泰国']
                                                                            },
                                                                              yAxis: {
                                                                                  type: 'value'
                                                                                    },
                                                                                      series: [
                                                                                          {
                                                                                                data: [53, 27, 14, 5, 1, 1, 1, 1, 1],
                                                                                                      type: 'line'
                                                                                                          }
                                                                                                            ]
                                                                                                            };

                                                                                                                  var option = {
                                                                                                                          title: {
                                                                                                                                    text: '哈尔滨亚冬会各国家金牌获得数'
                                                                                                                                            },
                                                                                                                                                    tooltip: {},
                                                                                                                                                            legend: {
                                                                                                                                                                      data: ['国家']
                                                                                                                                                                              },
                                                                                                                                                                                      xAxis: {
                                                                                                                                                                                                data: ['中国', '韩国', '日本', '哈萨克斯坦', '菲律宾', '乌兹别克斯坦', '朝鲜', '中国台北', '泰国']
                                                                                                                                                                                                        },
                                                                                                                                                                                                                yAxis: {},
                                                                                                                                                                                                                        series: [
                                                                                                                                                                                                                                  {
                                                                                                                                                                                                                                              name: '数量',
                                                                                                                                                                                                                                                          type: 'bar',
                                                                                                                                                                                                                                                                      data: [53, 27, 14, 5, 1, 1, 1, 1, 1]
                                                                                                                                                                                                                                                                                }
                                                                                                                                                                                                                                                                                        ]
                                                                                                                                                                                                                                                                                              };

                                                                                                                                                                                                                                                                                                      var option = {
                                                                                                                                                                                                                                                                                                        title: {
                                                                                                                                                                                                                                                                                                            text: '哈尔滨亚冬会中国奖牌获得数',
                                                                                                                                                                                                                                                                                                                subtext: 'Living Expenses in Shenzhen'
                                                                                                                                                                                                                                                                                                                  },
                                                                                                                                                                                                                                                                                                                    tooltip: {
                                                                                                                                                                                                                                                                                                                        trigger: 'axis',
                                                                                                                                                                                                                                                                                                                            axisPointer: {
                                                                                                                                                                                                                                                                                                                                  type: 'shadow'
                                                                                                                                                                                                                                                                                                                                      },
                                                                                                                                                                                                                                                                                                                                          formatter: function (params) {
                                                                                                                                                                                                                                                                                                                                                var tar = params[1];
                                                                                                                                                                                                                                                                                                                                                      return tar.name + '<br/>' + tar.seriesName + ' : ' + tar.value;
                                                                                                                                                                                                                                                                                                                                                          }
                                                                                                                                                                                                                                                                                                                                                            },
                                                                                                                                                                                                                                                                                                                                                              xAxis: {
                                                                                                                                                                                                                                                                                                                                                                  type: 'category',
                                                                                                                                                                                                                                                                                                                                                                      splitLine: { show: false },
                                                                                                                                                                                                                                                                                                                                                                          data: ['金牌', '银牌', '铜牌']
                                                                                                                                                                                                                                                                                                                                                                            },
                                                                                                                                                                                                                                                                                                                                                                              yAxis: {
                                                                                                                                                                                                                                                                                                                                                                                  type: 'value'
                                                                                                                                                                                                                                                                                                                                                                                    },
                                                                                                                                                                                                                                                                                                                                                                                      series: [
                                                                                                                                                                                                                                                                                                                                                                                          {
                                                                                                                                                                                                                                                                                                                                                                                                name: 'Placeholder',
                                                                                                                                                                                                                                                                                                                                                                                                      type: 'bar',
                                                                                                                                                                                                                                                                                                                                                                                                            stack: 'Total',
                                                                                                                                                                                                                                                                                                                                                                                                                  itemStyle: {
                                                                                                                                                                                                                                                                                                                                                                                                                          borderColor: 'transparent',
                                                                                                                                                                                                                                                                                                                                                                                                                                  color: 'transparent'
                                                                                                                                                                                                                                                                                                                                                                                                                                        },
                                                                                                                                                                                                                                                                                                                                                                                                                                              emphasis: {
                                                                                                                                                                                                                                                                                                                                                                                                                                                      itemStyle: {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                borderColor: 'transparent',
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          color: 'transparent'
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  }
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        },
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              data: [0, 27, 26]
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  },
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            name: 'Life Cost',
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  type: 'bar',
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        stack: 'Total',
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              label: {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      show: true,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              position: 'inside'
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    },
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          data: [32, 5, 1]
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              }
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                ]
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                };

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      myChart.setOption(option);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          </script>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            </body>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            </html>