Commit a1749c7a authored by Clement Ho's avatar Clement Ho

Merge branch 'pravi/gitlab-update-d3' into 'master'

Update d3 node module 4.13 -> 5.12

Closes #33944

See merge request gitlab-org/gitlab!20627
parents 722c4463 49dd4a57
...@@ -124,9 +124,7 @@ export default { ...@@ -124,9 +124,7 @@ export default {
}, },
}, },
mounted() { mounted() {
if (!this.allValuesEmpty) { this.draw();
this.draw();
}
}, },
methods: { methods: {
draw() { draw() {
...@@ -153,7 +151,14 @@ export default { ...@@ -153,7 +151,14 @@ export default {
this.yScale = d3.scaleLinear().rangeRound([this.vbHeight, 0]); this.yScale = d3.scaleLinear().rangeRound([this.vbHeight, 0]);
this.xScale.domain(this.graphData.map(d => d.name)); this.xScale.domain(this.graphData.map(d => d.name));
this.yScale.domain([0, d3.max(this.graphData.map(d => d.value))]); /*
If we have all-zero graph we want graph to center 0 on axis and not to draw
any kind of ticks on Y axis. Infinity allows us to do that.
See https://gitlab.com/gitlab-org/gitlab/merge_requests/20627#note_251484582
for detailed explanation
*/
this.yScale.domain([0, d3.max(this.graphData.map(d => d.value)) || Infinity]);
// Zoom/Panning Function // Zoom/Panning Function
this.zoom = d3 this.zoom = d3
......
---
title: Update d3 to 5.12
merge_request: 20627
author: Praveen Arimbrathodiyil
type: other
...@@ -66,7 +66,7 @@ ...@@ -66,7 +66,7 @@
"core-js": "^3.2.1", "core-js": "^3.2.1",
"cropper": "^2.3.0", "cropper": "^2.3.0",
"css-loader": "^1.0.0", "css-loader": "^1.0.0",
"d3": "^4.13.0", "d3": "^5.12.0",
"d3-scale": "^1.0.7", "d3-scale": "^1.0.7",
"d3-selection": "^1.2.0", "d3-selection": "^1.2.0",
"dateformat": "^3.0.3", "dateformat": "^3.0.3",
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment