Highcharts 對(duì)數(shù)圖表
以下實(shí)例演示了對(duì)數(shù)圖表。
我們?cè)谇懊娴恼鹿?jié)已經(jīng)了解了 Highcharts 配置語(yǔ)法。接下來(lái)讓我們來(lái)看下如何配置。
配置
配置 yAxis.type 為 'logarithmic'。它定義了 x 軸類型??蛇x值有 "linear", "logarithmic", "datetime" 或 "category"。默認(rèn)值為linear。
yAxis var yAxis = { type: 'logarithmic', minorTickInterval: 0.1 };
實(shí)例
文件名:highcharts_line_logarithmic.htm
<html> <head> <meta charset="UTF-8" /> <title>Highcharts 教程 | W3Cschool教程(w3cschool.cn)</title> <script src="http://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js" rel="external nofollow" ></script> <script src="http://code.highcharts.com/highcharts.js" rel="external nofollow" ></script> </head> <body> <div id="container" style="width: 550px; height: 400px; margin: 0 auto"></div> <script language="JavaScript"> $(document).ready(function() { var title = { text: '對(duì)數(shù)實(shí)例(w3cschool.cn)' }; 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>
以上實(shí)例輸出結(jié)果為:
更多建議: