Hello Everyone,

I am having a problem trying to display two graphs and a data grid. I am able to display both graphs and the grid in individual files, but when combining both the graphs display and the grid becomes hidden.

I checked some posts online, and it seems to be an issue with one of its container node, and they said the solution was to explicitly resize it. I tried that approach and it still doesnt work.

Can anyone help me?

See my code below:

<!DOCTYPE html>
<html >
<head>
<link rel="stylesheet" type="text/css" href="http://localhost/recipe/dijit/themes/claro/claro.css" />
<link rel="stylesheet" type="text/css" href="http://localhost/recipe/dojox/grid/resources/Grid.css" />
<link rel="stylesheet" type="text/css" href="http://localhost/recipe/dojox/grid/resources/claroGrid.css" />
<link rel="stylesheet" type="text/css" href="http://localhost/recipe/dojo/resources/dojo.css" />
<link rel="stylesheet" type="text/css" href="http://localhost/recipe/dojox/grid/enhanced/resources/EnhancedGrid_rtl.css" />
<link rel="stylesheet" type="text/css" href="http://localhost/recipe/dojox/grid/enhanced/resources/EnhancedGrid.css" />
<link rel="stylesheet" type="text/css" href="http://localhost/recipe/dojox/grid/VirtualGrid.js" />
<style type="text/css">

#gridContainer {
    width: 100%;
    height: 250px;
}


</style>
    <?php
    //connect to database
    $con = mysql_connect("localhost", "test", "test") or die('Sorry, could not connect to database server');
    mysql_select_db("brazil", $con) or die('Sorry, could not connect to database');

    //total number of participants
    $query1 = "SELECT participantsExpected from ac where identity =4";
    //number of participants in neoadjuvant chemoterapy
    $query2 = "Select participantsEnrolled from ac where identity=4";
    //number of participants in surgery
    $query3 = "SELECT participantsExpected from ac where identity =2";
    //number of participants off study
    $query4 = "Select participantsEnrolled from ac where identity=1";
    //number of participants expected
    $query5 = "Select participantsExpected from ac where identity=1";
    //number of participants unassigned
    $query6="Select participantsEnrolled from ac where identity=2";


    $result1 = mysql_query($query1) or die ('Could not find total');
    $res1= mysql_fetch_array($result1);
    $totalp = $res1[0];
    //$totalp=json_encode($totalp);
    //echo ($totalp);

    $result2 = mysql_query($query2) or die ('Could not find neo chemoterapy');
    $res2 = mysql_fetch_array($result2);
    $chemop = $res2[0];
    //$chemop= json_encode($chemop);

    $result3 = mysql_query($query3) or die ('Could not find surgery');
    $res3 = mysql_fetch_array($result3);
    $surgeryp = $res3[0];
    //$surgeryp = json_encode($surgeryp);

    $result4 = mysql_query($query4) or die ('Could not find off study');
    $res4 = mysql_fetch_array($result4);
    $offp = $res4[0];
    //$offp = json_encode($offp);
    //print_r($offp);

    $result5 = mysql_query($query5) or die ('Could not find expected');
    $res5 = mysql_fetch_array($result5);
    $expectp = $res5[0];
    //$expectp = json_encode($expectp);
    //print_r($expectp);

    $result6 = mysql_query($query6) or die ('Could not find unassigned');
    $res6 = mysql_fetch_array($result6);
    $unassignp = $res6[0];
    //$unassignp= json_encode($unassignp);
    //print_r($unassignp);
?>

    <link rel="stylesheet" type="text/css" href="./377815.css" />

<script>dojoConfig = {parseOnLoad: true}</script>
<script src="//ajax.googleapis.com/ajax/libs/dojo/1.8.1/dojo/dojo.js"
               data-dojo-config="async: true"></script>
<script>
require([
     // Require the basic chart class
    "dojox/charting/Chart", 
    // Require the theme of our choosing
    "dojox/charting/themes/MiamiNice", 
    // Charting plugins: 
    //  We want to plot Columns
    "dojox/charting/plot2d/Columns",    
     //  We want to plot StackedColumns
    "dojox/charting/plot2d/StackedColumns", 
    //  We want to use Markers
    "dojox/charting/plot2d/Markers", 
    //  We'll use default x/y axes
    "dojox/charting/axis2d/Default",    
    //we'll use Legend
    "dojox/charting/widget/SelectableLegend", 
    //we'll use Legend
    "dojox/grid/EnhancedGrid", 
    //we'll use Legend
    "dojo/data/ItemFileWriteStore", 
    //we'll use Legend
    "dojox/grid/enhanced/plugins/exporter/CSVWriter", 
    // Wait until the DOM is ready
    "dojo/domReady!"
],
 function(Chart, theme) {

    // Define the data

    var total= <?php print_r ($totalp); ?>;
    //alert(total);
    var chemo = <?php echo ($chemop); ?>;
    //alert(chemo);
    var surgery = <?php echo ($surgeryp); ?>;
    //alert(surgery);
    var offstudy = <?php echo ($offp); ?>;
    //alert(offstudy);
    var expected = <?php echo ($expectp); ?>;
    //alert(expected);
    var unassigned = <?php echo ($unassignp); ?>;
    //alert(unassigned);

    // Create the chart within it's "holding" node
    var chart = new Chart("chartNode");
    var chart2 = new Chart("chartNode2");

    // Set the theme
    chart.setTheme(theme);
    chart2.setTheme(theme);

    // Add the only/default plot
    chart.addPlot("default", {
       type: "Columns",
       markers: true,
       shadows: {dx:2, dy:2, dw:2},
       gap: 2
    });
    chart2.addPlot("default", {
       type: "Columns",
       markers: true,
       shadows: {dx:2, dy:2, dw:2},
       gap: 2
    });


    // Add axes
    chart.addAxis("x", {title:"Arms", titleOrientation: "away", minorLabels: false, labels:[{value:0, text:""}, {value:1, text:"NeoAdj Chemo"}, {value:2, text:"Surgery"},{value:3, text: "Unassigned"}, {value:4, text:"Off Study"}, {value:5, text:"Total (Actual)"}, {value:6, text:"Total (Expected)"}], rotation:-45});
    chart.addAxis("y", {title: "Participants", vertical: true, includeZero: true, ticks:true, majorLabels:true, minorLabels: false });

    chart2.addAxis("x", {title:"Arms", titleOrientation: "away", minorLabels: false, labels:[{value:0, text:""}, {value:1, text:"NeoAdj Chemo"}, {value:2, text:"Surgery"},{value:3, text: "Unassigned"}, {value:4, text:"Off Study"}, {value:5, text:"Total (Actual)"}, {value:6, text:"Total (Expected)"}], rotation:-90});
    chart2.addAxis("y", {title: "CRFs", vertical: true, includeZero: true, ticks:true, majorLabels:true, minorLabels: false });

    // Add the series of data for graph1-Participants
    chart.addSeries("NeoAdj Chemo", [chemo,0,0,0,0,0], {stroke:"#FF0099", fill:"#FEA9F3"});
    chart.addSeries("Surgery", [0,surgery,0,0,0,0], {stroke:"#FFFF00", fill:"#FFFF33"});
    chart.addSeries("Unassigned", [0,0,unassigned,0,0,0], {stroke:"#FF0000", fill:"#CC6600"});
    chart.addSeries("Off-Study", [0,0,0,offstudy,0,0], {stroke: "black", fill:"gray"});
    chart.addSeries("Total (Actual)",[0,0,0,0,total,0], {stroke:"black", fill:"black"});
    chart.addSeries("Total (Expected)", [0,0,0,0,0,expected], {stroke: "black", fill:"blue"});

    //Add the series of data for graph2-CRFs
    chart2.addSeries("NeoAdj Chemo", [chemo,0,0,0,0,0], {stroke:"#FF0099", fill:"#FEA9F3"});
    chart2.addSeries("Surgery ", [0,surgery,0,0,0,0], {stroke:"#FFFF00", fill:"#FFFF33"});
    chart2.addSeries("Unassigned ", [0,0,unassigned,0,0,0], {stroke:"#FF0000", fill:"#CC6600"});
    chart2.addSeries("Off-Study ", [0,0,0,offstudy,0,0], {stroke: "black", fill:"gray"});
    chart2.addSeries("Total(Actual)",[0,0,0,0,total,0], {stroke:"black", fill:"black"});
    chart2.addSeries("Total(Expected)", [0,0,0,0,0,expected], {stroke: "black", fill:"blue"});

    // Render the chart!
    chart.render();
    chart2.render();

    var legend1 = new dojox.charting.widget.SelectableLegend({chart: chart, horizontal:true}, "legend1");
    var legend2 = new dojox.charting.widget.SelectableLegend({chart: chart2, horizontal:true}, "legend2");


});
var data = {
    identifier: 'id',
    label: 'id',
    items: []
};
var data_list = [
    {"Heard": true, "Checked": "True", "Genre":"Easy Listening", "Artist":"Bette Midler", "Year":2003, "Album":"Bette Midler Sings the Rosemary Clooney Songbook", "Name":"Hey There", "Length":"03:31", "Track":4, "Composer":"Ross, Jerry 1926-1956 -w Adler, Richard 1921-", "Download Date":"1923/4/9", "Last Played":"04:32:49"},
    {"Heard": true, "Checked": "True", "Genre":"Classic Rock", "Artist":"Jimi Hendrix", "Year":1993, "Album":"Are You Experienced", "Name":"Love Or Confusion", "Length":"03:15", "Track":4, "Composer":"Jimi Hendrix", "Download Date":"1947/12/6", "Last Played":"03:47:49"},
    {"Heard": true, "Checked": "True", "Genre":"Jazz", "Artist":"Andy Narell", "Year":1992, "Album":"Down the Road", "Name":"Sugar Street", "Length":"07:00", "Track":8, "Composer":"Andy Narell", "Download Date":"1906/3/22", "Last Played":"21:56:15"},
    {"Heard": true, "Checked": "True", "Genre":"Progressive Rock", "Artist":"Emerson, Lake & Palmer", "Year":1992, "Album":"The Atlantic Years", "Name":"Tarkus", "Length":"20:40", "Track":5, "Composer":"Greg Lake/Keith Emerson", "Download Date":"1994/11/29", "Last Played":"03:25:19"},
    {"Heard": true, "Checked": "True", "Genre":"Rock", "Artist":"Blood, Sweat & Tears", "Year":1968, "Album":"Child Is Father To The Man", "Name":"Somethin' Goin' On", "Length":"08:00", "Track":9, "Composer":"", "Download Date":"1973/9/11", "Last Played":"19:49:41"},
    {"Heard": true, "Checked": "True", "Genre":"Jazz", "Artist":"Andy Narell", "Year":1989, "Album":"Little Secrets", "Name":"Armchair Psychology", "Length":"08:20", "Track":5, "Composer":"Andy Narell", "Download Date":"2010/4/15", "Last Played":"01:13:08"},
    {"Heard": true, "Checked": "True", "Genre":"Easy Listening", "Artist":"Frank Sinatra", "Year":1991, "Album":"Sinatra Reprise: The Very Good Years", "Name":"Luck Be A Lady", "Length":"05:16", "Track":4, "Composer":"F. Loesser", "Download Date":"2035/4/12", "Last Played":"06:16:53"},
    {"Heard": true, "Checked": "True", "Genre":"Progressive Rock", "Artist":"Dixie dregs", "Year":1977, "Album":"Free Fall", "Name":"Sleep", "Length":"01:58", "Track":6, "Composer":"Steve Morse", "Download Date":"2032/11/21", "Last Played":"08:23:26"},
    {"Heard": true, "Checked": "True", "Genre":"Classic Rock", "Artist":"Black Sabbath", "Year":2004, "Album":"Master of Reality", "Name":"Sweet Leaf", "Length":"05:04", "Track":1, "Composer":"Bill Ward/Geezer Butler/Ozzy Osbourne/Tony Iommi", "Download Date":"2036/5/26", "Last Played":"22:10:19"},
    {"Heard": true, "Checked": "True", "Genre":"Blues", "Artist":"Buddy Guy", "Year":1991, "Album":"Damn Right, I've Got The Blues", "Name":"Five Long Years", "Length":"08:27", "Track":3, "Composer":"Eddie Boyd/John Lee Hooker", "Download Date":"1904/4/4", "Last Played":"18:28:08"},
    {"Heard": true, "Checked": "True", "Genre":"Easy Listening", "Artist":"Frank Sinatra", "Year":1991, "Album":"Sinatra Reprise: The Very Good Years", "Name":"The Way You Look Tonight", "Length":"03:23", "Track":5, "Composer":"D. Fields/J. Kern", "Download Date":"1902/10/12", "Last Played":"23:09:23"}];

var i, len;
for(i=0, len = data_list.length; i < len; ++i){
    data.items.push(dojo.mixin({'id': i + 1 }, data_list[i % len]));
}

dojo.ready(function(){
    alert("test");
    var store = new dojo.data.ItemFileWriteStore({data: data});

    var layout = [
        { field: "id"},
        { field: "Heard"},
        { field: "Checked"},
        { field: "Genre"},
        { field: "Artist"},
        { field: "Album"},
        { field: "Name"},
        { field: "Track"},
        { field: "Download Date"},
        { field: "Last Played"}
    ];

    var grid = new dojox.grid.EnhancedGrid({
        id: 'grid',
        store: store,
        structure: layout
        });
    grid.placeAt('gridContainer');
    grid.startup();
}); 
</script>

<body class="Wetland">
<center><img src="./lacrn.jpg"></center>
<center
<table cellpadding="0" cellspacing="6" ><tr><td><font size="5"><b>US-LA CRN OpenClinica Dashboard</font> </td></tr> </center>
<tr><td><Center><font size="4"><b>Argentina</font> </td></tr><tr><td><Center>P&#225;gina generada el: Wednesday, February 20, 2013 17:19</td></tr>
<tr><td><Center>Datos actualizados al (yyyy-mm-dd): 2013-02-20</td></tr></table> 


<table BORDER="2" BORDERCOLOR="#336699" CELLPADDING="2" CELLSPACING="2" WIDTH="100%">
<tr>
    <td> 
    <div id="chartNode" style="float:left">    
    </div>
    <div id="legend1"></div>      
    </td>
    <td> 
    <div id="chartNode2" style="float:left">    
    </div>
    <div id="legend2"></div>      
    </td>
    </tr>
</table>

<center>
<table border ="2" width="100%">
<tr>
    <td> "Testing"</td>
</tr>
</table>
</center>

<center>
<table border="2" BORDERCOLOR="#336699" CELLPADDING="2" CELLSPACING="2" WIDTH="100%">
    <FORM name="lacrn1" action="lacrnhv3.php" method="get">
    <SELECT name="studynum">
    <OPTION value="">--Seleccionar una Fecha--</OPTION><OPTION value="2013-02-20">2013-02-20</OPTION>, <OPTION value="2013-02-19">2013-02-19</OPTION>, <OPTION value="2013-02-18">2013-02-18</OPTION>, <OPTION value="2013-02-17">2013-02-17</OPTION>, <OPTION value="2013-02-16">2013-02-16</OPTION>, <OPTION value="2013-02-15">2013-02-15</OPTION>, <OPTION value="2013-02-14">2013-02-14</OPTION>, <OPTION value="2013-02-13">2013-02-13</OPTION>, <OPTION value="2013-02-12">2013-02-12</OPTION>, <OPTION value="2013-02-11">2013-02-11</OPTION>, <OPTION value="2013-02-10">2013-02-10</OPTION>, <OPTION value="2013-02-09">2013-02-09</OPTION>, <OPTION value="2013-02-08">2013-02-08</OPTION>, <OPTION value="2013-02-07">2013-02-07</OPTION>, <OPTION value="2013-02-06">2013-02-06</OPTION>, <OPTION value="2013-02-05">2013-02-05</OPTION>, <OPTION value="2013-02-04">2013-02-04</OPTION>, <OPTION value="2013-02-03">2013-02-03</OPTION>, <OPTION value="2013-02-02">2013-02-02</OPTION>, <OPTION value="2013-02-01">2013-02-01</OPTION>, <OPTION value="2013-01-31">2013-01-31</OPTION>, <OPTION value="2013-01-30">2013-01-30</OPTION>, <OPTION value="2013-01-29">2013-01-29</OPTION>, <OPTION value="2013-01-28">2013-01-28</OPTION>, <OPTION value="2013-01-27">2013-01-27</OPTION>, <OPTION value="2013-01-26">2013-01-26</OPTION>, <OPTION value="2013-01-25">2013-01-25</OPTION>, <OPTION value="2013-01-24">2013-01-24</OPTION>, <OPTION value="2013-01-23">2013-01-23</OPTION>, <OPTION value="2013-01-22">2013-01-22</OPTION>, <OPTION value="2013-01-21">2013-01-21</OPTION>, <OPTION value="2013-01-20">2013-01-20</OPTION>, <OPTION value="2013-01-19">2013-01-19</OPTION>, <OPTION value="2013-01-18">2013-01-18</OPTION>, <OPTION value="2013-01-17">2013-01-17</OPTION>, <OPTION value="2013-01-16">2013-01-16</OPTION>, <OPTION value="2013-01-15">2013-01-15</OPTION>, <OPTION value="2013-01-14">2013-01-14</OPTION>, <OPTION value="2013-01-13">2013-01-13</OPTION>, <OPTION value="2013-01-12">2013-01-12</OPTION>, <OPTION value="2013-01-11">2013-01-11</OPTION>, <OPTION value="2013-01-10">2013-01-10</OPTION>, <OPTION value="2013-01-09">2013-01-09</OPTION>, <OPTION value="2013-01-08">2013-01-08</OPTION>, <OPTION value="2013-01-07">2013-01-07</OPTION>, <OPTION value="2013-01-06">2013-01-06</OPTION>, <OPTION value="2013-01-05">2013-01-05</OPTION>, <OPTION value="2013-01-04">2013-01-04</OPTION>, <OPTION value="2013-01-03">2013-01-03</OPTION>, <OPTION value="2013-01-02">2013-01-02</OPTION>, <OPTION value="2013-01-01">2013-01-01</OPTION>, <OPTION value="2012-12-31">2012-12-31</OPTION>, <OPTION value="2012-12-30">2012-12-30</OPTION>, <OPTION value="2012-12-29">2012-12-29</OPTION>, <OPTION value="2012-12-28">2012-12-28</OPTION>, <OPTION value="2012-12-27">2012-12-27</OPTION>, <OPTION value="2012-12-26">2012-12-26</OPTION>, <OPTION value="2012-12-25">2012-12-25</OPTION>, <OPTION value="2012-12-24">2012-12-24</OPTION>, <OPTION value="2012-12-23">2012-12-23</OPTION>, <OPTION value="2012-12-22">2012-12-22</OPTION>, <OPTION value="2012-12-21">2012-12-21</OPTION>, <OPTION value="2012-12-20">2012-12-20</OPTION>, <OPTION value="2012-12-19">2012-12-19</OPTION>, <OPTION value="2012-12-18">2012-12-18</OPTION>, <OPTION value="2012-12-17">2012-12-17</OPTION>, <OPTION value="2012-12-16">2012-12-16</OPTION>, <OPTION value="2012-12-15">2012-12-15</OPTION>, <OPTION value="2012-12-14">2012-12-14</OPTION>, <OPTION value="2012-12-13">2012-12-13</OPTION>, <OPTION value="2012-12-12">2012-12-12</OPTION>, <OPTION value="2012-12-11">2012-12-11</OPTION>, <OPTION value="2012-12-10">2012-12-10</OPTION>, <OPTION value="2012-12-09">2012-12-09</OPTION>, <OPTION value="2012-12-08">2012-12-08</OPTION>, <OPTION value="2012-12-07">2012-12-07</OPTION>, <OPTION value="2012-12-06">2012-12-06</OPTION>, <OPTION value="2012-12-05">2012-12-05</OPTION>, <OPTION value="2012-12-04">2012-12-04</OPTION>, <OPTION value="2012-12-03">2012-12-03</OPTION>, <OPTION value="2012-12-02">2012-12-02</OPTION>, <OPTION value="2012-12-01">2012-12-01</OPTION>, <OPTION value="2012-11-30">2012-11-30</OPTION>, <OPTION value="2012-11-28">2012-11-28</OPTION>, <OPTION value="2012-11-14">2012-11-14</OPTION>, <OPTION value="2012-10-31">2012-10-31</OPTION>, <OPTION value="2012-10-17">2012-10-17</OPTION>, <OPTION value="2012-10-10">2012-10-10</OPTION>, <OPTION value="2012-10-04">2012-10-04</OPTION>    </SELECT>
    <INPUT TYPE="submit" value="Enviar">
    </FORM>
<form><input type="button" value="Export CSV File" onClick="window.location.href='https://lacrn-ar.ccsainc.com:8801/download.php?site=ar'" ></form> 
</table>
</center>

<table border="2" BORDERCOLOR="#336699" CELLPADDING="2" CELLSPACING="2" WIDTH="100%">
<tr><td>
<div id ="gridContainer">
<div id="grid" dojoType:"dojox.VirtualGrid" get="get" structure="structure" rowCount="10" elasticView="2"></div></td></tr>

</body>
</html>
Member Avatar for LastMitch

they said the solution was to explicitly resize it. I tried that approach and it still doesnt work.

Can you post the link to where you got that source? I don't see in your code that has the resized code.

I think you have to used autoHeight & autoWidth.

I found the reference-guide here:

http://dojotoolkit.org/reference-guide/1.8/dojox/grid/DataGrid.html

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.