简体   繁体   English

对话框中的jquery flot图

[英]jquery flot graph in dialog

Problem: Display jquery flot graph in dialog box 问题:在对话框中显示jquery flot图

I have a page which displays a horizontal bar graph using flot and this is interactive. 我有一个页面,使用flot显示水平条形图,这是交互式的。 When i click on any of the bars, it executes getJSON and with the variables passed, plots another graph in an external php page. 当我点击任何一个条形时,它执行getJSON并传递变量,在外部php页面中绘制另一个图形。 I'm trying to get the graph drawn in the external php page displayed in the jquery dialog box. 我正在尝试在jquery对话框中显示的外部php页面中绘制图形。

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. 第2页是绘制图形的位置,我想在对话框内的当前页面中显示图形。

maybe try $.get instead of $.getJSON 也许尝试$.get而不是$.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. 您可以创建一个PHP类来包含您的数据,将您的图形数据存储在类的实例中,然后将该对象作为发布数据传递到对话框或弹出窗口。

Then could create a method to process the custom data and draw the graph accordingly. 然后可以创建一个方法来处理自定义数据并相应地绘制图形。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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