From 44081515b4ac27c038cda3a935ee99de22850c31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tu=C4=9F=C3=A7e=20K=C3=BC=C3=A7=C3=BCko=C4=9Flu?= Date: Tue, 17 Oct 2023 17:07:23 +0300 Subject: [PATCH] Chart stackblitz demo updates --- doc/chart/DoughnutDoc.vue | 37 ++++++++++++++++++++++-- doc/chart/HorizontalBarDoc.vue | 4 +-- doc/chart/PieChartDoc.vue | 53 ++++++++++++++++++++++------------ doc/chart/VerticalBarDoc.vue | 4 +-- 4 files changed, 73 insertions(+), 25 deletions(-) diff --git a/doc/chart/DoughnutDoc.vue b/doc/chart/DoughnutDoc.vue index ba6b87a3f..4263b2bcf 100644 --- a/doc/chart/DoughnutDoc.vue +++ b/doc/chart/DoughnutDoc.vue @@ -39,6 +39,7 @@ export default { }, mounted() { this.chartData = this.setChartData(); + this.chartOptions = this.setChartOptions(); }, methods: { setChartData() { @@ -54,6 +55,21 @@ export default { } ] }; + }, + setChartOptions() { + const documentStyle = getComputedStyle(document.documentElement); + const textColor = documentStyle.getPropertyValue('--text-color'); + + return { + plugins: { + legend: { + labels: { + cutout: '60%', + color: textColor + } + } + } + }; } } }; @@ -71,12 +87,11 @@ import { ref, onMounted } from "vue"; onMounted(() => { chartData.value = setChartData(); + chartOptions.value = setChartOptions(); }); const chartData = ref(); -const chartOptions = ref({ - cutout: '60%' -}); +const chartOptions = ref(null); const setChartData = () => { const documentStyle = getComputedStyle(document.body); @@ -92,6 +107,22 @@ const setChartData = () => { ] }; }; + +const setChartOptions = () => { + const documentStyle = getComputedStyle(document.documentElement); + const textColor = documentStyle.getPropertyValue('--text-color'); + + return { + plugins: { + legend: { + labels: { + cutout: '60%', + color: textColor + } + } + } + }; +}; <\/script> ` } diff --git a/doc/chart/HorizontalBarDoc.vue b/doc/chart/HorizontalBarDoc.vue index 00c625ab9..a914a756c 100644 --- a/doc/chart/HorizontalBarDoc.vue +++ b/doc/chart/HorizontalBarDoc.vue @@ -74,7 +74,7 @@ export default { plugins: { legend: { labels: { - fontColor: textColor + color: textColor } } }, @@ -159,7 +159,7 @@ const setChartOptions = () => { plugins: { legend: { labels: { - fontColor: textColor + color: textColor } } }, diff --git a/doc/chart/PieChartDoc.vue b/doc/chart/PieChartDoc.vue index cead9e0f9..4bb9d557a 100644 --- a/doc/chart/PieChartDoc.vue +++ b/doc/chart/PieChartDoc.vue @@ -32,19 +32,12 @@ export default { data() { return { chartData: null, - chartOptions: { - plugins: { - legend: { - labels: { - usePointStyle: true - } - } - } - } + chartOptions: null }; }, mounted() { this.chartData = this.setChartData(); + this.chartOptions = this.setChartOptions(); }, methods: { setChartData() { @@ -60,6 +53,21 @@ export default { } ] }; + }, + setChartOptions() { + const documentStyle = getComputedStyle(document.documentElement); + const textColor = documentStyle.getPropertyValue('--text-color'); + + return { + plugins: { + legend: { + labels: { + usePointStyle: true, + color: textColor + } + } + } + }; } } }; @@ -77,18 +85,11 @@ import { ref, onMounted } from "vue"; onMounted(() => { chartData.value = setChartData(); + chartOptions.value = setChartOptions(); }); const chartData = ref(); -const chartOptions = ref({ - plugins: { - legend: { - labels: { - usePointStyle: true - } - } - } -}); +const chartOptions = ref(); const setChartData = () => { const documentStyle = getComputedStyle(document.body); @@ -104,6 +105,22 @@ const setChartData = () => { ] }; }; + +const setChartOptions = () => { + const documentStyle = getComputedStyle(document.documentElement); + const textColor = documentStyle.getPropertyValue('--text-color'); + + return { + plugins: { + legend: { + labels: { + usePointStyle: true, + color: textColor + } + } + } + }; +}; <\/script> ` } diff --git a/doc/chart/VerticalBarDoc.vue b/doc/chart/VerticalBarDoc.vue index 72f9bca95..3c53b8a86 100644 --- a/doc/chart/VerticalBarDoc.vue +++ b/doc/chart/VerticalBarDoc.vue @@ -73,7 +73,7 @@ export default { plugins: { legend: { labels: { - fontColor: textColor + color: textColor } } }, @@ -157,7 +157,7 @@ const setChartOptions = () => { plugins: { legend: { labels: { - fontColor: textColor + color: textColor } } },