Highcharts填充区域点间隔问题 [英] Highcharts fill area point interval issue
问题描述
当我用'spline'绘制图形时,y轴间隔是可重新调整的,所以图形看起来很好。
图表:{
type:'区域'
}
如何解决没有设置标签的' min '和' tickInterval '
我需要这个,因为如果我设置标签属性,一个方法可以实现这一点,就是通过使用以下函数触发事件
。
code> load : 图表:{
type:'area' ,
events:{
load:function(){
let chart = this;
let tmpMaxMin = chart.yAxis [0] .getExtremes();
chart.yAxis [0] .setExtremes(tmpMaxMin ['dataMin'],tmpMaxMin ['dataMax']);
}
}
},
工作示例: http://jsfiddle.net/ewolden/La13rjwf/
API上的events.load : https://api.highcharts.com/highcharts/chart.events.load
API on getExtremes : https://api.highcharts.com/class-reference/Highcharts.Series #getExtremes
回答基于: https:// stackoverflow .com / a / 35870891/8376046
When I just draw the graph with 'spline', the yaxis interval is resaonable so the graph look's good. The code is as follows:
chart: {
type: 'spline'
}
But, when I change the type to 'area', the interval is changed too. Therefore, the graph look's bad.
chart: {
type: 'area'
}
How can I fix it without setting label's 'min' and 'tickInterval'
I need this becuase if I set the label property, there would be followed bunch of works.
One way you can achieve this, is by using the following function that triggers on the event load
:
chart: {
type: 'area',
events: {
load: function() {
let chart = this;
let tmpMaxMin = chart.yAxis[0].getExtremes();
chart.yAxis[0].setExtremes(tmpMaxMin['dataMin'], tmpMaxMin['dataMax']);
}
}
},
Working example: http://jsfiddle.net/ewolden/La13rjwf/
API on events.load: https://api.highcharts.com/highcharts/chart.events.load
API on getExtremes: https://api.highcharts.com/class-reference/Highcharts.Series#getExtremes
Answer based on: https://stackoverflow.com/a/35870891/8376046
这篇关于Highcharts填充区域点间隔问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!