与highchart和.clone()的问题 [英] trouble with highchart and .clone()

查看:64
本文介绍了与highchart和.clone()的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不明白我在克隆高图时应该如何使用jQuery .clone()。
我知道.clone()不会链接对象上的方法。所以Highchart的克隆看起来是正确的,但是你再也不能与它互动了。
SO,我一直在试图执行以下操作:

 函数clonage(SRC){
变种克隆= src.clone(false);
if(clone.hasClass(highchart)){
clone.highcharts({});






$ b

通过这样做,我得到了交互与图表(图表是空的),但这是破坏克隆(即src),现在只是一个空白部件的原始。
我希望能够重新创建完全相同的图表,而无需嵌入所有图表信息来重新创建它。
。如果任何人有一个想法,为了做到这一点?


解决方案

您是否尝试过使用jQuery .extend?似乎为我工作。

  var clone = $ .extend(true,{},$ obj); 


I don't understand how I'm supposed to use jQuery .clone() when i'm cloning an highchart. I know that .clone() doesn't link the methods on objects. So the clone of the highchart looked correct, but you couldn't interact with it anymore. SO, I've been trying the following :

function clonage(src){
    var clone = src.clone(false);
    if (clone.hasClass("highchart")){
        clone.highcharts({});
    }
}

By doing this, I've got back the interactions with the chart (the chart is blank), but this is destroying the original of the clone (ie src) which is now only a blank widget. I would like to be able to recreate the exact same chart without embedding all the chart information to recreate it. If anyone has an idea in order to do this?

解决方案

Have you tried using jquery .extend ? Seems to work for me.

var clone = $.extend(true, {}, $obj);

这篇关于与highchart和.clone()的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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