Highcharts 带空值(null)和0的3D柱形图

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/chengqiuming/article/details/85331756

一 代码

<html>
<head>
<meta charset="UTF-8" />
<title>Highcharts 带空值(null)和0的3D柱形图</title>
<script src="http://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
<script src="http://code.highcharts.com/highcharts.js"></script>
<script src="http://code.highcharts.com/highcharts-3d.js"></script>
</head>
<body>
<div id="container" style="width: 550px; height: 400px; margin: 0 auto"></div>
<script language="JavaScript">
$(document).ready(function() {
   var chart = {
      //3D 矩形图
      type: 'column',
      margin: 75,
      options3d: {
         enabled: true,
         alpha: 10,
         beta: 25,
         depth: 70
      }
   };
   // 标题
   var title = {
      text: '带空值的 3D 图'
   };
   // 子标题
   var subtitle = {
      text: '注意 0 和 null 的区别'
   };
   // X 轴
   var xAxis = {
      categories: Highcharts.getOptions().lang.shortMonths
   };
   // Y 轴
   var yAxis = {
      title: {
         text: null
      }
   };
   // 数据
   var series= [{
      name: 'Sales',
      data: [2, 3, null, 4, 0, 5, 1, 4, 6, 3]
   }];

   var json = {};
   json.chart = chart;
   json.title = title;
   json.subtitle = subtitle;
   json.xAxis = xAxis;
   json.yAxis = yAxis;
   json.series = series;
   $('#container').highcharts(json);
});
</script>
</body>
</html>

二 运行结果

猜你喜欢

转载自blog.csdn.net/chengqiuming/article/details/85331756