0

我在高图表中有一个柱形图,有正值和负值。我需要 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},
  });
});

});
4

1 回答 1

0

yAxis:{
    min: 0
},

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

希望这是有用的

于 2013-04-26T12:00:52.863 回答