Highcharts填充区域点间隔问题 [英] Highcharts fill area point interval issue

查看:161
本文介绍了Highcharts填充区域点间隔问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我用'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屋!

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