Highstocks - 在“之间使用tickmarkPlacement” on datetime Axis(无类别) [英] Highstocks - Use tickmarkPlacement "between" on datetime Axis (no categories)

查看:435
本文介绍了Highstocks - 在“之间使用tickmarkPlacement” on datetime Axis(无类别)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有任何解决方法将tickMarkPlacement设置为日期时间轴上的之间?我知道不支持API ,但我希望找到某种黑客攻击/插件。

解决方案

你可以用x轴标签 x 财产。



示例:



[[更新后评论:

]

如果您的意思是您希望数据点也在'之间'排列,那么不存在'b
$ b

我的方法是:1)确保只有一个数据理想的是

<2>调整数据点的x值,使其按照与标签偏移相对应的方式向右推动



<3>调整工具提示格式化程序以更正显示日期



或者, 4)只要去分类



然而,如果你能解释你为什么要这样做,你会做什么样的影响,也许还有更多的事情可以做。

{更进一步更新:



找到了另一种方法来模拟数据点的位置,但我不清楚你是否需要这样做。



这里的例子:



它使用 pointPlacement 属性。
问题在于,如果没有列系列与行系列一样多的数据点出现,那么pointPlacement属性不起作用,看起来好像是这样。



因此,此方法添加并隐藏了虚拟列系列,以便使 pointPlacement 属性影响系列。



不够优雅,但它不得不调整数据值,然后在格式化程序中重新调整它们。


Is there any workaround to have tickMarkPlacement set as "between" on a datetime Axis? I am aware is not supported by the API but I was hoping to find some sort of hack/plugin.

解决方案

You can fudge it with the x axis label's x property.

Example:

[[update after comments:

if you mean that you want the data points to also line up 'between', then there isn't a good easy way.

My approach would be

1) make sure there is only one data point per axis tick, ideally

2) adjust the x value of the data point to push it to the right in a way that corresponds with the label offset

3) adjust tooltip formatters to correct the date for display

or, 4) just go with categories

However, if you can explain why you want to do this, what effect you're going for, perhaps there's more that can be done.

{{further updates:

After playing around a little more, I found another way to fudge the data point placement, though I am unclear whether you need that.

Example here:

It uses the pointPlacement property. The catch is that the pointPlacement property doesn't work if there is not a columns series present with as many data points as the line series, it seems.

So this method adds and hidden dummy column series in order to make the pointPlacement property affect the line series.

Not elegant, but it beats having to adjust the data values and then re-adjust them in the formatter.

这篇关于Highstocks - 在“之间使用tickmarkPlacement” on datetime Axis(无类别)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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