[英]Can I animate plotbands and put more than one label to each plotband using the Highstock API?
I am using the highstock API, and I want to draw some plotBands on a chart. 我正在使用highstock API,我想在图表上绘制一些plotBands。 I would like to know if there is any way to animate the plotband while it is being drawed, like CSS transitions applied to html elements when their width change.
我想知道在绘制绘图区时是否有任何动画方法,例如当宽度改变时应用于html元素的CSS过渡。 I also want to know if I can assign more than one label to one plotband.
我也想知道是否可以为一个绘图区分配多个标签。 I have seen a lot of examples in jsfiddle where a plotband has only one label, but I would like to put two labels for each plotband in order to show its start point and its end point.
我在jsfiddle中看到了很多示例,其中一个绘图区只有一个标签,但是我想为每个绘图区放置两个标签,以显示其起点和终点。
Thanks in advance. 提前致谢。
You can use the Renderer.rect and trigger animate() function on rendered object, instead of using plotbands. 您可以在渲染的对象上使用Renderer.rect并触发animate()函数,而不是使用图带。 As a result new shape is animated.
结果,新的形状被动画化了。
var yAxis = chart.yAxis[0],
xAxis = chart.xAxis[0],
start = 1,
end = 2,
x1 = xAxis.toPixels(start),
x2 = xAxis.toPixels(end);
var plotBand = chart.renderer.rect(x1, chart.plotTop, 0, chart.plotHeight)
.attr({
fill: 'yellow',
zIndex: 0
})
.add();
plotBand.animate({
width: x2 - x1
});
Example: 例:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.