summaryrefslogtreecommitdiff
path: root/addons/web_graph/static/src
diff options
context:
space:
mode:
authorGery Debongnie <ged@openerp.com>2013-12-27 15:55:01 +0100
committerGery Debongnie <ged@openerp.com>2013-12-27 15:55:01 +0100
commit650d792413ebb6fa0af8783a97f7de032dd47d42 (patch)
tree40dc01fb00c6a54a93359dc401e968cc7361e738 /addons/web_graph/static/src
parent66ee322d0ff749cbbc8ba382ebb89a755bed66d4 (diff)
[IMP] removes the 'group/stack' buttons from the bar chart ui and adds 'group/stack' controls in the option menu of the graph widget. It makes small graphs much cleaner (addon web_graph)
bzr revid: ged@openerp.com-20131227145501-0hf21nieyl8mgomm
Diffstat (limited to 'addons/web_graph/static/src')
-rw-r--r--addons/web_graph/static/src/js/graph.js14
-rw-r--r--addons/web_graph/static/src/xml/web_graph.xml4
2 files changed, 17 insertions, 1 deletions
diff --git a/addons/web_graph/static/src/js/graph.js b/addons/web_graph/static/src/js/graph.js
index 7dc6d261b0d..6a70a9c4459 100644
--- a/addons/web_graph/static/src/js/graph.js
+++ b/addons/web_graph/static/src/js/graph.js
@@ -317,6 +317,18 @@ instance.web_graph.Graph = instance.web.Widget.extend({
option_selection: function (event) {
event.preventDefault();
switch (event.target.attributes['data-choice'].nodeValue) {
+ case 'bar_grouped':
+ this.bar_ui = 'group';
+ if (this.mode === 'bar_chart') {
+ this.display_data();
+ }
+ break;
+ case 'bar_stacked':
+ this.bar_ui = 'stack';
+ if (this.mode === 'bar_chart') {
+ this.display_data();
+ }
+ break;
case 'swap_axis':
this.pivot.swap_axis();
break;
@@ -582,6 +594,7 @@ instance.web_graph.Graph = instance.web.Widget.extend({
.height(self.height)
.reduceXTicks(false)
.stacked(self.bar_ui === 'stack')
+ .showControls(false)
.staggerLabels(true);
if (self.width / data[0].values.length < 100) {
@@ -589,7 +602,6 @@ instance.web_graph.Graph = instance.web.Widget.extend({
chart.reduceXTicks(true);
chart.margin({bottom:40});
}
- if (dim_x === 1 && dim_y === 0) { chart.showControls(false); }
d3.select(self.svg)
.datum(data)
diff --git a/addons/web_graph/static/src/xml/web_graph.xml b/addons/web_graph/static/src/xml/web_graph.xml
index 262e0df4c96..29e48b1b782 100644
--- a/addons/web_graph/static/src/xml/web_graph.xml
+++ b/addons/web_graph/static/src/xml/web_graph.xml
@@ -29,9 +29,13 @@
Options <span class="caret"></span>
</label>
<ul class="dropdown-menu graph_options_selection" role="menu">
+ <li><a data-choice="bar_grouped" href="#">Group data (bar chart)</a></li>
+ <li><a data-choice="bar_stacked" href="#">Stack data (bar chart)</a></li>
+ <li role="presentation" class="divider"></li>
<li><a data-choice="swap_axis" href="#">Swap Axis</a></li>
<li><a data-choice="expand_all" href="#">Expand All</a></li>
<li><a data-choice="update_values" href="#">Update all values</a></li>
+ <li role="presentation" class="divider"></li>
<li><a data-choice="export_data" href="#">Export data</a></li>
</ul>
</div>