Highcharts对数图表

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

一 代码

<html>
<head>
<meta charset="UTF-8" />
<title>Highcharts 对数图表</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>
</head>
<body>
<div id="container" style="width: 550px; height: 400px; margin: 0 auto"></div>
<script language="JavaScript">
$(document).ready(function() {
   var title = {
      text: '对数实例'
   };
   var xAxis = {
      tickInterval: 1
   };
   //配置 yAxis.type 为 'logarithmic'。它定义了 x 轴类型。
   //可选值有 "linear", "logarithmic", "datetime" 或 "category"。默认值为linear。
   var yAxis = {
      type: 'logarithmic',
      minorTickInterval: 0.1
   };
   var tooltip = {
      headerFormat: '<b>{series.name}</b><br>',
      pointFormat: 'x = {point.x}, y = {point.y}'
   };
   var plotOptions = {
      spline: {
         marker: {
            enabled: true
         }
      }
   };
   var series= [{
         name: 'data',
         data: [1, 2, 4, 8, 16, 32, 64, 128, 256, 512],
         pointStart: 1
      }
   ];

   var json = {};
   json.title = title;
   json.tooltip = tooltip;
   json.xAxis = xAxis;
   json.yAxis = yAxis;
   json.series = series;
   json.plotOptions = plotOptions;
   $('#container').highcharts(json);

});
</script>
</body>
</html>

二 运行结果

猜你喜欢

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