Highcharts教程

Highcharts 对数轴图表

以下是对数图表的示例。
我们已经在Highcharts 配置语法一章中看到了用于绘制图表的配置。现在,让我们讨论一个对数图的例子。

配置

将 yAxis.type 配置为"对数"。它定义了轴的类型。选项是"线性"、"对数"、"日期时间"或"类别"。这里,默认值是线性的。

y轴

var yAxis = {
   type: 'logarithmic',
   minorTickInterval: 0.1
};

示例

highcharts_line_logarithmic.htm
<html>
   <head>
      <title>Highcharts Tutorial</title>
      <script src = "https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js">
      </script>
      <script src = "https://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: 'Logarithmic axis demo'   
            };
            var xAxis = {
               tickInterval: 1
            };
            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>
昵称: 邮箱:
Copyright © 2022 立地货 All Rights Reserved.
备案号:京ICP备14037608号-4