簡體   English   中英

HighCharts從圖表底部移動X軸

[英]HighCharts Moving X Axis From bottom of Chart

我在高圖上有一個帶有正負值的柱形圖。 我需要xAxis行顯示值為0。但是,我無法在HighCharts API中找到屬性來為我完成此操作。 默認情況下,xAxis線顯示在圖表的底部或最大負值。

在這里查看我的示例: http : //jsfiddle.net/csallemi/HStha/15/ 在此示例中,x軸為-2%。 我需要將其顯示為0%的值。

這是我的Javascript HighChart對象,它獲取必要的列圖

var YTD = 'YTD'
var yr1 = 'Year 1'
var yr3 = '*3 Year'
var yr5 = '*5 Year'
var sinceIN = '* Since Inception (5/31/2012)'

$(function () {
var chart;
$(document).ready(function() {
chart = new Highcharts.Chart({
   chart: {renderTo: 'container', type: 'column'},
   title: {text: 'Report Title', style: {fontSize: '18px', color: '#1D5293', fontWeight: 'bold'}, },
   subtitle: {text: '(As of 6/30/2012)', style: {fontSize: '18px', color: '#1D5293'}, y: 40},
   xAxis: {categories: [YTD, yr1, yr3, yr5, sinceIN], lineColor: '#C1BADB', tickWidth: 2},
   yAxis: {title: {text: ''},
           lineColor: '#C1BADB',
           lineWidth: 1,
           labels: {formatter: function() {return this.value+'%';}},
           gridLineWidth: '0px',
           tickWidth: 2            

          },
   tooltip: {enabled: true, formatter: function() {return this.series.name +': '+ this.y +'%';},},
  credits: { enabled: false },
  series: [
      {name: 'XXX Company Ltd. (Net)', data: [3.02, -0.61, 2.03, 1.51, 5.35], dataLabels: {enabled: true, color: '#333', formatter: function(){return this.y+'%'}}, color: '#1D5293'},
      {name: 'XXX Relative Return Index (Gross)**', data: [2.45, 0.85, 4.11, 0.73, 3.56], dataLabels: {enabled: true, color: '#333', formatter: function(){return this.y+'%'}}, color: '#9E9E9E'}
      ],
   legend: {layout: 'vertical', align: 'top', verticalAlign: 'top', x: 50, y: 65, borderWidth: 0, margin: 30},
  });
});

});

yAxis:{
    min: 0
},

我已經更新了您的小提琴http://jsfiddle.net/HStha/25/

希望這是有用的

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM