Chart updates

This commit is contained in:
Bahadır Sofuoğlu
2022-11-09 12:42:16 +03:00
parent 5f7fda3332
commit 7061044597

View File

@@ -3,7 +3,7 @@ import { ref, watch } from 'vue';
import { useLayoutService } from '@/layout/composables/layoutService'; import { useLayoutService } from '@/layout/composables/layoutService';
const { layoutConfig } = useLayoutService(); const { layoutConfig } = useLayoutService();
const documentStyle = getComputedStyle(document.documentElement); let documentStyle = getComputedStyle(document.documentElement);
let textColor = documentStyle.getPropertyValue('--text-color'); let textColor = documentStyle.getPropertyValue('--text-color');
let textColorSecondary = documentStyle.getPropertyValue('--text-color-secondary'); let textColorSecondary = documentStyle.getPropertyValue('--text-color-secondary');
let surfaceBorder = documentStyle.getPropertyValue('--surface-border'); let surfaceBorder = documentStyle.getPropertyValue('--surface-border');
@@ -21,13 +21,13 @@ const barOptions = ref(null);
const radarOptions = ref(null); const radarOptions = ref(null);
const setColorOptions = () => { const setColorOptions = () => {
documentStyle = getComputedStyle(document.documentElement);
textColor = documentStyle.getPropertyValue('--text-color'); textColor = documentStyle.getPropertyValue('--text-color');
textColorSecondary = documentStyle.getPropertyValue('--text-color-secondary'); textColorSecondary = documentStyle.getPropertyValue('--text-color-secondary');
surfaceBorder = documentStyle.getPropertyValue('--surface-border'); surfaceBorder = documentStyle.getPropertyValue('--surface-border');
}; };
const setChart = () => { const setChart = () => {
setColorOptions();
barData.value = { barData.value = {
labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July'], labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July'],
datasets: [ datasets: [
@@ -226,8 +226,9 @@ watch(
layoutConfig.theme, layoutConfig.theme,
() => { () => {
setTimeout(() => { setTimeout(() => {
setColorOptions();
setChart(); setChart();
}, 100); }, 200);
}, },
{ immediate: true } { immediate: true }
); );