overview-components 1.1.161 → 1.1.165
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/generated/locales/de.js +269 -0
- package/dist/assets/generated/locales/de.js.map +1 -0
- package/dist/assets/generated/locales/en.js +269 -0
- package/dist/assets/generated/locales/en.js.map +1 -0
- package/dist/assets/generated/locales/fr.js +269 -0
- package/dist/assets/generated/locales/fr.js.map +1 -0
- package/dist/assets/generated/locales/hr.js +269 -0
- package/dist/assets/generated/locales/hr.js.map +1 -0
- package/dist/assets/generated/locales/it.js +269 -0
- package/dist/assets/generated/locales/it.js.map +1 -0
- package/dist/assets/generated/locales/pl.js +269 -0
- package/dist/assets/generated/locales/pl.js.map +1 -0
- package/dist/assets/generated/locales/ro.js +269 -0
- package/dist/assets/generated/locales/ro.js.map +1 -0
- package/dist/assets/generated/locales/sk.js +269 -0
- package/dist/assets/generated/locales/sk.js.map +1 -0
- package/dist/assets/generated/locales/sr.js +269 -0
- package/dist/assets/generated/locales/sr.js.map +1 -0
- package/dist/assets/icons/iconGlyphs.js +691 -0
- package/dist/assets/icons/iconGlyphs.js.map +1 -0
- package/dist/assets/illustration/aichatbot-illustration.js +144 -0
- package/dist/assets/illustration/aichatbot-illustration.js.map +1 -0
- package/dist/assets/illustration/delete-illustration.js +88 -0
- package/dist/assets/illustration/delete-illustration.js.map +1 -0
- package/dist/assets/illustration/no-content.js +159 -0
- package/dist/assets/illustration/no-content.js.map +1 -0
- package/dist/assets/illustration/no-preview.js +125 -0
- package/dist/assets/illustration/no-preview.js.map +1 -0
- package/dist/assets/illustration/not-found.js +98 -0
- package/dist/assets/illustration/not-found.js.map +1 -0
- package/dist/assets/illustration/settings-illustration.js +168 -0
- package/dist/assets/illustration/settings-illustration.js.map +1 -0
- package/dist/components/components-settings/attachments-tab-settings.js +318 -0
- package/dist/components/components-settings/attachments-tab-settings.js.map +1 -0
- package/dist/components/components-settings/data-grid-settings.js +553 -0
- package/dist/components/components-settings/data-grid-settings.js.map +1 -0
- package/dist/components/components-settings/section-tab-settings.js +719 -0
- package/dist/components/components-settings/section-tab-settings.js.map +1 -0
- package/dist/components/components-settings/tabs-overview-settings.js +421 -0
- package/dist/components/components-settings/tabs-overview-settings.js.map +1 -0
- package/dist/components/index.js +30 -0
- package/dist/components/index.js.map +1 -0
- package/dist/components/lit-ai-filter-assistant.js +443 -0
- package/dist/components/lit-ai-filter-assistant.js.map +1 -0
- package/dist/components/lit-attachments-tab.js +2044 -0
- package/dist/components/lit-attachments-tab.js.map +1 -0
- package/dist/components/lit-badge.js +124 -0
- package/dist/components/lit-badge.js.map +1 -0
- package/dist/components/lit-case-variables-tab.d.ts +2 -0
- package/dist/components/lit-case-variables-tab.d.ts.map +1 -1
- package/dist/components/lit-case-variables-tab.js +3763 -0
- package/dist/components/lit-case-variables-tab.js.map +1 -0
- package/dist/components/lit-chart.js +727 -0
- package/dist/components/lit-chart.js.map +1 -0
- package/dist/components/lit-data-grid-tanstack.js +2550 -0
- package/dist/components/lit-data-grid-tanstack.js.map +1 -0
- package/dist/components/lit-filter-builder.js +701 -0
- package/dist/components/lit-filter-builder.js.map +1 -0
- package/dist/components/lit-filter-modal.js +349 -0
- package/dist/components/lit-filter-modal.js.map +1 -0
- package/dist/components/lit-multiselect-item.js +707 -0
- package/dist/components/lit-multiselect-item.js.map +1 -0
- package/dist/components/lit-section-tab.js +268 -0
- package/dist/components/lit-section-tab.js.map +1 -0
- package/dist/components/lit-tabs-overview.js +356 -0
- package/dist/components/lit-tabs-overview.js.map +1 -0
- package/dist/components/modals/lit-confirm-modal.js +121 -0
- package/dist/components/modals/lit-confirm-modal.js.map +1 -0
- package/dist/components/modals/lit-delete-modal.js +131 -0
- package/dist/components/modals/lit-delete-modal.js.map +1 -0
- package/dist/components/react-wrappers/ai-filter-assistant.js +9 -0
- package/dist/components/react-wrappers/ai-filter-assistant.js.map +1 -0
- package/dist/components/react-wrappers/attachments-tab.js +9 -0
- package/dist/components/react-wrappers/attachments-tab.js.map +1 -0
- package/dist/components/react-wrappers/badge.js +9 -0
- package/dist/components/react-wrappers/badge.js.map +1 -0
- package/dist/components/react-wrappers/button.js +9 -0
- package/dist/components/react-wrappers/button.js.map +1 -0
- package/dist/components/react-wrappers/calendar.js +9 -0
- package/dist/components/react-wrappers/calendar.js.map +1 -0
- package/dist/components/react-wrappers/case-variables-tab.js +9 -0
- package/dist/components/react-wrappers/case-variables-tab.js.map +1 -0
- package/dist/components/react-wrappers/chart.js +9 -0
- package/dist/components/react-wrappers/chart.js.map +1 -0
- package/dist/components/react-wrappers/data-grid-tanstack.js +9 -0
- package/dist/components/react-wrappers/data-grid-tanstack.js.map +1 -0
- package/dist/components/react-wrappers/filter-builder.js +12 -0
- package/dist/components/react-wrappers/filter-builder.js.map +1 -0
- package/dist/components/react-wrappers/filter-modal.js +9 -0
- package/dist/components/react-wrappers/filter-modal.js.map +1 -0
- package/dist/components/react-wrappers/index.js +27 -0
- package/dist/components/react-wrappers/index.js.map +1 -0
- package/dist/components/react-wrappers/progress-bar.js +9 -0
- package/dist/components/react-wrappers/progress-bar.js.map +1 -0
- package/dist/components/react-wrappers/section-tab.js +9 -0
- package/dist/components/react-wrappers/section-tab.js.map +1 -0
- package/dist/components/react-wrappers/tabs-overview.js +9 -0
- package/dist/components/react-wrappers/tabs-overview.js.map +1 -0
- package/dist/data/translations.js +2768 -0
- package/dist/data/translations.js.map +1 -0
- package/dist/index.js +7 -19890
- package/dist/index.js.map +1 -0
- package/dist/schemas/index.js +18 -0
- package/dist/schemas/index.js.map +1 -0
- package/dist/schemas/lit-attachments-tab-document.schema.js +39 -0
- package/dist/schemas/lit-attachments-tab-document.schema.js.map +1 -0
- package/dist/schemas/lit-attachments-tab-settings-value.schema.js +30 -0
- package/dist/schemas/lit-attachments-tab-settings-value.schema.js.map +1 -0
- package/dist/schemas/lit-attachments-tab.schema.js +68 -0
- package/dist/schemas/lit-attachments-tab.schema.js.map +1 -0
- package/dist/schemas/lit-case-variables-tab-cell.schema.d.ts +3 -0
- package/dist/schemas/lit-case-variables-tab-cell.schema.d.ts.map +1 -1
- package/dist/schemas/lit-case-variables-tab-cell.schema.js +226 -0
- package/dist/schemas/lit-case-variables-tab-cell.schema.js.map +1 -0
- package/dist/schemas/lit-case-variables-tab-rows.schema.d.ts +3 -0
- package/dist/schemas/lit-case-variables-tab-rows.schema.d.ts.map +1 -1
- package/dist/schemas/lit-case-variables-tab-rows.schema.js +6 -0
- package/dist/schemas/lit-case-variables-tab-rows.schema.js.map +1 -0
- package/dist/schemas/lit-case-variables-tab.schema.d.ts +6 -0
- package/dist/schemas/lit-case-variables-tab.schema.d.ts.map +1 -1
- package/dist/schemas/lit-case-variables-tab.schema.js +27 -0
- package/dist/schemas/lit-case-variables-tab.schema.js.map +1 -0
- package/dist/schemas/lit-data-grid-tanstack-column-array.schema.js +6 -0
- package/dist/schemas/lit-data-grid-tanstack-column-array.schema.js.map +1 -0
- package/dist/schemas/lit-data-grid-tanstack-column-custom-filter-array.schema.js +6 -0
- package/dist/schemas/lit-data-grid-tanstack-column-custom-filter-array.schema.js.map +1 -0
- package/dist/schemas/lit-data-grid-tanstack-column-custom-filter.schema.js +11 -0
- package/dist/schemas/lit-data-grid-tanstack-column-custom-filter.schema.js.map +1 -0
- package/dist/schemas/lit-data-grid-tanstack-column.schema.js +79 -0
- package/dist/schemas/lit-data-grid-tanstack-column.schema.js.map +1 -0
- package/dist/schemas/lit-data-grid-tanstack.schema.js +108 -0
- package/dist/schemas/lit-data-grid-tanstack.schema.js.map +1 -0
- package/dist/schemas/lit-filter-builder.schema.js +61 -0
- package/dist/schemas/lit-filter-builder.schema.js.map +1 -0
- package/dist/schemas/lit-section-tab-schema.js +37 -0
- package/dist/schemas/lit-section-tab-schema.js.map +1 -0
- package/dist/schemas/lit-tabs-overview-tab-array.schema.js +6 -0
- package/dist/schemas/lit-tabs-overview-tab-array.schema.js.map +1 -0
- package/dist/schemas/lit-tabs-overview-tab.schema.js +32 -0
- package/dist/schemas/lit-tabs-overview-tab.schema.js.map +1 -0
- package/dist/schemas/lit-tabs-overview.schema.js +29 -0
- package/dist/schemas/lit-tabs-overview.schema.js.map +1 -0
- package/dist/scripts/translate-locales.js +241 -0
- package/dist/scripts/translate-locales.js.map +1 -0
- package/dist/shared/filter-inputs.js +429 -0
- package/dist/shared/filter-inputs.js.map +1 -0
- package/dist/shared/index.js +40 -0
- package/dist/shared/index.js.map +1 -0
- package/dist/shared/lit-button.js +159 -0
- package/dist/shared/lit-button.js.map +1 -0
- package/dist/shared/lit-calendar.js +485 -0
- package/dist/shared/lit-calendar.js.map +1 -0
- package/dist/shared/lit-case-variables-tab-cell.d.ts +2 -0
- package/dist/shared/lit-case-variables-tab-cell.d.ts.map +1 -1
- package/dist/shared/lit-case-variables-tab-cell.js +235 -0
- package/dist/shared/lit-case-variables-tab-cell.js.map +1 -0
- package/dist/shared/lit-checkbox.js +184 -0
- package/dist/shared/lit-checkbox.js.map +1 -0
- package/dist/shared/lit-custom-popper.js +116 -0
- package/dist/shared/lit-custom-popper.js.map +1 -0
- package/dist/shared/lit-data-grid-action-buttons-popover.js +295 -0
- package/dist/shared/lit-data-grid-action-buttons-popover.js.map +1 -0
- package/dist/shared/lit-data-grid-density-popover.js +84 -0
- package/dist/shared/lit-data-grid-density-popover.js.map +1 -0
- package/dist/shared/lit-data-grid-export-popover.js +68 -0
- package/dist/shared/lit-data-grid-export-popover.js.map +1 -0
- package/dist/shared/lit-data-grid-operators-popover.js +114 -0
- package/dist/shared/lit-data-grid-operators-popover.js.map +1 -0
- package/dist/shared/lit-data-grid-row-actions.js +87 -0
- package/dist/shared/lit-data-grid-row-actions.js.map +1 -0
- package/dist/shared/lit-date-picker.js +608 -0
- package/dist/shared/lit-date-picker.js.map +1 -0
- package/dist/shared/lit-document-thumbnail.js +383 -0
- package/dist/shared/lit-document-thumbnail.js.map +1 -0
- package/dist/shared/lit-filter-input.js +115 -0
- package/dist/shared/lit-filter-input.js.map +1 -0
- package/dist/shared/lit-icon-button.js +165 -0
- package/dist/shared/lit-icon-button.js.map +1 -0
- package/dist/shared/lit-icon.d.ts.map +1 -1
- package/dist/shared/lit-icon.js +337 -0
- package/dist/shared/lit-icon.js.map +1 -0
- package/dist/shared/lit-input.js +282 -0
- package/dist/shared/lit-input.js.map +1 -0
- package/dist/shared/lit-label.js +103 -0
- package/dist/shared/lit-label.js.map +1 -0
- package/dist/shared/lit-loader.js +68 -0
- package/dist/shared/lit-loader.js.map +1 -0
- package/dist/shared/lit-loading-bar.js +91 -0
- package/dist/shared/lit-loading-bar.js.map +1 -0
- package/dist/shared/lit-menu-item.js +98 -0
- package/dist/shared/lit-menu-item.js.map +1 -0
- package/dist/shared/lit-menu.js +29 -0
- package/dist/shared/lit-menu.js.map +1 -0
- package/dist/shared/lit-modal-body.js +24 -0
- package/dist/shared/lit-modal-body.js.map +1 -0
- package/dist/shared/lit-modal-footer.js +21 -0
- package/dist/shared/lit-modal-footer.js.map +1 -0
- package/dist/shared/lit-modal-header.js +34 -0
- package/dist/shared/lit-modal-header.js.map +1 -0
- package/dist/shared/lit-modal.js +168 -0
- package/dist/shared/lit-modal.js.map +1 -0
- package/dist/shared/lit-overflow-tooltip.js +114 -0
- package/dist/shared/lit-overflow-tooltip.js.map +1 -0
- package/dist/shared/lit-pill.js +87 -0
- package/dist/shared/lit-pill.js.map +1 -0
- package/dist/shared/lit-progress-bar.js +130 -0
- package/dist/shared/lit-progress-bar.js.map +1 -0
- package/dist/shared/lit-responsive-button.js +106 -0
- package/dist/shared/lit-responsive-button.js.map +1 -0
- package/dist/shared/lit-select-field.js +457 -0
- package/dist/shared/lit-select-field.js.map +1 -0
- package/dist/shared/lit-select.js +668 -0
- package/dist/shared/lit-select.js.map +1 -0
- package/dist/shared/lit-settings.js +76 -0
- package/dist/shared/lit-settings.js.map +1 -0
- package/dist/shared/lit-text-field.js +252 -0
- package/dist/shared/lit-text-field.js.map +1 -0
- package/dist/shared/lit-toggle.js +240 -0
- package/dist/shared/lit-toggle.js.map +1 -0
- package/dist/shared/lit-tooltip.js +165 -0
- package/dist/shared/lit-tooltip.js.map +1 -0
- package/dist/shared/simple-popper.js +285 -0
- package/dist/shared/simple-popper.js.map +1 -0
- package/dist/shared/simple-tooltip.js +249 -0
- package/dist/shared/simple-tooltip.js.map +1 -0
- package/dist/shared/styles/button-shared-styles.js +494 -0
- package/dist/shared/styles/button-shared-styles.js.map +1 -0
- package/dist/styles.js +169 -0
- package/dist/styles.js.map +1 -0
- package/dist/utils/custom-filters.js +42 -0
- package/dist/utils/custom-filters.js.map +1 -0
- package/dist/utils/date.js +21 -0
- package/dist/utils/date.js.map +1 -0
- package/dist/utils/file-type-utils.js +55 -0
- package/dist/utils/file-type-utils.js.map +1 -0
- package/dist/utils/formatNumber.js +62 -0
- package/dist/utils/formatNumber.js.map +1 -0
- package/dist/utils/getOperatorByType.js +70 -0
- package/dist/utils/getOperatorByType.js.map +1 -0
- package/dist/utils/getOverviewValue.js +175 -0
- package/dist/utils/getOverviewValue.js.map +1 -0
- package/dist/utils/localization.js +433 -0
- package/dist/utils/localization.js.map +1 -0
- package/dist/utils/pdf-thumbnail-generator.js +91 -0
- package/dist/utils/pdf-thumbnail-generator.js.map +1 -0
- package/dist/utils/utils.js +94 -0
- package/dist/utils/utils.js.map +1 -0
- package/package.json +21 -58
- package/README.md +0 -82
- package/dist/icons.js +0 -692
|
@@ -0,0 +1,727 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { property } from 'lit/decorators.js';
|
|
8
|
+
import { html, css, LitElement } from 'lit';
|
|
9
|
+
import { msg } from '@lit/localize';
|
|
10
|
+
import { Chart, registerables } from 'chart.js';
|
|
11
|
+
import '../shared/lit-loader.js';
|
|
12
|
+
Chart.register(...registerables);
|
|
13
|
+
export class LitChart extends LitElement {
|
|
14
|
+
constructor() {
|
|
15
|
+
super(...arguments);
|
|
16
|
+
this.type = 'bar';
|
|
17
|
+
this.data = { labels: [], datasets: [], title: '' };
|
|
18
|
+
this.isLoading = false;
|
|
19
|
+
this.colorPalette = 'modern';
|
|
20
|
+
this.useGradients = true;
|
|
21
|
+
this.showLegend = true;
|
|
22
|
+
this.chart = null;
|
|
23
|
+
// Modern color palettes
|
|
24
|
+
this.colorPalettes = {
|
|
25
|
+
modern: [
|
|
26
|
+
'#6366f1', // Indigo
|
|
27
|
+
'#8b5cf6', // Purple
|
|
28
|
+
'#ec4899', // Pink
|
|
29
|
+
'#f43f5e', // Rose
|
|
30
|
+
'#f97316', // Orange
|
|
31
|
+
'#eab308', // Yellow
|
|
32
|
+
'#22c55e', // Green
|
|
33
|
+
'#14b8a6', // Teal
|
|
34
|
+
'#06b6d4', // Cyan
|
|
35
|
+
'#3b82f6', // Blue
|
|
36
|
+
],
|
|
37
|
+
vibrant: [
|
|
38
|
+
'#ff6b6b', // Red
|
|
39
|
+
'#4ecdc4', // Turquoise
|
|
40
|
+
'#45b7d1', // Sky Blue
|
|
41
|
+
'#f9ca24', // Yellow
|
|
42
|
+
'#6c5ce7', // Purple
|
|
43
|
+
'#fd79a8', // Pink
|
|
44
|
+
'#00b894', // Green
|
|
45
|
+
'#fdcb6e', // Light Orange
|
|
46
|
+
'#e17055', // Orange
|
|
47
|
+
'#74b9ff', // Light Blue
|
|
48
|
+
],
|
|
49
|
+
pastel: [
|
|
50
|
+
'#a8dadc', // Pale Blue
|
|
51
|
+
'#f1faee', // Cream
|
|
52
|
+
'#e9c46a', // Sand
|
|
53
|
+
'#f4a261', // Peach
|
|
54
|
+
'#e76f51', // Coral
|
|
55
|
+
'#264653', // Dark Blue
|
|
56
|
+
'#2a9d8f', // Teal
|
|
57
|
+
'#e9d8a6', // Light Yellow
|
|
58
|
+
'#ee9b00', // Orange
|
|
59
|
+
'#ca6702', // Dark Orange
|
|
60
|
+
],
|
|
61
|
+
ocean: [
|
|
62
|
+
'#0077b6', // Ocean Blue
|
|
63
|
+
'#00b4d8', // Sky Blue
|
|
64
|
+
'#90e0ef', // Light Blue
|
|
65
|
+
'#caf0f8', // Pale Blue
|
|
66
|
+
'#023e8a', // Deep Blue
|
|
67
|
+
'#48cae4', // Cyan
|
|
68
|
+
'#ade8f4', // Light Cyan
|
|
69
|
+
'#0096c7', // Blue
|
|
70
|
+
'#00b4d8', // Bright Blue
|
|
71
|
+
'#90e0ef', // Light Blue
|
|
72
|
+
],
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
disconnectedCallback() {
|
|
76
|
+
super.disconnectedCallback();
|
|
77
|
+
// Clean up chart when component is removed
|
|
78
|
+
if (this.chart) {
|
|
79
|
+
this.chart.destroy();
|
|
80
|
+
this.chart = null;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
getPrimaryColor() {
|
|
84
|
+
// Get CSS variable from document root
|
|
85
|
+
const cssVar = getComputedStyle(document.documentElement)
|
|
86
|
+
.getPropertyValue('--color-primary-main')
|
|
87
|
+
.trim();
|
|
88
|
+
return cssVar || '#6366f1'; // Fallback if CSS variable is not defined
|
|
89
|
+
}
|
|
90
|
+
updated(changedProperties) {
|
|
91
|
+
if (changedProperties.has('type') ||
|
|
92
|
+
changedProperties.has('data') ||
|
|
93
|
+
changedProperties.has('colorPalette') ||
|
|
94
|
+
changedProperties.has('useGradients') ||
|
|
95
|
+
changedProperties.has('showLegend')) {
|
|
96
|
+
this.renderChart();
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
hexToHSL(hex) {
|
|
100
|
+
// Remove # if present
|
|
101
|
+
hex = hex.replace('#', '');
|
|
102
|
+
// Convert hex to RGB
|
|
103
|
+
const r = parseInt(hex.substring(0, 2), 16) / 255;
|
|
104
|
+
const g = parseInt(hex.substring(2, 4), 16) / 255;
|
|
105
|
+
const b = parseInt(hex.substring(4, 6), 16) / 255;
|
|
106
|
+
const max = Math.max(r, g, b);
|
|
107
|
+
const min = Math.min(r, g, b);
|
|
108
|
+
let h = 0, s = 0;
|
|
109
|
+
const l = (max + min) / 2;
|
|
110
|
+
if (max !== min) {
|
|
111
|
+
const d = max - min;
|
|
112
|
+
s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
|
|
113
|
+
switch (max) {
|
|
114
|
+
case r:
|
|
115
|
+
h = ((g - b) / d + (g < b ? 6 : 0)) / 6;
|
|
116
|
+
break;
|
|
117
|
+
case g:
|
|
118
|
+
h = ((b - r) / d + 2) / 6;
|
|
119
|
+
break;
|
|
120
|
+
case b:
|
|
121
|
+
h = ((r - g) / d + 4) / 6;
|
|
122
|
+
break;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
return { h: h * 360, s: s * 100, l: l * 100 };
|
|
126
|
+
}
|
|
127
|
+
hslToHex(h, s, l) {
|
|
128
|
+
h = h / 360;
|
|
129
|
+
s = s / 100;
|
|
130
|
+
l = l / 100;
|
|
131
|
+
let r, g, b;
|
|
132
|
+
if (s === 0) {
|
|
133
|
+
r = g = b = l;
|
|
134
|
+
}
|
|
135
|
+
else {
|
|
136
|
+
const hue2rgb = (p, q, t) => {
|
|
137
|
+
if (t < 0)
|
|
138
|
+
t += 1;
|
|
139
|
+
if (t > 1)
|
|
140
|
+
t -= 1;
|
|
141
|
+
if (t < 1 / 6)
|
|
142
|
+
return p + (q - p) * 6 * t;
|
|
143
|
+
if (t < 1 / 2)
|
|
144
|
+
return q;
|
|
145
|
+
if (t < 2 / 3)
|
|
146
|
+
return p + (q - p) * (2 / 3 - t) * 6;
|
|
147
|
+
return p;
|
|
148
|
+
};
|
|
149
|
+
const q = l < 0.5 ? l * (1 + s) : l + s - l * s;
|
|
150
|
+
const p = 2 * l - q;
|
|
151
|
+
r = hue2rgb(p, q, h + 1 / 3);
|
|
152
|
+
g = hue2rgb(p, q, h);
|
|
153
|
+
b = hue2rgb(p, q, h - 1 / 3);
|
|
154
|
+
}
|
|
155
|
+
const toHex = (x) => {
|
|
156
|
+
const hex = Math.round(x * 255).toString(16);
|
|
157
|
+
return hex.length === 1 ? '0' + hex : hex;
|
|
158
|
+
};
|
|
159
|
+
return `#${toHex(r)}${toHex(g)}${toHex(b)}`;
|
|
160
|
+
}
|
|
161
|
+
generatePrimaryColorPalette(baseColor, numColors) {
|
|
162
|
+
const hsl = this.hexToHSL(baseColor);
|
|
163
|
+
const colors = [];
|
|
164
|
+
for (let i = 0; i < numColors; i++) {
|
|
165
|
+
// Create variations by adjusting hue and lightness
|
|
166
|
+
const hueShift = (i * 30) % 360; // Shift hue for variety
|
|
167
|
+
const newHue = (hsl.h + hueShift) % 360;
|
|
168
|
+
const lightnessVariation = 50 + (i % 3) * 15; // Vary lightness
|
|
169
|
+
const saturationVariation = Math.max(40, Math.min(90, hsl.s + (i % 2) * 20));
|
|
170
|
+
colors.push(this.hslToHex(newHue, saturationVariation, lightnessVariation));
|
|
171
|
+
}
|
|
172
|
+
return colors;
|
|
173
|
+
}
|
|
174
|
+
generateColors(numColors) {
|
|
175
|
+
if (this.colorPalette === 'primary') {
|
|
176
|
+
return this.generatePrimaryColorPalette(this.getPrimaryColor(), numColors);
|
|
177
|
+
}
|
|
178
|
+
const palette = this.colorPalettes[this.colorPalette];
|
|
179
|
+
return Array.from({ length: numColors }, (_, i) => palette[i % palette.length]);
|
|
180
|
+
}
|
|
181
|
+
createGradient(ctx, color, chartArea, isHorizontal = false) {
|
|
182
|
+
const gradient = isHorizontal
|
|
183
|
+
? ctx.createLinearGradient(chartArea.left, 0, chartArea.right, 0)
|
|
184
|
+
: ctx.createLinearGradient(0, chartArea.top, 0, chartArea.bottom);
|
|
185
|
+
// Convert hex to rgba and create gradient
|
|
186
|
+
const r = parseInt(color.slice(1, 3), 16);
|
|
187
|
+
const g = parseInt(color.slice(3, 5), 16);
|
|
188
|
+
const b = parseInt(color.slice(5, 7), 16);
|
|
189
|
+
gradient.addColorStop(0, `rgba(${r}, ${g}, ${b}, 0.8)`);
|
|
190
|
+
gradient.addColorStop(0.5, `rgba(${r}, ${g}, ${b}, 0.6)`);
|
|
191
|
+
gradient.addColorStop(1, `rgba(${r}, ${g}, ${b}, 0.3)`);
|
|
192
|
+
return gradient;
|
|
193
|
+
}
|
|
194
|
+
createRadialGradient(ctx, color, chartArea) {
|
|
195
|
+
const centerX = (chartArea.left + chartArea.right) / 2;
|
|
196
|
+
const centerY = (chartArea.top + chartArea.bottom) / 2;
|
|
197
|
+
const radius = Math.min((chartArea.right - chartArea.left) / 2, (chartArea.bottom - chartArea.top) / 2);
|
|
198
|
+
const gradient = ctx.createRadialGradient(centerX, centerY, 0, centerX, centerY, radius);
|
|
199
|
+
// Convert hex to rgba and create radial gradient
|
|
200
|
+
const r = parseInt(color.slice(1, 3), 16);
|
|
201
|
+
const g = parseInt(color.slice(3, 5), 16);
|
|
202
|
+
const b = parseInt(color.slice(5, 7), 16);
|
|
203
|
+
gradient.addColorStop(0, `rgba(${r}, ${g}, ${b}, 1)`);
|
|
204
|
+
gradient.addColorStop(0.5, `rgba(${r}, ${g}, ${b}, 0.8)`);
|
|
205
|
+
gradient.addColorStop(1, `rgba(${r}, ${g}, ${b}, 0.6)`);
|
|
206
|
+
return gradient;
|
|
207
|
+
}
|
|
208
|
+
renderChart() {
|
|
209
|
+
const canvas = this.shadowRoot?.querySelector('canvas');
|
|
210
|
+
if (!canvas)
|
|
211
|
+
return;
|
|
212
|
+
if (this.type === 'bar' || this.type === 'line') {
|
|
213
|
+
this.renderBarAndLineChart(canvas);
|
|
214
|
+
}
|
|
215
|
+
else if (this.type === 'bubble') {
|
|
216
|
+
this.renderBubbleChart(canvas);
|
|
217
|
+
}
|
|
218
|
+
else if (this.type === 'pie' || this.type === 'doughnut') {
|
|
219
|
+
this.renderPieAndDoughnutChart(canvas);
|
|
220
|
+
}
|
|
221
|
+
else if (this.type === 'gantt') {
|
|
222
|
+
this.renderGanttChart(canvas);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
renderGanttChart(canvas) {
|
|
226
|
+
if (this.chart)
|
|
227
|
+
this.chart.destroy();
|
|
228
|
+
const colors = this.generateColors(this.data.datasets[0]?.data.length || 0);
|
|
229
|
+
const datasetsWithColors = this.data.datasets.map((dataset, index) => ({
|
|
230
|
+
label: dataset.label || `Dataset ${index + 1}`,
|
|
231
|
+
data: dataset.data.map((entry) => {
|
|
232
|
+
const startDate = new Date(entry.x[0]);
|
|
233
|
+
const endDate = new Date(entry.x[1]);
|
|
234
|
+
return {
|
|
235
|
+
x: [
|
|
236
|
+
isNaN(startDate.getTime()) ? Date.now() : startDate.getTime(),
|
|
237
|
+
isNaN(endDate.getTime()) ? Date.now() : endDate.getTime(),
|
|
238
|
+
],
|
|
239
|
+
y: entry.y,
|
|
240
|
+
};
|
|
241
|
+
}),
|
|
242
|
+
backgroundColor: colors,
|
|
243
|
+
borderColor: colors.map((color) => color),
|
|
244
|
+
borderWidth: 0,
|
|
245
|
+
barThickness: 20,
|
|
246
|
+
borderRadius: 8,
|
|
247
|
+
borderSkipped: false,
|
|
248
|
+
}));
|
|
249
|
+
const allDates = this.data.datasets.flatMap((dataset) => dataset.data.flatMap((entry) => [
|
|
250
|
+
new Date(entry?.x?.[0]).getTime(),
|
|
251
|
+
new Date(entry?.x?.[1]).getTime(),
|
|
252
|
+
]));
|
|
253
|
+
const minDate = Math.min(...allDates);
|
|
254
|
+
const maxDate = Math.max(...allDates);
|
|
255
|
+
// Vypočítanie stepSize pre 20 hodnôt na osi X
|
|
256
|
+
const dateDifference = maxDate - minDate;
|
|
257
|
+
const desiredTicks = 20; // Počet požadovaných hodnôt na osi X
|
|
258
|
+
const stepSize = dateDifference / desiredTicks; // Vypočítanie stepSize
|
|
259
|
+
this.chart = new Chart(canvas, {
|
|
260
|
+
type: 'bar',
|
|
261
|
+
data: {
|
|
262
|
+
datasets: datasetsWithColors,
|
|
263
|
+
},
|
|
264
|
+
options: {
|
|
265
|
+
animation: false,
|
|
266
|
+
indexAxis: 'y',
|
|
267
|
+
responsive: true,
|
|
268
|
+
maintainAspectRatio: false,
|
|
269
|
+
scales: {
|
|
270
|
+
x: {
|
|
271
|
+
type: 'linear',
|
|
272
|
+
ticks: {
|
|
273
|
+
stepSize: stepSize, // 30 dní v milisekundách
|
|
274
|
+
autoSkip: false,
|
|
275
|
+
callback: (value) => {
|
|
276
|
+
return new Date(value).toLocaleDateString('sk-SK', {
|
|
277
|
+
day: '2-digit',
|
|
278
|
+
month: '2-digit',
|
|
279
|
+
year: 'numeric',
|
|
280
|
+
});
|
|
281
|
+
},
|
|
282
|
+
},
|
|
283
|
+
min: minDate,
|
|
284
|
+
max: maxDate,
|
|
285
|
+
title: {
|
|
286
|
+
display: !!this.data.xAxisLabel,
|
|
287
|
+
text: this.data.xAxisLabel || '',
|
|
288
|
+
font: {
|
|
289
|
+
size: 11,
|
|
290
|
+
weight: 400,
|
|
291
|
+
},
|
|
292
|
+
color: 'var(--text-secondary, #111827)',
|
|
293
|
+
},
|
|
294
|
+
},
|
|
295
|
+
y: {
|
|
296
|
+
type: 'category',
|
|
297
|
+
title: {
|
|
298
|
+
display: !!this.data.yAxisLabel,
|
|
299
|
+
text: this.data.yAxisLabel || '',
|
|
300
|
+
font: {
|
|
301
|
+
size: 11,
|
|
302
|
+
weight: 400,
|
|
303
|
+
},
|
|
304
|
+
color: 'var(--text-secondary, #111827)',
|
|
305
|
+
},
|
|
306
|
+
},
|
|
307
|
+
},
|
|
308
|
+
plugins: {
|
|
309
|
+
tooltip: {
|
|
310
|
+
callbacks: {
|
|
311
|
+
label: function (context) {
|
|
312
|
+
const start = new Date(context.raw.x[0]).toLocaleDateString('sk-SK', {
|
|
313
|
+
day: '2-digit',
|
|
314
|
+
month: '2-digit',
|
|
315
|
+
year: 'numeric',
|
|
316
|
+
});
|
|
317
|
+
const end = new Date(context.raw.x[1]).toLocaleDateString('sk-SK', {
|
|
318
|
+
day: '2-digit',
|
|
319
|
+
month: '2-digit',
|
|
320
|
+
year: 'numeric',
|
|
321
|
+
});
|
|
322
|
+
return `\u00A0\u00A0${msg('Začátek')}: ${start}, ${msg('Konec')}: ${end}`;
|
|
323
|
+
},
|
|
324
|
+
},
|
|
325
|
+
bodyFont: {
|
|
326
|
+
size: 13,
|
|
327
|
+
weight: 400,
|
|
328
|
+
},
|
|
329
|
+
displayColors: true,
|
|
330
|
+
usePointStyle: true,
|
|
331
|
+
backgroundColor: 'black',
|
|
332
|
+
cornerRadius: 8,
|
|
333
|
+
},
|
|
334
|
+
legend: {
|
|
335
|
+
display: this.showLegend,
|
|
336
|
+
position: 'top',
|
|
337
|
+
labels: {
|
|
338
|
+
usePointStyle: true,
|
|
339
|
+
pointStyle: 'circle',
|
|
340
|
+
font: {
|
|
341
|
+
size: 13,
|
|
342
|
+
weight: 500,
|
|
343
|
+
},
|
|
344
|
+
},
|
|
345
|
+
},
|
|
346
|
+
title: {
|
|
347
|
+
display: !!this.data.title,
|
|
348
|
+
text: this.data.title, // Text, ktorý sa zobrazí nad grafom
|
|
349
|
+
font: {
|
|
350
|
+
size: 17,
|
|
351
|
+
weight: 500,
|
|
352
|
+
},
|
|
353
|
+
color: 'var(--text-primary, #111827)',
|
|
354
|
+
padding: {
|
|
355
|
+
top: 10,
|
|
356
|
+
bottom: 20,
|
|
357
|
+
},
|
|
358
|
+
},
|
|
359
|
+
},
|
|
360
|
+
onHover: (event, chartElement) => {
|
|
361
|
+
const target = event.native?.target;
|
|
362
|
+
target.style.cursor = chartElement.length ? 'pointer' : 'default';
|
|
363
|
+
},
|
|
364
|
+
},
|
|
365
|
+
});
|
|
366
|
+
}
|
|
367
|
+
renderPieAndDoughnutChart(canvas) {
|
|
368
|
+
if (this.chart)
|
|
369
|
+
this.chart.destroy();
|
|
370
|
+
const colors = this.generateColors(this.data.datasets[0]?.data.length || 0);
|
|
371
|
+
const datasetsWithColors = this.data.datasets.map((dataset) => ({
|
|
372
|
+
...dataset,
|
|
373
|
+
backgroundColor: this.useGradients
|
|
374
|
+
? (context) => {
|
|
375
|
+
const chart = context.chart;
|
|
376
|
+
const { ctx, chartArea } = chart;
|
|
377
|
+
if (!chartArea)
|
|
378
|
+
return colors[context.dataIndex] || colors[0];
|
|
379
|
+
return this.createRadialGradient(ctx, colors[context.dataIndex] || colors[0], chartArea);
|
|
380
|
+
}
|
|
381
|
+
: colors,
|
|
382
|
+
borderColor: '#ffffff',
|
|
383
|
+
borderWidth: 3,
|
|
384
|
+
hoverBorderWidth: 4,
|
|
385
|
+
hoverOffset: 8,
|
|
386
|
+
}));
|
|
387
|
+
this.chart = new Chart(canvas, {
|
|
388
|
+
type: this.type,
|
|
389
|
+
data: {
|
|
390
|
+
labels: this.data.labels,
|
|
391
|
+
datasets: datasetsWithColors,
|
|
392
|
+
},
|
|
393
|
+
options: {
|
|
394
|
+
animation: false,
|
|
395
|
+
responsive: true,
|
|
396
|
+
maintainAspectRatio: false,
|
|
397
|
+
plugins: {
|
|
398
|
+
legend: {
|
|
399
|
+
display: this.showLegend,
|
|
400
|
+
position: 'top',
|
|
401
|
+
labels: {
|
|
402
|
+
usePointStyle: true,
|
|
403
|
+
pointStyle: 'circle',
|
|
404
|
+
font: {
|
|
405
|
+
size: 13,
|
|
406
|
+
weight: 500,
|
|
407
|
+
},
|
|
408
|
+
},
|
|
409
|
+
},
|
|
410
|
+
tooltip: {
|
|
411
|
+
callbacks: {
|
|
412
|
+
title: () => '',
|
|
413
|
+
label: (tooltipItem) => {
|
|
414
|
+
const value = tooltipItem.raw || 0;
|
|
415
|
+
return `\u00A0\u00A0${tooltipItem.label}: ${tooltipItem.raw}`;
|
|
416
|
+
},
|
|
417
|
+
},
|
|
418
|
+
bodyFont: {
|
|
419
|
+
size: 13,
|
|
420
|
+
weight: 400,
|
|
421
|
+
},
|
|
422
|
+
displayColors: true,
|
|
423
|
+
usePointStyle: true, // Použitie kruhového symbolu
|
|
424
|
+
xAlign: 'center',
|
|
425
|
+
yAlign: 'bottom',
|
|
426
|
+
padding: 16,
|
|
427
|
+
backgroundColor: 'black',
|
|
428
|
+
cornerRadius: 8,
|
|
429
|
+
},
|
|
430
|
+
title: {
|
|
431
|
+
display: !!this.data.title,
|
|
432
|
+
text: this.data.title, // Text, ktorý sa zobrazí nad grafom
|
|
433
|
+
font: {
|
|
434
|
+
size: 17,
|
|
435
|
+
weight: 500,
|
|
436
|
+
},
|
|
437
|
+
color: 'var(--text-primary, #111827)',
|
|
438
|
+
padding: {
|
|
439
|
+
top: 10,
|
|
440
|
+
bottom: 20,
|
|
441
|
+
},
|
|
442
|
+
},
|
|
443
|
+
},
|
|
444
|
+
...(this.type === 'doughnut' && {
|
|
445
|
+
cutout: '70%',
|
|
446
|
+
}),
|
|
447
|
+
onHover: (event, chartElement) => {
|
|
448
|
+
const target = event.native?.target;
|
|
449
|
+
if (chartElement.length) {
|
|
450
|
+
target.style.cursor = 'pointer'; // Zmena kurzora na ruku
|
|
451
|
+
}
|
|
452
|
+
else {
|
|
453
|
+
target.style.cursor = 'default';
|
|
454
|
+
}
|
|
455
|
+
},
|
|
456
|
+
},
|
|
457
|
+
});
|
|
458
|
+
}
|
|
459
|
+
renderBubbleChart(canvas) {
|
|
460
|
+
if (this.chart)
|
|
461
|
+
this.chart.destroy();
|
|
462
|
+
const colors = this.generateColors(this.data.datasets.length);
|
|
463
|
+
const datasets = this.data.datasets.map((dataset, index) => ({
|
|
464
|
+
...dataset,
|
|
465
|
+
backgroundColor: this.useGradients
|
|
466
|
+
? (context) => {
|
|
467
|
+
const chart = context.chart;
|
|
468
|
+
const { ctx, chartArea } = chart;
|
|
469
|
+
if (!chartArea)
|
|
470
|
+
return colors[index];
|
|
471
|
+
return this.createGradient(ctx, colors[index], chartArea, false);
|
|
472
|
+
}
|
|
473
|
+
: colors[index],
|
|
474
|
+
borderColor: colors[index],
|
|
475
|
+
borderWidth: 2,
|
|
476
|
+
hoverRadius: 12,
|
|
477
|
+
pointBorderWidth: 2,
|
|
478
|
+
}));
|
|
479
|
+
this.chart = new Chart(canvas, {
|
|
480
|
+
type: 'bubble',
|
|
481
|
+
data: { datasets },
|
|
482
|
+
options: {
|
|
483
|
+
animation: false,
|
|
484
|
+
responsive: true,
|
|
485
|
+
scales: {
|
|
486
|
+
x: {
|
|
487
|
+
beginAtZero: true,
|
|
488
|
+
title: {
|
|
489
|
+
display: !!this.data.xAxisLabel,
|
|
490
|
+
text: this.data.xAxisLabel || '',
|
|
491
|
+
font: {
|
|
492
|
+
size: 11,
|
|
493
|
+
weight: 400,
|
|
494
|
+
},
|
|
495
|
+
color: 'var(--text-secondary, #111827)',
|
|
496
|
+
},
|
|
497
|
+
},
|
|
498
|
+
y: {
|
|
499
|
+
beginAtZero: true,
|
|
500
|
+
title: {
|
|
501
|
+
display: !!this.data.yAxisLabel,
|
|
502
|
+
text: this.data.yAxisLabel || '',
|
|
503
|
+
font: {
|
|
504
|
+
size: 11,
|
|
505
|
+
weight: 400,
|
|
506
|
+
},
|
|
507
|
+
color: 'var(--text-secondary, #111827)',
|
|
508
|
+
},
|
|
509
|
+
},
|
|
510
|
+
},
|
|
511
|
+
plugins: {
|
|
512
|
+
legend: {
|
|
513
|
+
display: this.showLegend,
|
|
514
|
+
position: 'top',
|
|
515
|
+
labels: {
|
|
516
|
+
usePointStyle: true, // Použitie kruhového symbolu
|
|
517
|
+
pointStyle: 'circle', // Špecifický tvar pre symbol v legende
|
|
518
|
+
font: {
|
|
519
|
+
size: 13,
|
|
520
|
+
weight: 500,
|
|
521
|
+
},
|
|
522
|
+
},
|
|
523
|
+
},
|
|
524
|
+
tooltip: {
|
|
525
|
+
callbacks: {
|
|
526
|
+
label: (tooltipItem) => {
|
|
527
|
+
const dataPoint = tooltipItem.raw;
|
|
528
|
+
return `\u00A0\u00A0x: ${dataPoint.x}, y: ${dataPoint.y}, r: ${dataPoint.r}`;
|
|
529
|
+
},
|
|
530
|
+
},
|
|
531
|
+
bodyFont: {
|
|
532
|
+
size: 13,
|
|
533
|
+
weight: 400,
|
|
534
|
+
},
|
|
535
|
+
displayColors: true,
|
|
536
|
+
usePointStyle: true, // Použitie kruhového symbolu
|
|
537
|
+
xAlign: 'center',
|
|
538
|
+
yAlign: 'bottom',
|
|
539
|
+
padding: 16,
|
|
540
|
+
backgroundColor: 'black',
|
|
541
|
+
cornerRadius: 8,
|
|
542
|
+
},
|
|
543
|
+
title: {
|
|
544
|
+
display: !!this.data.title,
|
|
545
|
+
text: this.data.title, // Text, ktorý sa zobrazí nad grafom
|
|
546
|
+
font: {
|
|
547
|
+
size: 17,
|
|
548
|
+
weight: 500,
|
|
549
|
+
},
|
|
550
|
+
color: 'var(--text-primary, #111827)',
|
|
551
|
+
padding: {
|
|
552
|
+
top: 10,
|
|
553
|
+
bottom: 20,
|
|
554
|
+
},
|
|
555
|
+
},
|
|
556
|
+
},
|
|
557
|
+
onHover: (event, chartElement) => {
|
|
558
|
+
const target = event.native?.target;
|
|
559
|
+
if (chartElement.length) {
|
|
560
|
+
target.style.cursor = 'pointer'; // Zmena kurzora na ruku
|
|
561
|
+
}
|
|
562
|
+
else {
|
|
563
|
+
target.style.cursor = 'default';
|
|
564
|
+
}
|
|
565
|
+
},
|
|
566
|
+
},
|
|
567
|
+
});
|
|
568
|
+
}
|
|
569
|
+
renderBarAndLineChart(canvas) {
|
|
570
|
+
if (this.chart)
|
|
571
|
+
this.chart.destroy();
|
|
572
|
+
const colors = this.generateColors(this.data.datasets.length);
|
|
573
|
+
const datasetsWithColors = this.data.datasets.map((dataset, index) => ({
|
|
574
|
+
...dataset,
|
|
575
|
+
backgroundColor: this.useGradients
|
|
576
|
+
? (context) => {
|
|
577
|
+
const chart = context.chart;
|
|
578
|
+
const { ctx, chartArea } = chart;
|
|
579
|
+
if (!chartArea)
|
|
580
|
+
return colors[index];
|
|
581
|
+
return this.createGradient(ctx, colors[index], chartArea, false);
|
|
582
|
+
}
|
|
583
|
+
: colors[index],
|
|
584
|
+
borderColor: colors[index],
|
|
585
|
+
borderWidth: 2,
|
|
586
|
+
...(this.type === 'bar' ? { borderRadius: 8, borderSkipped: false } : {}),
|
|
587
|
+
...(this.type === 'line'
|
|
588
|
+
? {
|
|
589
|
+
pointStyle: 'circle',
|
|
590
|
+
pointRadius: 4,
|
|
591
|
+
pointBorderWidth: 2,
|
|
592
|
+
pointBorderColor: colors[index],
|
|
593
|
+
pointBackgroundColor: '#fff',
|
|
594
|
+
tension: 0.4,
|
|
595
|
+
fill: true,
|
|
596
|
+
}
|
|
597
|
+
: {}),
|
|
598
|
+
}));
|
|
599
|
+
this.chart = new Chart(canvas, {
|
|
600
|
+
type: this.type,
|
|
601
|
+
data: {
|
|
602
|
+
labels: this.data.labels,
|
|
603
|
+
datasets: datasetsWithColors,
|
|
604
|
+
},
|
|
605
|
+
options: {
|
|
606
|
+
animation: false,
|
|
607
|
+
responsive: true,
|
|
608
|
+
maintainAspectRatio: false,
|
|
609
|
+
scales: {
|
|
610
|
+
x: {
|
|
611
|
+
title: {
|
|
612
|
+
display: !!this.data.xAxisLabel,
|
|
613
|
+
text: this.data.xAxisLabel || '',
|
|
614
|
+
font: {
|
|
615
|
+
size: 11,
|
|
616
|
+
weight: 400,
|
|
617
|
+
},
|
|
618
|
+
color: 'var(--text-secondary, #111827)',
|
|
619
|
+
},
|
|
620
|
+
},
|
|
621
|
+
y: {
|
|
622
|
+
title: {
|
|
623
|
+
display: !!this.data.yAxisLabel,
|
|
624
|
+
text: this.data.yAxisLabel || '',
|
|
625
|
+
font: {
|
|
626
|
+
size: 11,
|
|
627
|
+
weight: 400,
|
|
628
|
+
},
|
|
629
|
+
color: 'var(--text-secondary, #111827)',
|
|
630
|
+
},
|
|
631
|
+
},
|
|
632
|
+
},
|
|
633
|
+
plugins: {
|
|
634
|
+
legend: {
|
|
635
|
+
display: this.showLegend,
|
|
636
|
+
position: 'top',
|
|
637
|
+
labels: {
|
|
638
|
+
usePointStyle: true, // Použitie kruhového symbolu
|
|
639
|
+
pointStyle: 'circle', // Špecifický tvar pre symbol v legende
|
|
640
|
+
font: {
|
|
641
|
+
size: 13,
|
|
642
|
+
weight: 500,
|
|
643
|
+
},
|
|
644
|
+
},
|
|
645
|
+
},
|
|
646
|
+
tooltip: {
|
|
647
|
+
callbacks: {
|
|
648
|
+
title: () => '',
|
|
649
|
+
label: (tooltipItem) => {
|
|
650
|
+
const value = tooltipItem.raw || 0;
|
|
651
|
+
return `\u00A0\u00A0${tooltipItem.label}: ${tooltipItem.raw}`;
|
|
652
|
+
},
|
|
653
|
+
},
|
|
654
|
+
bodyFont: {
|
|
655
|
+
size: 13,
|
|
656
|
+
weight: 400,
|
|
657
|
+
},
|
|
658
|
+
displayColors: true,
|
|
659
|
+
usePointStyle: true, // Použitie kruhového symbolu
|
|
660
|
+
xAlign: 'center',
|
|
661
|
+
yAlign: 'bottom',
|
|
662
|
+
padding: 16,
|
|
663
|
+
backgroundColor: 'black',
|
|
664
|
+
cornerRadius: 8,
|
|
665
|
+
},
|
|
666
|
+
title: {
|
|
667
|
+
display: !!this.data.title,
|
|
668
|
+
text: this.data.title, // Text, ktorý sa zobrazí nad grafom
|
|
669
|
+
font: {
|
|
670
|
+
size: 17,
|
|
671
|
+
weight: 500,
|
|
672
|
+
},
|
|
673
|
+
color: 'var(--text-primary, #111827)',
|
|
674
|
+
padding: {
|
|
675
|
+
top: 10,
|
|
676
|
+
bottom: 20,
|
|
677
|
+
},
|
|
678
|
+
},
|
|
679
|
+
},
|
|
680
|
+
onHover: (event, chartElement) => {
|
|
681
|
+
const target = event.native?.target;
|
|
682
|
+
if (chartElement.length) {
|
|
683
|
+
target.style.cursor = 'pointer'; // Zmena kurzora na ruku
|
|
684
|
+
}
|
|
685
|
+
else {
|
|
686
|
+
target.style.cursor = 'default';
|
|
687
|
+
}
|
|
688
|
+
},
|
|
689
|
+
},
|
|
690
|
+
});
|
|
691
|
+
}
|
|
692
|
+
render() {
|
|
693
|
+
return html `${this.isLoading ? html `<lit-loader></lit-loader>` : html `<canvas></canvas>`}`;
|
|
694
|
+
}
|
|
695
|
+
}
|
|
696
|
+
LitChart.styles = [
|
|
697
|
+
css `
|
|
698
|
+
canvas {
|
|
699
|
+
width: 100%;
|
|
700
|
+
height: 100%;
|
|
701
|
+
font-family: 'Inter', sans-serif;
|
|
702
|
+
margin: 0 auto;
|
|
703
|
+
}
|
|
704
|
+
`,
|
|
705
|
+
];
|
|
706
|
+
__decorate([
|
|
707
|
+
property({ type: String })
|
|
708
|
+
], LitChart.prototype, "type", void 0);
|
|
709
|
+
__decorate([
|
|
710
|
+
property({ type: Array })
|
|
711
|
+
], LitChart.prototype, "data", void 0);
|
|
712
|
+
__decorate([
|
|
713
|
+
property({ type: Boolean })
|
|
714
|
+
], LitChart.prototype, "isLoading", void 0);
|
|
715
|
+
__decorate([
|
|
716
|
+
property({ type: String })
|
|
717
|
+
], LitChart.prototype, "colorPalette", void 0);
|
|
718
|
+
__decorate([
|
|
719
|
+
property({ type: Boolean })
|
|
720
|
+
], LitChart.prototype, "useGradients", void 0);
|
|
721
|
+
__decorate([
|
|
722
|
+
property({ type: Boolean })
|
|
723
|
+
], LitChart.prototype, "showLegend", void 0);
|
|
724
|
+
if (!window.customElements.get('lit-chart')) {
|
|
725
|
+
window.customElements.define('lit-chart', LitChart);
|
|
726
|
+
}
|
|
727
|
+
//# sourceMappingURL=lit-chart.js.map
|