diff --git a/packages/modules/web_themes/koala/source/src/components/charts/historyChart/HistoryChart.vue b/packages/modules/web_themes/koala/source/src/components/charts/historyChart/HistoryChart.vue index 833a2db61a..0c47460a5a 100644 --- a/packages/modules/web_themes/koala/source/src/components/charts/historyChart/HistoryChart.vue +++ b/packages/modules/web_themes/koala/source/src/components/charts/historyChart/HistoryChart.vue @@ -9,7 +9,7 @@ /> @@ -31,10 +31,6 @@ import { TimeScale, Tooltip, Filler, - ChartEvent, - LegendItem, - LegendElement, - ChartTypeRegistry, ChartDataset, ChartType, } from 'chart.js'; @@ -69,10 +65,6 @@ const props = defineProps<{ const chartRef = ref(null); -const legendLarge = computed(() => - lineChartData?.value?.datasets.length > 15 ? true : false, -); - const applyHiddenDatasetsToChart = ( chart: Chart, ): void => { @@ -125,6 +117,7 @@ const chartRange = computed( const chargePointDatasets = computed(() => chargePointIds.value.map((cpId) => ({ label: `${chargePointNames.value(cpId)}`, + category: 'chargepoint', unit: 'kW', borderColor: '#4766b5', backgroundColor: 'rgba(71, 102, 181, 0.2)', @@ -148,6 +141,7 @@ const vehicleDatasets = computed(() => if (selectedData.value.some((item) => socKey in item)) { return { label: `${vehicle.name} SoC`, + category: 'vehicle', unit: '%', borderColor: '#9F8AFF', borderWidth: 2, @@ -175,6 +169,7 @@ const lineChartData = computed(() => { datasets: [ { label: gridMeterName.value, + category: 'component', unit: 'kW', borderColor: '#a33c42', backgroundColor: 'rgba(239,182,188, 0.2)', @@ -191,6 +186,7 @@ const lineChartData = computed(() => { }, { label: 'Hausverbrauch', + category: 'component', unit: 'kW', borderColor: '#949aa1', backgroundColor: 'rgba(148, 154, 161, 0.2)', @@ -207,6 +203,7 @@ const lineChartData = computed(() => { }, { label: 'PV ges.', + category: 'component', unit: 'kW', borderColor: 'green', backgroundColor: 'rgba(144, 238, 144, 0.2)', @@ -223,6 +220,7 @@ const lineChartData = computed(() => { }, { label: 'Speicher ges.', + category: 'component', unit: 'kW', borderColor: '#b5a647', backgroundColor: 'rgba(181, 166, 71, 0.2)', @@ -239,6 +237,7 @@ const lineChartData = computed(() => { }, { label: 'Speicher SoC', + category: 'component', unit: '%', borderColor: '#FFB96E', borderWidth: 2, @@ -265,33 +264,7 @@ const chartOptions = computed>(() => ({ animation: false, plugins: { legend: { - display: !legendLarge.value && legendDisplay.value, - fullSize: true, - align: 'center' as const, - position: 'bottom' as const, - labels: { - boxWidth: 19, - boxHeight: 0.1, - }, - onClick: ( - e: ChartEvent, - legendItem: LegendItem, - legend: LegendElement, - ) => { - const index = legendItem.datasetIndex!; - const chartInstance = legend.chart; - const datasetName = legendItem.text; - - // Toggle visibility using the store - localDataStore.toggleDataset(datasetName); - - // Update chart visibility - if (localDataStore.isDatasetHidden(datasetName)) { - chartInstance.hide(index); - } else { - chartInstance.show(index); - } - }, + display: false, }, tooltip: { mode: 'index' as const, diff --git a/packages/modules/web_themes/koala/source/src/components/charts/historyChart/HistoryChartLegend.vue b/packages/modules/web_themes/koala/source/src/components/charts/historyChart/HistoryChartLegend.vue index 393509c390..d822f066b3 100644 --- a/packages/modules/web_themes/koala/source/src/components/charts/historyChart/HistoryChartLegend.vue +++ b/packages/modules/web_themes/koala/source/src/components/charts/historyChart/HistoryChartLegend.vue @@ -1,47 +1,58 @@ - - diff --git a/packages/modules/web_themes/koala/source/src/components/charts/historyChart/HistoryChartLegendCategoriesGroup.vue b/packages/modules/web_themes/koala/source/src/components/charts/historyChart/HistoryChartLegendCategoriesGroup.vue new file mode 100644 index 0000000000..2215427764 --- /dev/null +++ b/packages/modules/web_themes/koala/source/src/components/charts/historyChart/HistoryChartLegendCategoriesGroup.vue @@ -0,0 +1,47 @@ + + + diff --git a/packages/modules/web_themes/koala/source/src/components/charts/historyChart/HistoryChartLegendCategory.vue b/packages/modules/web_themes/koala/source/src/components/charts/historyChart/HistoryChartLegendCategory.vue new file mode 100644 index 0000000000..65a9ad58d1 --- /dev/null +++ b/packages/modules/web_themes/koala/source/src/components/charts/historyChart/HistoryChartLegendCategory.vue @@ -0,0 +1,87 @@ + + + + + diff --git a/packages/modules/web_themes/koala/source/src/components/charts/historyChart/HistoryChartLegendStandard.vue b/packages/modules/web_themes/koala/source/src/components/charts/historyChart/HistoryChartLegendStandard.vue new file mode 100644 index 0000000000..4930b478ee --- /dev/null +++ b/packages/modules/web_themes/koala/source/src/components/charts/historyChart/HistoryChartLegendStandard.vue @@ -0,0 +1,83 @@ + + + + + diff --git a/packages/modules/web_themes/koala/source/src/components/charts/historyChart/history-chart-model.ts b/packages/modules/web_themes/koala/source/src/components/charts/historyChart/history-chart-model.ts index efacd28589..a2cf9c928b 100644 --- a/packages/modules/web_themes/koala/source/src/components/charts/historyChart/history-chart-model.ts +++ b/packages/modules/web_themes/koala/source/src/components/charts/historyChart/history-chart-model.ts @@ -1,4 +1,5 @@ -import { TooltipItem, Chart } from 'chart.js'; // Importieren des TooltipItem-Typs +import type { Chart, TooltipItem, ChartDataset, LegendItem } from 'chart.js'; + export interface HistoryChartTooltipItem extends TooltipItem<'line'> { dataset: TooltipItem<'line'>['dataset'] & { unit?: string; @@ -9,3 +10,16 @@ export interface HistoryChartTooltipItem extends TooltipItem<'line'> { export interface ChartComponentRef { chart?: Chart; } + +export type Category = 'chargepoint' | 'vehicle' | 'battery' | 'component'; + +// Add category to the chart datasets +export interface CategorizedDataset + extends ChartDataset<'line', { x: number; y: number }> { + category: Category; +} + +// Add category to the legendItem +export interface LegendItemWithCategory extends LegendItem { + category?: Category; +} diff --git a/packages/modules/web_themes/koala/source/src/css/quasar.variables.scss b/packages/modules/web_themes/koala/source/src/css/quasar.variables.scss index 57aa50cd25..f2ccdc87b6 100644 --- a/packages/modules/web_themes/koala/source/src/css/quasar.variables.scss +++ b/packages/modules/web_themes/koala/source/src/css/quasar.variables.scss @@ -192,6 +192,12 @@ $battery: #ba7128; } } + // Scrollbar styling für .q-list auto Light Theme + .q-list { + scrollbar-width: thin; + scrollbar-color: var(--q-primary) var(--q-background-2); + } + //table padding .q-table th, .q-table td { @@ -400,4 +406,10 @@ $dark-tab-icon: #d7d9e0; .q-scrollarea { border: 1px solid var(--q-secondary) !important; } + + //Scrollbar styling für .q-list - Dark Theme + .q-list { + scrollbar-width: thin; + scrollbar-color: var(--q-primary) var(--q-list); + } }