Commit 39f12632 authored by Jérome Perrin's avatar Jérome Perrin

update static version

parent daa7791e
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Graph</title>
<script src="../lib/rsvp.min.js" type="text/javascript"></script>
<script src="../lib/renderjs.min.js" type="text/javascript"></script>
<script src="../lib/jquery.js" type="text/javascript"></script>
<script src="../lib/jquery.flot.js"></script>
<script src="../lib/jquery.flot.stack.js"></script>
<script src="../lib/jquery.flot.time.js"></script>
<script src="mixin_gadget.js" type="text/javascript"></script>
<script src="Output_viewBottleneckGraph.js" type="text/javascript"></script>
</head>
<body>
<div class="graph_container" style="float:left; width: 100%; height:300px"></div>
<div>
<label for="choices">Please select bottleneck:</label>
<select class="choices" name="choices"></select>
</div>
</body>
</html>
/*global rJS, jQuery, initGadgetMixin, console */
/*jslint unparam: true */
(function(window, rJS, $, initGadgetMixin) {
"use strict";
var gadget_klass = rJS(window);
initGadgetMixin(gadget_klass);
gadget_klass.declareAcquiredMethod("aq_getAttachment", "jio_getAttachment").declareMethod("render", function(options) {
var jio_key = options.id, gadget = this;
gadget.props.jio_key = jio_key;
gadget.props.result = options.result;
return gadget.aq_getAttachment({
_id: gadget.props.jio_key,
_attachment: "body.json"
}).push(function(simulation_json) {
var json_data = JSON.parse(simulation_json);
gadget.props.data = json_data.result.result_list[options.result][options.action_definition.configuration.output_id];
});
}).declareMethod("startService", function() {
var first_option, datasets = this.props.data, graph_container = this.props.element.querySelector(".graph_container"), select = $(this.props.element.querySelector("select.choices"));
function plotAccordingToChoices() {
var data;
if (select.val()) {
data = datasets[select.val()];
$.plot(graph_container, data.series, data.options);
}
}
// insert options in the select
$.each(datasets, function(key, val) {
select.append("<option value='" + key + "'>" + key + "</option>");
});
first_option = $($("option", select).get(0));
first_option.attr("selected", "selected");
select.selectmenu("refresh", true);
select.bind("change", plotAccordingToChoices);
plotAccordingToChoices();
});
})(window, rJS, jQuery, initGadgetMixin);
\ No newline at end of file
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
<script src="Output_viewGraph.js" type="text/javascript"></script> <script src="Output_viewGraph.js" type="text/javascript"></script>
</head> </head>
<body> <body>
<div class="graph_container" style="width: 100%;height:300px"></div> <div class="graph_container" style="float:left; width: 100%; height:300px"></div>
<div class="choices" style="float:right; width: 10%; height:300px"></div>
</body> </body>
</html> </html>
...@@ -16,7 +16,40 @@ ...@@ -16,7 +16,40 @@
gadget.props.data = json_data.result.result_list[options.result][options.action_definition.configuration.output_id]; gadget.props.data = json_data.result.result_list[options.result][options.action_definition.configuration.output_id];
}); });
}).declareMethod("startService", function() { }).declareMethod("startService", function() {
// XXX Manually calculate width and height when resizing var i = 0, options = this.props.data.options, datasets = this.props.data.series, graph_container = this.props.element.querySelector(".graph_container"), choice_container = $(this.props.element.querySelector(".choices"));
$.plot(this.props.element.querySelector(".graph_container"), this.props.data.series, this.props.data.options); $.plot(graph_container, this.props.data.series, this.props.data.options);
// Add checkboxes to toggle series on & off, inspired from http//:www.flotcharts.org/flot/examples/series-toggle/index.html
function plotAccordingToChoices() {
var data = [];
choice_container.find("input:checked").each(function() {
var key = $(this).attr("name");
if (key && datasets[key]) {
data.push(datasets[key]);
}
});
if (data.length > 0) {
$.plot(graph_container, data, options);
}
}
if (!this.props.data.options.bars) {
if (this.props.data.series.length >= 5) {
// display the boxes
$(graph_container).css({
width: "90%"
});
// hard-code color indices to prevent them from shifting as
// series are turned on/off
$.each(datasets, function(key, val) {
val.color = i;
i += 1;
});
// insert checkboxes
$.each(datasets, function(key, val) {
choice_container.append("<br/><input type='checkbox' name='" + key + "' checked='checked' id='id" + key + "'></input>" + "<label style='display:inline' for='id" + key + "'>" + val.label + "</label>");
});
choice_container.find("input").click(plotAccordingToChoices);
plotAccordingToChoices();
}
}
}); });
})(window, rJS, jQuery, initGadgetMixin); })(window, rJS, jQuery, initGadgetMixin);
\ No newline at end of file
<!DOCTYPE html> <!DOCTYPE html>
<html> <html manifest="../manifest.appcache">
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
......
...@@ -219,10 +219,7 @@ ...@@ -219,10 +219,7 @@
} }
function updateElementData(gadget, node_id, data) { function updateElementData(gadget, node_id, data) {
var element_id = gadget.props.node_id_to_dom_element_id[node_id], new_id = data.id; var element_id = gadget.props.node_id_to_dom_element_id[node_id], new_id = data.id;
if (data.data.name) { $(gadget.props.element).find("#" + element_id).text(data.data.name || new_id).attr("title", data.data.name || new_id).append('<div class="ep"></div></div>');
$(gadget.props.element).find("#" + element_id).text(data.data.name).attr("title", data.data.name).append('<div class="ep"></div></div>');
gadget.props.data.graph.node[node_id].name = data.data.name;
}
delete data.id; delete data.id;
$.extend(gadget.props.data.graph.node[node_id], data.data); $.extend(gadget.props.data.graph.node[node_id], data.data);
if (new_id && new_id !== node_id) { if (new_id && new_id !== node_id) {
...@@ -507,7 +504,6 @@ ...@@ -507,7 +504,6 @@
var render_element = $(gadget.props.main), class_definition = gadget.props.data.class_definition[node_data._class], coordinate = node_data.coordinate, dom_element_id, box, absolute_position, domElement; var render_element = $(gadget.props.main), class_definition = gadget.props.data.class_definition[node_data._class], coordinate = node_data.coordinate, dom_element_id, box, absolute_position, domElement;
dom_element_id = generateDomElementId(gadget.props.element); dom_element_id = generateDomElementId(gadget.props.element);
gadget.props.node_id_to_dom_element_id[node_id] = dom_element_id; gadget.props.node_id_to_dom_element_id[node_id] = dom_element_id;
node_data.name = node_data.name || node_id;
gadget.props.data.graph.node[node_id] = node_data; gadget.props.data.graph.node[node_id] = node_data;
if (coordinate === undefined) { if (coordinate === undefined) {
coordinate = { coordinate = {
...@@ -520,8 +516,8 @@ ...@@ -520,8 +516,8 @@
domElement = domParser.parseFromString(node_template({ domElement = domParser.parseFromString(node_template({
"class": node_data._class.replace(".", "-"), "class": node_data._class.replace(".", "-"),
element_id: dom_element_id, element_id: dom_element_id,
title: node_data.name || node_data.id, title: node_data.name || node_id,
name: node_data.name || node_data.id name: node_data.name || node_id
}), "text/html").querySelector(".window"); }), "text/html").querySelector(".window");
render_element.append(domElement); render_element.append(domElement);
waitForNodeClick(gadget, domElement); waitForNodeClick(gadget, domElement);
......
CACHE MANIFEST
# This manifest was generated by grunt-manifest HTML5 Cache Manifest Generator
# Time: Thu Apr 16 2015 08:36:33 GMT+0200 (CEST)
CACHE:
dream/InputModule_viewAddDocumentDialog.js
dream/InputModule_viewInputList.js
dream/Input_viewAttachDocument.js
dream/Input_viewDebugJson.js
dream/Input_viewDocumentManagement.js
dream/Input_viewProductionLine.js
dream/Input_viewResultComparison.js
dream/Input_viewResultList.js
dream/Input_viewSimulation.js
dream/Input_viewSpreadsheet.js
dream/Output_viewBottleneckGraph.js
dream/Output_viewCalendar.js
dream/Output_viewDownloadFile.js
dream/Output_viewExitStatistics.js
dream/Output_viewGantt.js
dream/Output_viewGraph.js
dream/Output_viewSpreadsheet.js
dream/index.js
dream/mixin_gadget.js
dream/mixin_promise.js
expandable_field/expandablefield.js
fieldset/fieldset.js
handsontable/handsontable.js
handsontable/test.js
integer_field/integerfield.js
jio_bridge/jiogadget.js
jsplumb/jsplumb.js
jsplumb/test.js
lib/URI.js
lib/codemirror-compressed.js
lib/dhtmlxgantt.js
lib/dhtmlxscheduler.js
lib/handlebars.min.js
lib/handsontable.js
lib/jio.js
lib/jquery-ui.js
lib/jquery.flot.js
lib/jquery.flot.stack.js
lib/jquery.flot.time.js
lib/jquery.js
lib/jquery.jsplumb.js
lib/jquery.simulate.js
lib/jquerymobile.js
lib/jsonlint.js
lib/moment.js
lib/pubsub.js
lib/qunit.js
lib/renderjs.min.js
lib/rsvp.min.js
lib/uritemplate.min.js
list_field/listfield.js
number_field/numberfield.js
string_field/stringfield.js
toolbox/toolbox.js
dream/index.css
jsplumb/jsplumb.css
lib/codemirror.css
lib/dhtmlxgantt.css
lib/dhtmlxscheduler.css
lib/handsontable.css
lib/jquery-ui.css
lib/jquerymobile.css
lib/qunit.css
toolbox/toolbox.css
NETWORK:
*
...@@ -53,7 +53,7 @@ ...@@ -53,7 +53,7 @@
} }
Object.keys(_class.css || {}).forEach(function(k) { Object.keys(_class.css || {}).forEach(function(k) {
// some styles are ignored here, to keep the rendering of toolbox consistent. // some styles are ignored here, to keep the rendering of toolbox consistent.
if (k != "line-height") { if (k !== "line-height") {
tool.style[k] = _class.css[k]; tool.style[k] = _class.css[k];
} }
}); });
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment