diff options
| author | Mathieu Duckerts-Antoine <dam@odoo.com> | 2020-02-21 12:28:46 +0000 |
|---|---|---|
| committer | Mathieu Duckerts-Antoine <dam@odoo.com> | 2020-02-25 15:30:04 +0000 |
| commit | c7851add36575ce3f34a692a53acfdf4432a4d0c (patch) | |
| tree | e5e55c92052749e2dc1df7e7e36326e66b2422fe /addons/web/static/src/js/views/graph/graph_renderer.js | |
| parent | a39cc6bc00df1a72cb12cfaa9c56cbe9fafaee83 (diff) | |
[FIX] web: graph renders only finer date groupby option
Rendering a graph view with several options selected for a given
date groupby can take too much time and block the page.
Since grouping on the same date/datetime field several times
barely makes sense in a graph view, we choose to use only the finer
option, e.g. 'week' is prefered to 'quarter'.
Task ID: 2198846
X-original-commit: 7e36bee14e18ca17e15de1bacb7ff26010d0b372
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 | 12 |
1 files changed, 6 insertions, 6 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 6cb2c023d0e..e83edbbbf04 100644 --- a/addons/web/static/src/js/views/graph/graph_renderer.js +++ b/addons/web/static/src/js/views/graph/graph_renderer.js @@ -462,9 +462,9 @@ return AbstractRenderer.extend({ xAxes: [{ type: 'category', scaleLabel: { - display: this.state.groupBy.length && !this.isEmbedded, - labelString: this.state.groupBy.length ? - this.fields[this.state.groupBy[0].split(':')[0]].string : '', + display: this.state.processedGroupBy.length && !this.isEmbedded, + labelString: this.state.processedGroupBy.length ? + this.fields[this.state.processedGroupBy[0].split(':')[0]].string : '', }, ticks: { // don't use bind: callback is called with 'index' as second parameter @@ -506,14 +506,14 @@ return AbstractRenderer.extend({ var boxColor; if (this.state.mode === 'bar') { label = this._relabelling(label, dataset.originIndex); - if (this.state.groupBy.length > 1 || this.state.origins.length > 1) { + if (this.state.processedGroupBy.length > 1 || this.state.origins.length > 1) { label = label + "/" + dataset.label; } value = this._formatValue(item.yLabel); boxColor = dataset.backgroundColor; } else if (this.state.mode === 'line') { label = this._relabelling(label, dataset.originIndex); - if (this.state.groupBy.length > 1 || this.state.origins.length > 1) { + if (this.state.processedGroupBy.length > 1 || this.state.origins.length > 1) { label = label + "/" + dataset.label; } value = this._formatValue(item.yLabel); @@ -811,7 +811,7 @@ return AbstractRenderer.extend({ // prepare data var data = this._prepareData(dataPoints); data.datasets.forEach(function (dataset, index) { - if (self.state.groupBy.length <= 1 && self.state.origins.length > 1) { + if (self.state.processedGroupBy.length <= 1 && self.state.origins.length > 1) { if (dataset.originIndex === 0) { dataset.fill = 'origin'; dataset.backgroundColor = hexToRGBA(COLORS[0], 0.4); |
