Commit 2c94a557 authored by Tristan Cavelier's avatar Tristan Cavelier

erp5_officejs: use loopEventListener on echarts gadget

parent f2fc4d73
...@@ -112,9 +112,10 @@ ...@@ -112,9 +112,10 @@
<item> <item>
<key> <string>text_content</string> </key> <key> <string>text_content</string> </key>
<value> <string>CACHE MANIFEST\n <value> <string>CACHE MANIFEST\n
# v1.0.0\n # v1.1.0\n
CACHE:\n CACHE:\n
gadget_field_graph_echarts.html/echarts-all.js\n gadget_field_graph_echarts.html/echarts-all.js\n
gadget_field_graph_echarts.html/gadget_global.js\n
gadget_field_graph_echarts.html/renderjs.js\n gadget_field_graph_echarts.html/renderjs.js\n
gadget_field_graph_echarts.html/rsvp.js\n gadget_field_graph_echarts.html/rsvp.js\n
gadget_field_graph_echarts.html/unsafe/gadget_field_graph_echarts.js\n gadget_field_graph_echarts.html/unsafe/gadget_field_graph_echarts.js\n
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
<script src="echarts-all.js" type="text/javascript"></script> <script src="echarts-all.js" type="text/javascript"></script>
<!-- custom script --> <!-- custom script -->
<script src="gadget_global.js" type="text/javascript"></script>
<script src="unsafe/gadget_field_graph_echarts.js" type="text/javascript"></script> <script src="unsafe/gadget_field_graph_echarts.js" type="text/javascript"></script>
</head> </head>
......
/*global window, rJS, RSVP, echarts */ /*global window, rJS, RSVP, echarts, loopEventListener */
/*jslint nomen: true, indent: 2 */ /*jslint nomen: true, indent: 2 */
(function (window, rJS, RSVP, echarts) { (function (window, rJS, RSVP, echarts, loopEventListener) {
"use strict"; "use strict";
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
...@@ -174,13 +174,15 @@ ...@@ -174,13 +174,15 @@
chart.setOption(graph_data_and_parameter); chart.setOption(graph_data_and_parameter);
this.listenToClickEventOnTheChart(chart); this.listenToClickEventOnTheChart(chart);
// XXX
window.addEventListener("resize", function () {
chart.resize();
}, {passive: true});
gadget.property_dict.chart = chart; gadget.property_dict.chart = chart;
}) })
.declareService(function () {
var gadget = this;
return loopEventListener(window, "resize", {passive: true}, function () {
gadget.property_dict.chart.resize();
}, false);
})
.declareJob('listenToClickEventOnTheChart', function (chart) { .declareJob('listenToClickEventOnTheChart', function (chart) {
var gadget = this, var gadget = this,
defer = RSVP.defer(); defer = RSVP.defer();
...@@ -191,4 +193,4 @@ ...@@ -191,4 +193,4 @@
}); });
return defer.promise; return defer.promise;
}); });
}(window, rJS, RSVP, echarts)); }(window, rJS, RSVP, echarts, loopEventListener));
\ No newline at end of file
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