Howto将Highstock(Highcharts)'addPoint'函数与标志组合在一起 [英] Howto combine Highstock (Highcharts) 'addPoint' function with flags

查看:896
本文介绍了Howto将Highstock(Highcharts)'addPoint'函数与标志组合在一起的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用Highstock(Highcharts)库,
我想知道,如何结合 A)添加标志,如

  chart.series [0] .addPoint([ Date.UTC(2012,1,5),2],false); 

chart.series [1] .addPoint({
x:Date.UTC(2012,1,3),
标题:'On series'
},真正);


Using the Highstock (Highcharts) library, I'm wondering, how do I combine A) adding flags as in here (or see fig.1) with B) dynamically updating data, using the addPoint function (ex: series.addPoint([x, y], true, true) see here). There doesn't seem to be a facility for it in the addPoint function.

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 have taken a look at this SO question. But is seems to add a flag on an existing dataset. Can I add a data point, and an associated flag at the same time?

Any help's appreciated.

Thanks

=== EDIT ===>

@Sebastian-Bochan

Thanks for responding, and for the working example. However, for some reason, addPoint is not working for my setup.

So take a look at this jsfiddle. What I do is i) setup an initial graph with a call to (chart-fill …), then ii) call (chart-increment …) which adds 1 point, then immediately tries to add 1 flag on that point. The part that isn't working is (-> ($ selector) (.highcharts) (.-series) (nth 9) (.addPoint { :x 1234567 :title "fubar"} true false)). This isn't adding the flag as I'd expect.

I have 11 Series overlaid on top of 5 graphs. This includes one series of type "flag". I thought, maybe with so many Series, there was a problem referencing one of them. But if I look into my series, I can see that the flag is indeed the 9th one.

I'm also using Clojurescript code. But I don't think that's an issue, as the graph otherwise renders properly. Any ideas?

解决方案

Please take look at 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);

这篇关于Howto将Highstock(Highcharts)'addPoint'函数与标志组合在一起的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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