如何在Highcharts / Highstock中获得系列的id [英] How to get series's id in Highcharts / Highstock
本文介绍了如何在Highcharts / Highstock中获得系列的id的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何获取系列的ID?在 API 中,只有名称和数据等,但没有ID。我怎么能从系列中获得id?
我使用以下方式循环图表中的所有系列。
< pre $
$(chart.series).each(函数(i,serie){
//想获得系列的编号
});
编辑:
使用遵循的方式获得id。我不确定这是正确的方式吗?
$(chart.series).each(function(i,serie) {
console.log(serie.options.id);
});
解决方案
对
chart.get(ID)
的系列引用如果要循环所有系列并列出系列的所有ID,请执行此操作:
$(chart.series).each(function(i ,serie){console.log(serie.options.id)})
FIddle: http://jsfiddle.net/NaK9D/2/
How to get Series's id? In the API there is only name and data etc. But don't have id. How could I get id from series?
I'm using the following way to loop all series in chart.
$(chart.series).each(function(i, serie){
// Want to get serie's id
});
EDIT:
I found i can get id using the follow way. I'm not sure is it the right way?
$(chart.series).each(function(i, serie){
console.log(serie.options.id);
});
解决方案
If you know the id of series already you can get a reference to the series by
chart.get(ID)
If you want to loop through all the series and list all the IDs of series, do this:
$(chart.series).each(function(i, serie){console.log(serie.options.id)})
FIddle : http://jsfiddle.net/NaK9D/2/
这篇关于如何在Highcharts / Highstock中获得系列的id的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文