nandv
Posts: 12
Joined: Sat Sep 11, 2021 5:01 am

how to put marker in the 'second series' area via annotation?

If I have a chart with two series of data, 1st taking 70% and the 2nd 30% (a typical OHLC and volume at the bottom), how can I put annotation markers in the 'second series' area?

I tried a list of two tuples with 1st empty, as

Code: Select all

	annotations: [{},{
	    shapes: getanlist(),
	    backgroundColor: 'yellow',
	    draggable: ''
	}],
but no luck.

The getanlist() returns a set of points as

Code: Select all

{ point: { xAxis: 0, yAxis: 0, x:1599579000000, y:-40}, type: 'circle', r:2 },
{ point: { xAxis: 0, yAxis: 0, x:1599584100000, y:-40}, type: 'circle', r:2 },
{ point: { xAxis: 0, yAxis: 0, x:1599589500000, y:-40}, type: 'circle', r:2 },...
nandv
Posts: 12
Joined: Sat Sep 11, 2021 5:01 am

Re: how to put marker in the 'second series' area via annotation?

Well, I looked at answers to my previous post asking about the same general question of annotating large amount of markers.
and modify the render code
viewtopic.php?f=12&t=50103&p=182913#p182901
by dawid.d

Thanks again, this should be closed!

the modification is to add one more property to customannotation: yaxis, and assign the proper yAxis in the render code as

Code: Select all

	
	chart.customAnnotations.forEach(annotation => {
			    const yAxis = chart.yAxis[annotation.yaxis];

			    const pixelX = xAxis.toPixels(annotation.x),
				  pixelY = yAxis.toPixels(annotation.y);

			    annotation.shape.attr({
				x: pixelX,
				y: pixelY
			    })
jakub.j
Posts: 1091
Joined: Tue Jan 24, 2023 11:14 am

Re: how to put marker in the 'second series' area via annotation?

Hello nandv, thanks for contacting us!

Nice to hear that you managed to solve the issue.

Do not hesitate to contact us in the future!
Best regards
Jakub

Return to “Highcharts Stock”