我在 angularjs 應用程式中使用 highchart。我正在使用 Highcharts JS v7.2.1 (2019-10-31)。當我對 yaxis 使用“type:'logarithmic'”時,它會呈現錯誤的比例條。如果沒有那個“對數”,它將正確呈現,但我也需要顯示太小的值。請給我一些解決方案以正確比例呈現圖表
chart = new Highcharts.Chart({
chart: {
renderTo: 'container',
type: 'column'
},
title: {
text: 'Negative'
},
xAxis: {
categories: ['A','B','C','D','E','F','G','H'],
title: {
text: null
}
},
yAxis: {
type: 'logarithmic',
title: {
text: null,
}
},
legend: {
enabled: false
},
tooltip: {
formatter: function() {
return this.x ':' this.y ' millions';
}
},
plotOptions: {
column: {
stacking: 'normal',
dataLabels: {
enabled: true,
style: {
textShadow: false,
'textOutline': '0px',
'stroke-width': 0,
fontSize: '14px'
}
}
},
series: {
pointPadding: 0,
groupPadding: 0.1,
borderWidth: 0,
shadow: false,
}
},
credits: {
enabled: false
},
series: [{
"name": "Current Pillar Value",
"data": [
15216429,
842869,
773956,
16833254
],
"type": "column",
"color": "#0fb2fc",
"showInLegend": false
},
{
"name": "Previous Pillar Value",
"data": [
null,
15216429,
16059298,
null
],
"type": "column",
"color": "#d3c9c9",
"dataLabels": {
"enabled": false
},
"showInLegend": false
}],
});
<script src="http://code.highcharts.com/highcharts.js"></script>
<div id="container" style="height: 300px"></div>
uj5u.com熱心網友回復:
使用yAxis.tickInterval更改 yAxis 上的間隔。
在對數軸上,tickInterval 是基于冪的,因此 tickInterval 為 1 表示在 0.1、1、10、100 等每一個上都有一個刻度。tickInterval 為 2 表示在 0.1、10、1000 等上的刻度。tickInterval 為 0.2在 0.1、0.2、0.4、0.6、0.8、1、2、4、6、8、10、20、40 等上打勾。
https://api.highcharts.com/highcharts/yAxis.tickInterval
轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/520427.html
上一篇:將影像(從url)轉換為檔案
