Commit da2a9bc0 authored by Kenzo-Hugo Hillion's avatar Kenzo-Hugo Hillion
Browse files

add dynamic label for hide fields

parent 75246de9
Pipeline #19261 passed with stages
in 2 minutes and 10 seconds
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
:items="this.labels" :items="this.labels"
attach attach
chips chips
label="Hide fields" :label="hideLabelsLabel"
multiple multiple
></v-select> ></v-select>
</v-flex> </v-flex>
...@@ -43,6 +43,17 @@ export default { ...@@ -43,6 +43,17 @@ export default {
required: true, required: true,
}, },
}, },
data() {
return {
myChart: {},
options: {},
colors: [],
chartId: "myChart",
displayLegend: true,
labels: [],
hideLabels: [],
}
},
watch: { watch: {
doughnutData(val) { doughnutData(val) {
this.updateChart(); this.updateChart();
...@@ -54,16 +65,14 @@ export default { ...@@ -54,16 +65,14 @@ export default {
this.updateChartData(); this.updateChartData();
} }
}, },
data() { computed: {
return { hideLabelsLabel() {
myChart: {}, if (Object.entries(this.doughnutData).length == 0) {
options: {}, return "Hide fields";
colors: [], } else {
chartId: "myChart", return "Hide " + this.doughnutData.level;
displayLegend: true, }
labels: [], },
hideLabels: [],
}
}, },
mounted() { mounted() {
this.createChart(this.chartId); this.createChart(this.chartId);
...@@ -84,13 +93,13 @@ export default { ...@@ -84,13 +93,13 @@ export default {
this.updateChartOptions(); this.updateChartOptions();
this.updateChartData(); this.updateChartData();
}, },
generateColorList() { generateColorList() { // # TODO get out of this and refactor -> return list of colors
this.color = []; this.color = [];
for (var i = 0; i<Object.keys(this.doughnutData.data).length; i++) { for (var i = 0; i<Object.keys(this.doughnutData.data).length; i++) {
this.colors.push(this.generateColor()) this.colors.push(this.generateColor())
} }
}, },
generateColor() { generateColor() { // Same as above
var letters = '0123456789ABCDEF'; var letters = '0123456789ABCDEF';
var color = '#'; var color = '#';
for (var i = 0; i < 6; i++) { for (var i = 0; i < 6; i++) {
......
Supports Markdown
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