Highcharts - best way to handle and display zero (or negative) values in a line chart series with logarithmic Y axis

前端 未结 2 1606
执念已碎
执念已碎 2020-12-19 07:39

In my HighChart line graphs, the series data is being fed from my Ruby on Rails application dynamically. Sometimes the series values are zeros or less which is a problem fo

2条回答
  •  离开以前
    2020-12-19 08:44

    Have you tried using a label formatter?

    var chart = new Highcharts.Chart({ 
        yAxis: {        
            labels: {
                formatter: function() {
                    if(this.value === 0.00001){
                        return 0;
                    } else {
                        return this.value;
                    }
                }
            }
        }
    });
    

提交回复
热议问题