简体   繁体   English

Highcharts - 显示至少5条水平网格线,即使值不变

[英]Highcharts - show at least 5 horizontal grid lines, even when value doesn't change

I have a chart, in which I want to show only y grid lines. 我有一个图表,其中我只想显示y网格线。 Hovewer, when value is constant for some longer period of time (chart shows only last 5 ticks), all grid lines disappear. Hovewer,当值在一段较长时间内保持不变时(图表仅显示最后5个滴答),所有网格线都会消失。 Is it possible to always show multiple vertical grid lines, even when value is the same for all x's? 是否可以始终显示多个垂直网格线,即使所有x的值都相同?

How it looks right now: 它现在看起来如何: 它现在看起来如何

How I want to make it look like: 我怎么想让它看起来像: 应该是这样的

The easiest way to achieve what you seek would be to set a min and max for the yAxis , jsfiddle , like so: 实现你所寻求的最简单的方法是为yAxisjsfiddle设置minmax ,如下所示:

yAxis: {
    gridLineWidth: 2,
    min: 1,
    max: 5
}

A softMin and softMax could potentially make it look nicer. softMin和softMax可能使它看起来更好。 Highcharts API on softMin . softMin上的Highcharts API

You can use tickAmount to tell the amount of ticks that you want. 您可以使用tickAmount来告诉您想要的滴答数量。

Also you can create your own tick position logic, creating ticks whenever you want with tickPositioner . 您还可以创建自己的刻度位置逻辑,使用tickPositioner随时创建刻度线

And also you can tune some tick options to finally fit your likings with all the *tick* options Highcharts has: http://api.highcharts.com/highcharts/yAxis . 此外,您还可以调整一些刻度选项以最终满足您喜欢的所有*tick*选项Highcharts: http ://api.highcharts.com/highcharts/yAxis。 Just search for the tick word and look after yAxis... or read all the options one by one. 只需搜索tick字并查看yAxis...yAxis...阅读所有选项。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM