修复Highcharts库存中的x轴(停止自动缩放) [英] Fixed x-axis in Highcharts Stock (stop auto-scaling)

查看:113
本文介绍了修复Highcharts库存中的x轴(停止自动缩放)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在图表开始绘制主要系列(LTP)时,它会绘制整个宽度。





有没有办法像绘制底部的选择器图表一样绘制它?

编辑:我想要整个xAxis可见,然后添加点自动缩放xAxis。



查看我的代码

http://jsfiddle.net/S9SwB/9/

解决方案

在这里建立@ wergeld的解决方案,就像你在他的解决方案中看到的那样,x轴的终点在5点30分正确定位,但是时间有了突然的飞跃,这是因为轴的序号属性被设置默认情况下为true,这意味着所有点在像素方面是等距的,在时间上的差异是无关紧要的,所以轴在右边留下足够的空间,只有1个点,因此需要添加一个点所需的像素数。在将序号设置为假时,它会根据时差分配尽可能多的空间。
总而言之,这里是你的解决方案:) http://jsfiddle.net/jugal/UP5sW/

  var min = new Date()。getTime(); 
var max = min + 50 * 500;
// ...

xAxis:{
ordinal:false,
max:max
},
series:[
{
名称:'系列0',
数据:[[min,0]]
},
{
名称:'结束',
data:[[max,0]]
}]

更多关于序号选项@ http://www.highcharts.com/stock/ref/#xAxis--序号& http://jsfiddle.net/gh/get/jquery/1.7.1/highslide-software/highcharts.com/tree/master/samples/stock/xaxis/ordinal-false/


In the chart when it start drawing main series (LTP), It draws on whole width.

Is there a way to draw it just like the selector chart at bottom?

EDIT : I want entire xAxis viewable and then add the points without auto-scaling the xAxis.

Have a look at my code

http://jsfiddle.net/S9SwB/9/

解决方案

Build up on @wergeld's solution here, as you see in his solution, the end of x-axis was position correctly at 5:30 but there was a suddent leap in time, this is because the ordinal property of the axis is set to true by default, which means all points are equally spaced in terms of pixels, immaterial of difference in terms of time, so the axis leaves enough room at right for just 1 point, and hence number of pixels required to add one point. On setting ordinal to false, it will allocate as much space as is needed based on time difference. All in all, here goes your solution :) http://jsfiddle.net/jugal/UP5sW/

var min = new Date().getTime();
var max = min + 50 * 500;  
//...

xAxis: {
        ordinal: false,
        max:max
    },
    series: [
        {
        name: 'Series 0',
        data: [[min, 0]]
    },
    {
        name: 'End',
        data: [[max, 0]]
    }]

More about ordinal option @ http://www.highcharts.com/stock/ref/#xAxis--ordinal & http://jsfiddle.net/gh/get/jquery/1.7.1/highslide-software/highcharts.com/tree/master/samples/stock/xaxis/ordinal-false/

这篇关于修复Highcharts库存中的x轴(停止自动缩放)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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