diff --git a/addons/web/static/src/js/views/graph/graph_renderer.js b/addons/web/static/src/js/views/graph/graph_renderer.js index da5709a6261..935226da8dd 100644 --- a/addons/web/static/src/js/views/graph/graph_renderer.js +++ b/addons/web/static/src/js/views/graph/graph_renderer.js @@ -313,7 +313,7 @@ return AbstractRenderer.extend({ }; } data_dict[serie].values.push({ - x: tick, y: this.state.data[i].value, + x: tick - 1, y: this.state.data[i].value, }); data = _.map(data_dict, identity); } diff --git a/addons/web/static/tests/views/graph_tests.js b/addons/web/static/tests/views/graph_tests.js index 7bb2fce78b5..561b0016d28 100644 --- a/addons/web/static/tests/views/graph_tests.js +++ b/addons/web/static/tests/views/graph_tests.js @@ -154,6 +154,29 @@ QUnit.module('Views', { }); }); + QUnit.test('displaying line chart data with multiple groupbys', function (assert) { + // this test makes sure the line chart shows all data labels (X axis) when + // it is grouped by several fields + assert.expect(3); + + var graph = createView({ + View: GraphView, + model: 'foo', + data: this.data, + arch: '', + groupBy: ['product_id', 'bar'], + }); + + assert.strictEqual(graph.$('.nv-x text:contains(xphone)').length, 1, + "should contain a text element with product xphone on X axis"); + assert.strictEqual(graph.$('.nv-x text:contains(xpad)').length, 1, + "should contain a text element with product xpad on X axis"); + assert.strictEqual(graph.$('text:contains(true)').length, 1, + "should have an entry for each value of field 'bar' in the legend"); + + graph.destroy(); + }); + QUnit.test('switching measures', function (assert) { var done = assert.async(); assert.expect(4); diff --git a/requirements.txt b/requirements.txt index 44b4fcb11c0..85d4a1902e7 100644 --- a/requirements.txt +++ b/requirements.txt @@ -29,7 +29,8 @@ pyserial==3.1.1 python-dateutil==2.5.3 pytz==2016.7 pyusb==1.0.0 -PyYAML==3.12 +PyYAML==3.12 ; python_version < '3.7' +PyYAML==3.13 ; python_version >= '3.7' qrcode==5.3 reportlab==3.3.0 requests==2.11.1