本文介绍了除非有负数据,否则将highcharts y轴最小值设置为0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在使用JSON调用生成许多不同的图表时遇到了问题。

对于大多数这些图表,我需要将最小y轴值设置为0,但是有几次需要显示负值。如果数据中没有负值,我怎么才能告诉highcharts只有最小的y轴值为0,这甚至可能?



谢谢

解决方案

您可以添加到您的y轴:

  yAxis:{
title:{
text:'y轴的标题'
},
min:0 //设置y的最小值到0
},


I'm having an issue with highcharts where I have a number of different charts being generated by JSON calls.

For the majority of these charts I need the minimum y-axis value to be set at 0, however there are a couple of occasions where negative values need to be shown. How can I tell highcharts to have a minimum y-axis value of 0 only if there are no negative values in the data, is this even possible?

Thanks

解决方案

You can add to your y-axis :

 yAxis: {
            title: {
                text: 'Title of the y-axis'
            },
            min: 0 // this sets minimum values of y to 0
        },

这篇关于除非有负数据,否则将highcharts y轴最小值设置为0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-15 22:13