Highchart Legend into another Element(div) [英] Highchart Legend into another Element (div)

查看:101
本文介绍了Highchart Legend into another Element(div)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要另一个海图传奇,我想用css / html风格。我发现这个主题的主题,但我无法得到它的工作,并且jsFiddle链接不再工作...

有人可以帮助我得到这个加工?


以下是我的jsfiddle Link
http:/ /jsfiddle.net/chogger/j3xvg



这是我发现的:

  $(chart.series).each(function(i,serie){
$('< li style =color:'+ serie.color +'>'+ serie ();
serie.visible(serie.show();
})。appendTo('#legend' )

})

解决方案

什么不适合你?你用这个加载事件处理程序吗?请参阅: http://jsfiddle.net/j3xvg/1/

  chart = new Highcharts.Chart({
图表:{
renderTo:'container',
defaultSeriesType:'line',
marginRight:50,
marginBottom:175,
events:{
load:function(){
var chart = this;
$(chart.series).each (函数(i,serie){
$('< li style =color:'+ serie.color +'>'+ serie.name +'< / li>')。click函数(){
serie.visible?serie.hide():serie.show();
})。appendTo('#legend');
});
}
}
},
});


i need another Highchart Legend which i want to style with css/html. I found a topic with this topic but I can't get it to work and the jsFiddle Link isn't working anymore...

Can someone help me to get this working? Please

Here is my jsfiddle Link http://jsfiddle.net/chogger/j3xvg

This is what I found:

$(chart.series).each(function(i, serie){
$('<li style="color: '+serie.color+'">'+serie.name+'</li>').click(function(){
    serie.visible ? serie.hide() : serie.show();
}).appendTo('#legend')

})

解决方案

What exactly doesn't work for you? Are you using load event handler for this? See: http://jsfiddle.net/j3xvg/1/

chart = new Highcharts.Chart({
    chart: {
        renderTo: 'container',
        defaultSeriesType: 'line',
        marginRight: 50,
        marginBottom: 175,
        events: {
            load: function () {
                var chart = this;
                $(chart.series).each(function (i, serie) {
                    $('<li style="color: ' + serie.color + '">' + serie.name + '</li>').click(function () {
                        serie.visible ? serie.hide() : serie.show();
                    }).appendTo('#legend');
                });
            }
        }
    },
});

这篇关于Highchart Legend into another Element(div)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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