<![endif]-->
<script type="text/javascript" src="static/jquery-1.10.1.min.js"></script>
<script type="text/javascript" src="static/jquery.flot.min.js"></script>
+
<script type="text/javascript" src="static/mctx.gui.js"></script>
<script type="text/javascript" src="static/mctx.graph.js"></script>
-
<link rel="stylesheet" type="text/css" href="static/style.css">
<link rel="stylesheet" type="text/css" href="static/nav-menu.css">
<script type="text/javascript">
}).always(function () {
$(document).ready(function () {
$("#graph-controls").setDevices();
- //$("#graph-run").runButton();
});
});
<div class="widget">
<div class="title">Graph</div>
<div id="graph" class="plot">
- <!-- graph placeholder -->
+
</div>
+ <!-- graph placeholder -->
+ <!--<div id="graph" class="plot">
+
+ </div>-->
</div>
<div class="widget" id="graph-controls">
<!--<div class="title">Visualise</div>-->
</div>
<input type="button" value="Run" id="graph-run" onClick="$('#graph-run').runButton()">
<input type="button" value="Open New Graph" disabled>
- <input type="button" value="Save Graph Image" disabled>
+ <input type="button" value="Save Graph Image" id="saveimage">
<input type="button" value="Dump Raw Data" disabled>
+ <script>
+ $("#saveimage").click(function () {
+ $("canvas").each(function () {
+ var image = new Image();
+
+ window.open(this.toDataURL("image/png"));
+ $("#graph-controls").append(image);
+ });
+ });
+ </script>
</div>
<!-- TODO: Put this on its own page?
mctx.graph.independent = null;
mctx.graph.timer = null;
mctx.graph.running = false;
+mctx.graph.chart = null;
/**
* Helper - Calculate pairs of (dependent, independent) values
$("#xaxis").deployDevices("radio", false, 'xaxis');
$("#yaxis").deployDevices("checkbox", true, 'yaxis');
$("#current_time").val(data.running_time);
- //Add event listeners for when the inputs are changed
+ //Add event listeners for when the
$(".change input").change(function () {
$("#graph").setGraph();
});
}
});
- $.plot("#graph", plot_data);
+ //$.plot("#graph", plot_data);
+ if (mctx.graph.chart !== null) {
+ mctx.graph.chart.setData(plot_data);
+ mctx.graph.chart.setupGrid();
+ mctx.graph.chart.draw();
+ } else {
+ mctx.graph.chart = $.plot("#graph", plot_data);
+ }
if (mctx.graph.running) {
mctx.graph.timer = setTimeout(updater, 1000);
}