diff options
| author | Mathieu Duckerts-Antoine <dam@odoo.com> | 2019-06-26 08:55:24 +0000 |
|---|---|---|
| committer | Mathieu Duckerts-Antoine <dam@odoo.com> | 2019-07-16 07:55:04 +0000 |
| commit | 3184059071f4924542d25687e025f65b286d0ddd (patch) | |
| tree | 97c14863653b3326a51a772f9151d03e9ff60902 /addons/web/static/src/js/views/graph/graph_renderer.js | |
| parent | 6ef6881a1211af1bccd2fe2cdb89805156b1e51a (diff) | |
[FIX] web: no forced date matching in pie charts
In a graph view in mode 'pie', a matching of dates was
attempted each time a comparison and a grouping of data
using the same date/datetime field was done.
Unfortunately, since the read groups results are ordered using
the order of groupbys, the matching was not sensible in case
the date/datetime field was not the first groupby.
We thus restrict the matching to the sole case where it is
sensible. More work should be done to have sensible matchings
in all situations.
closes odoo/odoo#34379
Signed-off-by: VincentSchippefilt <VincentSchippefilt@users.noreply.github.com>
Diffstat (limited to 'addons/web/static/src/js/views/graph/graph_renderer.js')
| -rw-r--r-- | addons/web/static/src/js/views/graph/graph_renderer.js | 7 |
1 files changed, 3 insertions, 4 deletions
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 89c31075942..9c70811ed18 100644 --- a/addons/web/static/src/js/views/graph/graph_renderer.js +++ b/addons/web/static/src/js/views/graph/graph_renderer.js @@ -268,9 +268,8 @@ return AbstractRenderer.extend({ } else { return dataPt.labels.slice(0, 1); } - } else if (i >= 0) { + } else if (i === 0) { return Array.prototype.concat.apply([], [ - dataPt.labels.slice(0, i), this.dateClasses.dateClass(dataPt.originIndex, dataPt.labels[i]), dataPt.labels.slice(i+1) ]); @@ -602,7 +601,7 @@ return AbstractRenderer.extend({ if (_.contains(['bar', 'line'], this.state.mode) && i === 0) { // here label is an array of length 1 and contains a number return this.dateClasses.representative(label, originIndex) || ''; - } else if (this.state.mode === 'pie' && i >= 0) { + } else if (this.state.mode === 'pie' && i === 0) { // here label is an array of length at least one containing string or numbers var labelCopy = label.slice(0); if (originIndex !== undefined) { @@ -656,7 +655,7 @@ return AbstractRenderer.extend({ this.$el.append($canvasContainer); var i = this.state.comparisonFieldIndex; - if (i === 0 || (i > 0 && this.state.mode === 'pie')) { + if (i === 0) { this.dateClasses = this._getDateClasses(dataPoints); } if (this.state.mode === 'bar') { |
