How can I extend highcharts renderer symbols library to include a "Plus" sign.
相关问题
- Is there a limit to how many levels you can nest i
- How to toggle on Order in ReactJS
- void before promise syntax
- Keeping track of variable instances
- Can php detect if javascript is on or not?
The accepted answer only gives a single line per cross. I wanted a fully filled in plus sign. Here is the code to instead do that:
This will produce a plus at 25% width for each bar.
API Reference of plotOptions.series.marker.symbol
Like in the last paragraph above, we would define the symbol path for creating a plus. Here is what the documentaion says about Renderer.path
And this is how the co-ordinate system would look like, the actual point at the centre of a w x h box with its top-left corner placed at (x,y) & y increasing as we move downwards and x increasing as we move towards the right.
Here is how you would do a plus
To explain the array in words
'M', x, y + h / 2
: We move our pen to pt. A (x,y+h/2)'L', x + w, y + h / 2:
We draw a line from the current position to pt. B (x+w,y+h/2). This draws the horizontal line of the plus from A <-> B'M', x + w / 2, y:
We now move the pen to pt. C (x+w/2,y), notice that moving the pen does not create any graphic or line'L', x + w / 2, y + h:
We now draw a line from current position to pt. D(x+w/2,y+h). This draws the vertical line of the plus C <-> D'z':
We close the renderer/penCustom Marker Symbol @jsFiddle