简体   繁体   中英

jquery flot graph in dialog

Problem: Display jquery flot graph in dialog box

I have a page which displays a horizontal bar graph using flot and this is interactive. When i click on any of the bars, it executes getJSON and with the variables passed, plots another graph in an external php page. I'm trying to get the graph drawn in the external php page displayed in the jquery dialog box.

Ive been looking everywhere but i'm unable to figure out a solution. Any help is appreciated.

    $.getJSON("page2.php?"+data, function(mdata) {
        $('<div></div>').html(result).dialog({ 
        autoOpen: false, 
        modal: true, 
        title: 'Page Hits - Monthly', 
        width: 450, height: 300 
    }).dialog('open'); 

page 2 is where the graph is drawn and i want to display the graph in the current page inside a dialog box.

maybe try $.get instead of $.getJSON

$.get('page2.php?'+data, function(response){
  $('<div></div>').html(response).dialog({ 
    autoOpen: true, 
    modal: true, 
    title: 'Page Hits - Monthly', 
    width: 450, height: 300 
  });
}); 

you could just create a PHP class to contain your data, store your graph data in an instance of the class and then pass the object as a post data to your dialog or popup window.

Then could create a method to process the custom data and draw the graph accordingly.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM