Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Took me a while to find an answer for the script generated data, so I'm going to post this right here. I used a combination of the above code.</p> <p>I created a global var, named plot3 within my script file. Then created the below function. When this is called with a redraw boolean, it determines if I need to destroy and redraw or draw for the first time.</p> <p>What first bit of code does is gets data from my jqgrid, (which is being updated in a different function), and updates the arrays. The second bit, determines my interval ticks, on the x-axis dependent upon my length of data.</p> <pre><code>function DrawGraph(bRedraw){ var testTimes = []; testTimes = $('#polarizationTable').jqGrid('getCol', 'TestTime', testTimes, false); var RdgA = $('#polarizationTable').jqGrid('getCol', 'RdgA', RdgA, false); var RdgB = $('#polarizationTable').jqGrid('getCol', 'RdgB', RdgB, false); var readingLineA = []; for (var i=0; i&lt;testTimes.length; i++){ readingLineA.push([testTimes[i], RdgA[i]]); } var readingLineB = []; for (var i=0; i&lt;testTimes.length; i++){ readingLineB.push([testTimes[i], RdgB[i]]); } var maxX = $("#testLength").val(); var lengthX = testTimes.length; var tickIntervalX = Math.round(maxX/10); if(bRedraw == true) { plot3.destroy(); bRedraw = false; } if(bRedraw == false) { plot3 = $.jqplot('chart3', [readingLineA, readingLineB], { title:'Graph', series:[{label:'Reading - A'}, {label:'Reading - B'} ], legend:{show:true, location:'se'}, // You can specify options for all axes on the plot at once with // the axesDefaults object. Here, we're using a canvas renderer // to draw the axis label which allows rotated text. axes:{ xaxis:{ label:'Minutes', syncTicks: true, min: 0, numberTicks: 10, tickInterval: tickIntervalX, max: maxX*1.1, labelRenderer: $.jqplot.CanvasAxisLabelRenderer, labelOptions: { fontSize: '12pt' }, }, yaxis:{ label:'Data', min: 0, numberTicks: 10, labelRenderer: $.jqplot.CanvasAxisLabelRenderer, labelOptions: { fontSize: '12pt' } }, } }); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload