[英]How to draw a line through Y axis 0 value
使用plotLines
繪制直線,將值設置為0:
plotLines: [{
color: '#000000',
width: 1,
value: 0
}],
這是一個演示:
$(function () { $('#container').highcharts({ chart: { type: 'column' }, title: { text: 'Column chart with negative values' }, xAxis: { categories: ['Apples', 'Oranges', 'Pears', 'Grapes', 'Bananas'] }, credits: { enabled: false }, series: [{ name: 'John', data: [5, 3, 4, 7, 2] }, { name: 'Jane', data: [2, -2, -3, 2, 1] }, { name: 'Joe', data: [3, 4, 4, -2, 5] }], yAxis:{ gridLineWidth: 0, plotLines: [{ color: '#000000', width: 1, value: 0 }], labels: { enabled: false } } }); });
rect { stroke-width:0; }
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <script src="https://code.highcharts.com/highcharts.js"></script> <script src="https://code.highcharts.com/modules/exporting.js"></script> <div id="container" style="min-width: 310px; height: 400px; margin: 0 auto"></div>
PS:此條形圖的代碼不是我的,我從Highcharts的網站上復制了它: http ://www.highcharts.com/demo/column-negative
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.