Highcharts用chart.renderer.path绘制一条线 [英] Highcharts Drawing a line with chart.renderer.path

查看:413
本文介绍了Highcharts用chart.renderer.path绘制一条线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在看这个公式:

  http://www.w3.org/TR/SVG/paths .html#PathDataMovetoCommands 

以下是我如何绘制它:



$ p $ chart.renderer.path(['M',someNumber,10,'V',1500,0])
.attr({
'stroke-width':2,
stroke:'red',
id:'vert'
})
.add();

线条被绘制出来,但它贯穿整个图形。我希望它很小。我认为为了让它变小,我需要改变'10',但是无论我放置什么值(甚至是10.000),线的长度都保持不变。 解决方案

在路径属性中:

  path(['M',someNumber,10,'V', 'M'表示moveto,someNumber,10表示x, y坐标移动到(不绘制只是将笔移动到您想要开始线的位置)。 'V'表示绘制垂直线,1500是停止绘制它的y位置。我不相信你需要0(V属性只有一个参数)。



如果你希望线的长度更小,调整1500参数。 / p>

I'm looking at this formula:

http://www.w3.org/TR/SVG/paths.html#PathDataMovetoCommands

And here is how I draw it:

chart.renderer.path(['M', someNumber, 10, 'V', 1500, 0])
                .attr({
                    'stroke-width': 2,
                    stroke: 'red',
                    id: 'vert'
                })
                .add();

And the line is drawn but it goes through the whole graph. I want it to be small. I think that to make it smaller i need to change the '10' but whatever value I put (even 10.000) the line's length remains the same.

解决方案

In the path attribute:

path(['M', someNumber, 10, 'V', 1500, 0])

The 'M' means moveto, "someNumber", 10 are the x, y coordinates you are moving to (this does not draw just moves the "pen" to where you want to start the line). The 'V' means draw a vertical line, the 1500 is the y position to stop drawing it. I do not believe you need the 0 (the V attribute only takes one parameter).

If you want the length of the line to be smaller adjust the 1500 parameter.

这篇关于Highcharts用chart.renderer.path绘制一条线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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