Commit dd136752 authored by Alain Takoudjou's avatar Alain Takoudjou

[erp5_officejs] gadget graph dygraph accept zoom range and can fill the area underneath the graph

New options zoom_range array [earliest, latest] in layout should tell which section of the graph to zoom initially.
the graph data type "surface" in dygraph allow to fill the area underneath the graph
parent 2572999b
...@@ -47,6 +47,10 @@ ...@@ -47,6 +47,10 @@
"right" "right"
], ],
"type": "string" "type": "string"
},
"zoom_range": {
"description": "Initially zoom in on a section of the graph axis. Value is of the form [earliest, latest]",
"type": "array"
} }
}, },
"type": "object", "type": "object",
...@@ -106,7 +110,7 @@ ...@@ -106,7 +110,7 @@
} }
}, },
"additionalProperties": false "additionalProperties": false
}, }
}, },
"type": "object" "type": "object"
} }
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
var graph_data_and_parameter = {}, var graph_data_and_parameter = {},
layout, layout,
data, data,
x_label, y_label, x_label, y_label, x_zoom, y_zoom,
label_list = [], label_list = [],
trace_value_dict, trace_value_dict,
dygraph_data = [], dygraph_data = [],
...@@ -35,13 +35,21 @@ ...@@ -35,13 +35,21 @@
data = configuration_dict.data || []; data = configuration_dict.data || [];
axis_dict = layout.axis_dict || {}; axis_dict = layout.axis_dict || {};
x_label = (axis_dict[0] || {}).title; x_label = (axis_dict[0] || {}).title;
x_zoom = (axis_dict[0] || {}).zoom_range;
y_label = (axis_dict[1] || {}).title; y_label = (axis_dict[1] || {}).title;
y_zoom = (axis_dict[1] || {}).zoom_range;
if (x_label !== undefined) { if (x_label !== undefined) {
graph_data_and_parameter.xlabel = x_label; graph_data_and_parameter.xlabel = x_label;
} }
if (x_zoom !== undefined) {
graph_data_and_parameter.dateWindow = x_zoom;
}
if (y_label !== undefined) { if (y_label !== undefined) {
graph_data_and_parameter.ylabel = y_label; graph_data_and_parameter.ylabel = y_label;
} }
if (y_zoom !== undefined) {
graph_data_and_parameter.valueRange = y_zoom;
}
label_list.push(x_label); label_list.push(x_label);
/* Dygraph only support 2D, so we assume we have only only two axis for data. /* Dygraph only support 2D, so we assume we have only only two axis for data.
...@@ -71,6 +79,8 @@ ...@@ -71,6 +79,8 @@
if (type === "scatter") { if (type === "scatter") {
serie.drawPoints = true; serie.drawPoints = true;
serie.strokeWidth = 0; serie.strokeWidth = 0;
} else if (type === "surface") {
serie.fillGraph = true;
} }
console.log("serie", serie); console.log("serie", serie);
graph_data_and_parameter.series[trace.title || ''] = serie; graph_data_and_parameter.series[trace.title || ''] = serie;
......
...@@ -222,7 +222,7 @@ ...@@ -222,7 +222,7 @@
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>superseb</string> </value> <value> <string>zope</string> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
...@@ -236,7 +236,7 @@ ...@@ -236,7 +236,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>961.22065.145.58026</string> </value> <value> <string>961.61077.56819.56320</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -254,8 +254,8 @@ ...@@ -254,8 +254,8 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1502453287.3</float> <float>1504798535.36</float>
<string>GMT+2</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
</object> </object>
......
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