javascript - Highcharts rendering the same chart twice - Stack Overflow

Does anyone know how to use highcharts to render the same chart twice?My code that I have is:$(functi

Does anyone know how to use highcharts to render the same chart twice? My code that I have is:

$(function () {
$('#SuccessFailedRatio, #CounterfeitRatio').highcharts({
    chart: {
....

I have two divs in my html with the id's shown above. Only one chart appears in CounterfeitRatio. Does anyone know how to make it appear in both divs? Thanks for the help!

Does anyone know how to use highcharts to render the same chart twice? My code that I have is:

$(function () {
$('#SuccessFailedRatio, #CounterfeitRatio').highcharts({
    chart: {
....

I have two divs in my html with the id's shown above. Only one chart appears in CounterfeitRatio. Does anyone know how to make it appear in both divs? Thanks for the help!

Share Improve this question asked Aug 12, 2013 at 1:58 kchow23kchow23 471 silver badge6 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 8

I would separate your options into an object and then add that to two charts. Highcharts by default will only load your chart into the first element that fits your jQuery selector, so you have to add it to two elements specifically. Here is a jsFiddle!

var options = {
    title: {
        text: 'Monthly Average Temperature',
        x: -20 //center
    }
    //etc...
};

$('#container').highcharts(options);
$('#container2').highcharts(options);

You can use this option:

$('#container').highcharts($.extend({},options));
$('#container2').highcharts($.extend({},options));

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744968143a4603808.html

相关推荐

  • javascript - Highcharts rendering the same chart twice - Stack Overflow

    Does anyone know how to use highcharts to render the same chart twice?My code that I have is:$(functi

    1天前
    70

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信