[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
This commit is contained in:
parent
66ee322d0f
commit
650d792413
|
@ -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)
|
||||
|
|
|
@ -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>
|
||||
|
|
Loading…
Reference in New Issue