Highcharts:确保y轴0值在图表底部 [英] Highcharts: Ensure y-Axis 0 value is at chart bottom

查看:1115
本文介绍了Highcharts:确保y轴0值在图表底部的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在页面上输出一系列highcharts。在某些情况下,指定时间段内的所有数据可能会返回0值。

在这种情况下,图表如下所示: http://jsfiddle.net/charliegriefer/KM2Jx/1/



有只有1个y轴标签,0,它在图表中间。



我想强制y轴的0值为图表的底部,它与页面上其他有数据的图表一致。

已经尝试了各种yAxis属性,例如min:0, minPadding:0,maxPadding:0,startOnTick:true。

看起来应该很简单,但我很茫然: / p>

相关yAxis代码:

  yAxis:{
min :0,
minPadding:0,
startOnTick:true,
title:{
text:
}
},


解决方案

只有这样才能让它正确地显示它是通过提供yAxis max 值。我认为这是一个HighCharts问题,当你没有提供一个y值的数据元素。它绘制出它认为最好的图表。


I'm outputting a series of highcharts on a page. In some instances, all data for the specified time period may come back with 0 values.

In such a case, the chart looks like this: http://jsfiddle.net/charliegriefer/KM2Jx/1/

There is only 1 y-Axis label, 0, and it's in the middle of the chart.

I'd like to force that 0 value for the y-Axis to be at the bottom of the chart, which would be consistent with other charts on the page that do have data.

Have tried various yAxis properties, such as "min: 0", "minPadding: 0", "maxPadding: 0", "startOnTick: true".

Seems it should be pretty straightforward, but I'm at a loss :(

Relevant yAxis code:

yAxis: {
    min: 0, 
    minPadding: 0, 
    startOnTick: true, 
    title: {
        text: ""
    }
},

解决方案

Only way I could get it to show it "correctly" was by also providing an yAxis max value. I think this is a HighCharts issue when you provide no data elements with a y-value. It draws the best chart it thinks it can.

这篇关于Highcharts:确保y轴0值在图表底部的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆