How to combine Highstock (Highcharts) addPoint function with flags

Using the Highstock library (Highcharts) I am wondering how can I add A) adding flags, as in here (or see Fig. 1 ) with dynamically updating B> data, using the addPoint function (for example: series.addPoint([x, y], true, true) see here ). The addPoint function does not exist for it.

  series: [{
                 name: 'USD to EUR',
                 data: data,
                 id: 'dataseries'
             },
             {
                 type: 'flags',
                 data: [{
                     x: Date.UTC (2011, 3, 25),
                     title: 'H',
                     text: 'Euro Contained by Channel Resistance'
                 }],
                 onSeries: 'dataseries',
                 shape: 'circlepin',
                 width: 16
             }]

fig.1

I reviewed this SO question . But it seems to add a flag to an existing dataset. Can I add a data point and associated flag at the same time?

Any help appreciated.

thanks

=== EDIT ===>

@ Sebastian-Bochan

Thanks for the answer and for the working example. However, for some reason addPoint does not work for my setup.

So take a look at this jsfiddle . What I'm doing is i) set the initial chart with a call (chart-fill …) , then ii) call (chart-increment …) , which will add 1 point, and then try to add 1 flag to this point. The part that does not work is (-> ($ selector) (.highcharts) (.-series) (nth 9) (.addPoint { :x 1234567 :title "fubar"} true false)) . This does not add the flag as I expected.

I have 11 rows superimposed over 5 graphs. This includes one flag series. I thought maybe with so many Series there was a problem with one of them. But if I look in my series, I see that the flag is indeed the ninth.

I also use Clojurescript code. But I do not think that the problem is because the schedule otherwise does the right thing. Any ideas?

enter image description here

0
source share
1 answer

Please see an example: http://jsfiddle.net/pGpU7/2/

  chart.series[0].addPoint([Date.UTC(2012, 1, 5),2],false); chart.series[1].addPoint({ x: Date.UTC(2012, 1, 3), title: 'On series' },true); 
0
source

Source: https://habr.com/ru/post/1487089/


All Articles