@eturnity/eturnity_reusable_components 8.13.3-EPDM-14657.2 → 8.13.3-EPDM-14657.3
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/package.json +1 -1
- package/src/TestChart.vue +29 -34
- package/src/assets/icons/collapse_arrow_icon_white.svg +1 -0
- package/src/assets/svgIcons/ac_power.svg +4 -0
- package/src/assets/svgIcons/arrow_long_left.svg +3 -0
- package/src/assets/svgIcons/arrow_long_right.svg +3 -0
- package/src/assets/svgIcons/chassis_ground_symbol.svg +27 -0
- package/src/assets/svgIcons/dc_power.svg +8 -0
- package/src/assets/svgIcons/double_arrow_long.svg +4 -0
- package/src/assets/svgIcons/ed_ac.svg +3 -0
- package/src/assets/svgIcons/ed_acgrid.svg +4 -0
- package/src/assets/svgIcons/ed_arrow_both.svg +7 -0
- package/src/assets/svgIcons/ed_arrow_left.svg +7 -0
- package/src/assets/svgIcons/ed_arrow_right.svg +7 -0
- package/src/assets/svgIcons/ed_battery.svg +10 -0
- package/src/assets/svgIcons/ed_batteryacinverter.svg +16 -0
- package/src/assets/svgIcons/ed_batteryintegratedinverter.svg +19 -0
- package/src/assets/svgIcons/ed_cirquitbreaker.svg +4 -0
- package/src/assets/svgIcons/ed_cirquitbreaker_magnetic.svg +6 -0
- package/src/assets/svgIcons/ed_cirquitbreaker_thermal.svg +4 -0
- package/src/assets/svgIcons/ed_cirquitbreaker_thermal_magnetic.svg +5 -0
- package/src/assets/svgIcons/ed_consumption.svg +3 -0
- package/src/assets/svgIcons/ed_dc.svg +6 -0
- package/src/assets/svgIcons/ed_disconnector.svg +4 -0
- package/src/assets/svgIcons/ed_disconnector_fuse.svg +4 -0
- package/src/assets/svgIcons/ed_disconnector_fuse_switch.svg +4 -0
- package/src/assets/svgIcons/ed_disconnector_loadbreak switch.svg +4 -0
- package/src/assets/svgIcons/ed_disconnector_switch.svg +4 -0
- package/src/assets/svgIcons/ed_disconnector_switch_auto_release.svg +5 -0
- package/src/assets/svgIcons/ed_energymanagement_rectangle.svg +3 -0
- package/src/assets/svgIcons/ed_evcharger.svg +19 -0
- package/src/assets/svgIcons/ed_flexiblecomponent_circle.svg +3 -0
- package/src/assets/svgIcons/ed_flexiblecomponent_square.svg +3 -0
- package/src/assets/svgIcons/ed_fuse.svg +3 -0
- package/src/assets/svgIcons/ed_ground.svg +5 -0
- package/src/assets/svgIcons/ed_heatpump.svg +4 -0
- package/src/assets/svgIcons/ed_icon_battery.svg +9 -0
- package/src/assets/svgIcons/ed_icon_circle.svg +3 -0
- package/src/assets/svgIcons/ed_icon_heatpump.svg +3 -0
- package/src/assets/svgIcons/ed_icon_inverter.svg +8 -0
- package/src/assets/svgIcons/ed_icon_optimizer.svg +11 -0
- package/src/assets/svgIcons/ed_integratedbatteryinverter.svg +10 -0
- package/src/assets/svgIcons/ed_inverter-blank.svg +3 -0
- package/src/assets/svgIcons/ed_mainsconnection.svg +3 -0
- package/src/assets/svgIcons/ed_meter_arrowleft.svg +4 -0
- package/src/assets/svgIcons/ed_meter_arrowright.svg +4 -0
- package/src/assets/svgIcons/ed_meter_bidirectional.svg +5 -0
- package/src/assets/svgIcons/ed_networkandsystemprotection_double.svg +14 -0
- package/src/assets/svgIcons/ed_networkandsystemprotection_single.svg +7 -0
- package/src/assets/svgIcons/ed_pvpanel.svg +7 -0
- package/src/assets/svgIcons/ed_rcd.svg +5 -0
- package/src/assets/svgIcons/ed_rcd_simple.svg +3 -0
- package/src/assets/svgIcons/ed_spd.svg +6 -0
- package/src/assets/svgIcons/ed_stringwithoptimizer.svg +33 -0
- package/src/assets/svgIcons/ed_stringwithoutoptimizer.svg +17 -0
- package/src/assets/svgIcons/ed_transformer.svg +3 -0
- package/src/assets/svgIcons/ground_symbol.svg +28 -0
- package/src/assets/svgIcons/house_sun.svg +3 -0
- package/src/assets/svgIcons/move_left.svg +3 -0
- package/src/assets/svgIcons/move_right.svg +3 -0
- package/src/assets/svgIcons/rectangle.svg +3 -0
- package/src/assets/svgIcons/text_icon.svg +3 -0
- package/src/assets/theme.js +1 -0
- package/src/components/banner/infoBanner/InfoBanner.spec.js +29 -42
- package/src/components/buttons/buttonIcon/index.vue +1 -1
- package/src/components/draggableCard/defaultProps.js +16 -0
- package/src/components/draggableCard/draggableCard.spec.js +99 -0
- package/src/components/draggableCard/draggableCard.stories.js +79 -0
- package/src/components/draggableCard/index.vue +363 -0
- package/src/components/errorMessage/errorMessage.spec.js +34 -0
- package/src/components/errorMessage/errorMessage.stories.js +35 -0
- package/src/components/filter/filterSettings.vue +2 -0
- package/src/components/icon/index.vue +18 -6
- package/src/components/infoText/index.vue +3 -3
- package/src/components/infoText/infoText.spec.js +6 -1
- package/src/components/inputs/checkbox/index.vue +2 -2
- package/src/components/inputs/select/index.vue +105 -18
- package/src/components/modals/actionModal/actionModal.spec.js +52 -0
- package/src/components/modals/actionModal/actionModal.stories.js +53 -0
- package/src/components/modals/actionModal/index.vue +6 -6
- package/src/components/modals/infoModal/index.vue +49 -19
- package/src/components/modals/infoModal/infoModal.spec.js +55 -0
- package/src/components/modals/infoModal/infoModal.stories.js +47 -0
- package/src/components/modals/modal/index.vue +21 -6
- package/src/components/pageSubtitle/PageSubtitle.stories.js +0 -1
- package/src/components/pageTitle/index.vue +3 -4
- package/src/components/spinner/index.vue +2 -2
- package/src/components/spinnerGif/index.vue +3 -3
- package/src/components/tableDropdown/index.vue +17 -9
- package/src/components/tables/mainTable/index.vue +4 -2
- package/src/helpers/dateTimeFormatting.js +51 -0
- package/src/main.js +0 -7
- package/src/router/dynamicRoutes.js +0 -12
- package/src/DemoCharts.vue +0 -424
@@ -43,8 +43,8 @@
|
|
43
43
|
align-items: center;
|
44
44
|
justify-items: center;
|
45
45
|
position: ${(props) => (props.limitedToModal ? 'absolute' : 'inherit')};
|
46
|
-
height:
|
47
|
-
width:
|
46
|
+
height: 100%;
|
47
|
+
width: 100%;
|
48
48
|
`
|
49
49
|
|
50
50
|
const wrapperAttrs = { size: String }
|
@@ -1,7 +1,7 @@
|
|
1
1
|
<template>
|
2
2
|
<SpinnerContainer v-if="fullWidth" data-test-id="spinner_full_container">
|
3
3
|
<Container>
|
4
|
-
<SpinnerWrapper data-test-id="spinner_full_wrapper">
|
4
|
+
<SpinnerWrapper data-test-id="spinner_full_wrapper" :size="size">
|
5
5
|
<img
|
6
6
|
:class="{ white: isWhite }"
|
7
7
|
data-test-id="spinner_full_icon"
|
@@ -16,7 +16,7 @@
|
|
16
16
|
data-test-id="spinner_container"
|
17
17
|
:limited-to-modal="limitedToModal"
|
18
18
|
>
|
19
|
-
<SpinnerWrapper data-test-id="spinner_wrapper">
|
19
|
+
<SpinnerWrapper data-test-id="spinner_wrapper" :size="size">
|
20
20
|
<img
|
21
21
|
:class="{ white: isWhite }"
|
22
22
|
data-test-id="spinner_full_icon"
|
@@ -55,7 +55,7 @@
|
|
55
55
|
width: ${(props) => (props.limitedToModal ? '100%' : 'inherit')};
|
56
56
|
`
|
57
57
|
|
58
|
-
const SpinnerWrapper = styled
|
58
|
+
const SpinnerWrapper = styled('div', { size: String })`
|
59
59
|
width: ${(props) => (props.size ? props.size : '60px')};
|
60
60
|
height: auto;
|
61
61
|
|
@@ -25,7 +25,7 @@
|
|
25
25
|
item.type === 'template')
|
26
26
|
"
|
27
27
|
/>
|
28
|
-
<
|
28
|
+
<TemplateItem
|
29
29
|
v-if="
|
30
30
|
item.type &&
|
31
31
|
item.type === 'template' &&
|
@@ -40,7 +40,7 @@
|
|
40
40
|
:variant="showArchived ? 'cancel' : 'main'"
|
41
41
|
@click.stop="onTemplateClick(item.row)"
|
42
42
|
/>
|
43
|
-
</
|
43
|
+
</TemplateItem>
|
44
44
|
<TemplateLink
|
45
45
|
v-else-if="
|
46
46
|
item.type && item.type === 'template' && item.value !== ''
|
@@ -101,7 +101,7 @@
|
|
101
101
|
<ArrowWrapper :show-archived="showArchived">
|
102
102
|
<InfoWrapper v-if="showArchived">
|
103
103
|
<InfoText
|
104
|
-
|
104
|
+
button-type="error"
|
105
105
|
:text="
|
106
106
|
$gettext(`Component has been archived and shouldn't be used`)
|
107
107
|
"
|
@@ -140,10 +140,10 @@
|
|
140
140
|
@keyup.enter="onItemClick(item)"
|
141
141
|
>
|
142
142
|
<template v-for="(option, idx) in optionsDisplay" :key="idx">
|
143
|
-
<
|
143
|
+
<DropdownItem v-if="option !== 'template'">
|
144
144
|
{{ !!item[option] ? item[option] : '-' }}
|
145
|
-
</
|
146
|
-
<
|
145
|
+
</DropdownItem>
|
146
|
+
<TemplateItem
|
147
147
|
v-else-if="option === 'template' && item.has_template"
|
148
148
|
>
|
149
149
|
<MainButton
|
@@ -152,7 +152,7 @@
|
|
152
152
|
type="secondary"
|
153
153
|
@click.stop="onTemplateClick(item)"
|
154
154
|
/>
|
155
|
-
</
|
155
|
+
</TemplateItem>
|
156
156
|
<NoTemplate
|
157
157
|
v-else-if="option === 'template' && !item.has_template"
|
158
158
|
>
|
@@ -219,7 +219,7 @@
|
|
219
219
|
|
220
220
|
.input-placeholder {
|
221
221
|
height: 25px;
|
222
|
-
|
222
|
+
margin-left: -2px;
|
223
223
|
}
|
224
224
|
`
|
225
225
|
|
@@ -250,6 +250,12 @@
|
|
250
250
|
padding-left: 15px;
|
251
251
|
`
|
252
252
|
|
253
|
+
const TemplateItem = styled.span`
|
254
|
+
padding-left: 15px;
|
255
|
+
`
|
256
|
+
|
257
|
+
const DropdownItem = styled.span``
|
258
|
+
|
253
259
|
const containerAttrs = { colSpan: Number, width: String }
|
254
260
|
const ComponentContainer = styled('div', containerAttrs)`
|
255
261
|
display: contents;
|
@@ -390,7 +396,7 @@
|
|
390
396
|
const inputContainerAttrs = { hasMessage: Boolean }
|
391
397
|
const InputContainer = styled('div', inputContainerAttrs)`
|
392
398
|
margin-left: ${(props) => (props.hasMessage ? '10px' : '0')};
|
393
|
-
display:
|
399
|
+
display: block;
|
394
400
|
align-items: center;
|
395
401
|
justify-content: flex-start;
|
396
402
|
|
@@ -480,6 +486,8 @@
|
|
480
486
|
InfoText,
|
481
487
|
InfoWrapper,
|
482
488
|
TableItem,
|
489
|
+
TemplateItem,
|
490
|
+
DropdownItem,
|
483
491
|
},
|
484
492
|
props: {
|
485
493
|
colSpan: {
|
@@ -239,8 +239,6 @@
|
|
239
239
|
|
240
240
|
&.checkbox-header {
|
241
241
|
min-width: 40px;
|
242
|
-
display: flex;
|
243
|
-
gap: 10px;
|
244
242
|
}
|
245
243
|
}
|
246
244
|
|
@@ -258,6 +256,10 @@
|
|
258
256
|
background-color: ${(props) => props.theme.colors.grey5};
|
259
257
|
}
|
260
258
|
|
259
|
+
td:first-of-type {
|
260
|
+
padding-left: 15px !important;
|
261
|
+
}
|
262
|
+
|
261
263
|
.text {
|
262
264
|
cursor: auto !important;
|
263
265
|
}
|
@@ -0,0 +1,51 @@
|
|
1
|
+
// functions for standard date and time formatting
|
2
|
+
|
3
|
+
// e.g. 13.12.2024
|
4
|
+
export const toLocaleDate = ({
|
5
|
+
locale = localStorage.getItem('lang'),
|
6
|
+
value,
|
7
|
+
}) => {
|
8
|
+
const localeLC = locale.toLowerCase()
|
9
|
+
const options = {
|
10
|
+
year: 'numeric',
|
11
|
+
month: 'numeric',
|
12
|
+
day: 'numeric',
|
13
|
+
}
|
14
|
+
|
15
|
+
return new Intl.DateTimeFormat(localeLC, options).format(Date.parse(value))
|
16
|
+
}
|
17
|
+
|
18
|
+
// e.g. 31 December 2024
|
19
|
+
export const toLocaleDateLong = ({
|
20
|
+
locale = localStorage.getItem('lang'),
|
21
|
+
value,
|
22
|
+
}) => {
|
23
|
+
const localeLC = locale.toLowerCase()
|
24
|
+
const options = {
|
25
|
+
year: 'numeric',
|
26
|
+
month: 'long',
|
27
|
+
day: 'numeric',
|
28
|
+
}
|
29
|
+
|
30
|
+
return new Intl.DateTimeFormat(localeLC, options).format(Date.parse(value))
|
31
|
+
}
|
32
|
+
|
33
|
+
// e.g. 08:45
|
34
|
+
export const toLocaleTime = ({
|
35
|
+
locale = localStorage.getItem('lang'),
|
36
|
+
value,
|
37
|
+
}) => {
|
38
|
+
const nonDefaultFormatting = {
|
39
|
+
'es-es': { hour: '2-digit' },
|
40
|
+
'cs-es': { hour: '2-digit' },
|
41
|
+
}
|
42
|
+
|
43
|
+
const localeLC = locale.toLowerCase()
|
44
|
+
const options = {
|
45
|
+
hour: 'numeric',
|
46
|
+
minute: 'numeric',
|
47
|
+
...nonDefaultFormatting[localeLC],
|
48
|
+
}
|
49
|
+
|
50
|
+
return new Intl.DateTimeFormat(localeLC, options).format(Date.parse(value))
|
51
|
+
}
|
package/src/main.js
CHANGED
@@ -2,14 +2,7 @@ import App from './App.vue'
|
|
2
2
|
import { createApp } from 'vue'
|
3
3
|
import router from './router/dynamicRoutes'
|
4
4
|
|
5
|
-
const link = document.createElement('link')
|
6
|
-
link.href =
|
7
|
-
'https://fonts.googleapis.com/css2?family=Figtree:ital,wght@0,300;0,400;0,500;0,600;0,700;1,300&display=swap'
|
8
|
-
link.rel = 'stylesheet'
|
9
|
-
document.getElementsByTagName('head')[0].appendChild(link)
|
10
|
-
|
11
5
|
const app = createApp(App)
|
12
6
|
|
13
|
-
app.config.globalProperties.$c = console
|
14
7
|
app.use(router)
|
15
8
|
app.mount('#app')
|
@@ -1,8 +1,6 @@
|
|
1
1
|
import { createRouter, createWebHistory } from 'vue-router'
|
2
2
|
import Test from '@/Test.vue'
|
3
3
|
import Toggle from '@/components/inputs/toggle/index.vue'
|
4
|
-
import TestChart from '@/TestChart.vue'
|
5
|
-
import DemoCharts from '@/DemoCharts.vue'
|
6
4
|
|
7
5
|
const routes = [
|
8
6
|
{
|
@@ -15,16 +13,6 @@ const routes = [
|
|
15
13
|
name: 'Toggle',
|
16
14
|
component: Toggle,
|
17
15
|
},
|
18
|
-
{
|
19
|
-
path: '/test-chart',
|
20
|
-
name: 'TestChart',
|
21
|
-
component: TestChart,
|
22
|
-
},
|
23
|
-
{
|
24
|
-
path: '/demo-charts',
|
25
|
-
name: 'DemoCharts',
|
26
|
-
component: DemoCharts,
|
27
|
-
},
|
28
16
|
]
|
29
17
|
|
30
18
|
const router = createRouter({
|
package/src/DemoCharts.vue
DELETED
@@ -1,424 +0,0 @@
|
|
1
|
-
<template>
|
2
|
-
<div class="demo-container">
|
3
|
-
<h1>BarChart Component Examples</h1>
|
4
|
-
|
5
|
-
<h2>1. Basic Bar Chart</h2>
|
6
|
-
<BarChart
|
7
|
-
:data="basicData"
|
8
|
-
:value-formatter="kwhFormatter"
|
9
|
-
height="300px"
|
10
|
-
width="800px"
|
11
|
-
/>
|
12
|
-
|
13
|
-
<h2>2. Bar Chart with Custom Bar Width</h2>
|
14
|
-
<BarChart
|
15
|
-
:bar-width="80"
|
16
|
-
:data="basicData"
|
17
|
-
:value-formatter="kwhFormatter"
|
18
|
-
height="300px"
|
19
|
-
width="800px"
|
20
|
-
/>
|
21
|
-
|
22
|
-
<h2>3. Stacked Bar Chart - 3 Series with Legend</h2>
|
23
|
-
<BarChart
|
24
|
-
:bar-width="80"
|
25
|
-
:data="quarterLabels"
|
26
|
-
:is-legend-shown="true"
|
27
|
-
:series="threeZoneSeries"
|
28
|
-
:value-formatter="kwhFormatter"
|
29
|
-
height="400px"
|
30
|
-
width="800px"
|
31
|
-
/>
|
32
|
-
|
33
|
-
<h2>4. Stacked Bar Chart - 6 Series with Multi-Row Legend</h2>
|
34
|
-
<BarChart
|
35
|
-
:bar-width="60"
|
36
|
-
:data="monthLabels"
|
37
|
-
:is-legend-shown="true"
|
38
|
-
:legends-item-per-row="3"
|
39
|
-
:series="tariffZones"
|
40
|
-
:value-formatter="kwhFormatter"
|
41
|
-
height="400px"
|
42
|
-
width="800px"
|
43
|
-
/>
|
44
|
-
|
45
|
-
<h2>5. Scrollable Chart with Many Data Points</h2>
|
46
|
-
<BarChart
|
47
|
-
:bar-width="40"
|
48
|
-
:data="dailyData"
|
49
|
-
:is-scrollable="true"
|
50
|
-
:value-formatter="kwhFormatter"
|
51
|
-
height="300px"
|
52
|
-
width="800px"
|
53
|
-
/>
|
54
|
-
|
55
|
-
<h2>6. Scrollable Chart with Selection</h2>
|
56
|
-
<BarChart
|
57
|
-
:bar-width="40"
|
58
|
-
:data="dailyData"
|
59
|
-
:is-scrollable="true"
|
60
|
-
:is-selection-enabled="true"
|
61
|
-
:selection-size="5"
|
62
|
-
:value-formatter="kwhFormatter"
|
63
|
-
height="300px"
|
64
|
-
width="800px"
|
65
|
-
@selection-change="handleSelectionChange"
|
66
|
-
/>
|
67
|
-
|
68
|
-
<h2>7. Chart with Top Controls & Time Frame Selector</h2>
|
69
|
-
<BarChart
|
70
|
-
:bar-width="70"
|
71
|
-
:data="quarterLabels"
|
72
|
-
:is-legend-shown="true"
|
73
|
-
:selected-split-button="selectedTimeFrame"
|
74
|
-
:series="threeZoneSeries"
|
75
|
-
:split-button-options="timeFrameOptions"
|
76
|
-
:value-formatter="kwhFormatter"
|
77
|
-
chart-controls-position="top"
|
78
|
-
height="350px"
|
79
|
-
width="800px"
|
80
|
-
@select-split-button="handleTimeFrameSelect"
|
81
|
-
/>
|
82
|
-
|
83
|
-
<h2>8. Chart with Bottom Controls & Time Frame Selector</h2>
|
84
|
-
<BarChart
|
85
|
-
:bar-width="70"
|
86
|
-
:data="quarterLabels"
|
87
|
-
:is-legend-shown="true"
|
88
|
-
:selected-split-button="selectedTimeFrame"
|
89
|
-
:series="threeZoneSeries"
|
90
|
-
:split-button-options="timeFrameOptions"
|
91
|
-
:value-formatter="kwhFormatter"
|
92
|
-
chart-controls-position="bottom"
|
93
|
-
height="350px"
|
94
|
-
width="800px"
|
95
|
-
@select-split-button="handleTimeFrameSelect"
|
96
|
-
/>
|
97
|
-
|
98
|
-
<h2>9. Chart with Custom Tooltip</h2>
|
99
|
-
<BarChart :bar-width="60" :data="basicData" height="300px" width="800px">
|
100
|
-
<template #tooltip="{ item }">
|
101
|
-
<div style="padding: 8px">
|
102
|
-
<div style="font-weight: bold">{{ item.label }}</div>
|
103
|
-
<div>Consumption: {{ kwhFormatter(item.segments[0].value) }}</div>
|
104
|
-
<div>Peak Time: {{ getPeakTime(item.label) }}</div>
|
105
|
-
<div>Efficiency: {{ getEfficiency(item.segments[0].value) }}</div>
|
106
|
-
</div>
|
107
|
-
</template>
|
108
|
-
</BarChart>
|
109
|
-
|
110
|
-
<h2>10. Chart with Bottom Fields</h2>
|
111
|
-
<BarChart
|
112
|
-
:bar-width="60"
|
113
|
-
:data="basicData"
|
114
|
-
:is-bottom-fields-shown="true"
|
115
|
-
:value-formatter="kwhFormatter"
|
116
|
-
height="300px"
|
117
|
-
width="800px"
|
118
|
-
@update-value="handleValueUpdate"
|
119
|
-
/>
|
120
|
-
|
121
|
-
<h2>11. Scrollable Chart with Bottom Fields</h2>
|
122
|
-
<BarChart
|
123
|
-
:bar-width="40"
|
124
|
-
:data="monthlyData"
|
125
|
-
:is-bottom-fields-shown="true"
|
126
|
-
:is-scrollable="true"
|
127
|
-
:value-formatter="kwhFormatter"
|
128
|
-
height="300px"
|
129
|
-
width="800px"
|
130
|
-
/>
|
131
|
-
|
132
|
-
<h2>12. Stacked Chart with Bottom Fields</h2>
|
133
|
-
<BarChart
|
134
|
-
:bar-width="70"
|
135
|
-
:data="quarterLabels"
|
136
|
-
:is-bottom-fields-shown="true"
|
137
|
-
:is-legend-shown="true"
|
138
|
-
:series="threeZoneSeries"
|
139
|
-
:value-formatter="kwhFormatter"
|
140
|
-
height="400px"
|
141
|
-
width="800px"
|
142
|
-
/>
|
143
|
-
|
144
|
-
<h2>13. Scrollable Stacked Chart with Bottom Fields</h2>
|
145
|
-
<BarChart
|
146
|
-
:bar-width="60"
|
147
|
-
:data="monthLabels"
|
148
|
-
:is-bottom-fields-shown="true"
|
149
|
-
:is-legend-shown="true"
|
150
|
-
:is-scrollable="true"
|
151
|
-
:legends-item-per-row="3"
|
152
|
-
:series="tariffZones"
|
153
|
-
:value-formatter="kwhFormatter"
|
154
|
-
height="400px"
|
155
|
-
width="800px"
|
156
|
-
/>
|
157
|
-
|
158
|
-
<h2>14. Chart with Selection and Bottom Fields</h2>
|
159
|
-
<BarChart
|
160
|
-
:bar-width="40"
|
161
|
-
:data="monthlyData"
|
162
|
-
:is-bottom-fields-shown="true"
|
163
|
-
:is-scrollable="true"
|
164
|
-
:is-selection-enabled="true"
|
165
|
-
:selection-size="6"
|
166
|
-
:value-formatter="kwhFormatter"
|
167
|
-
height="350px"
|
168
|
-
width="800px"
|
169
|
-
@selection-change="handleSelectionChange"
|
170
|
-
/>
|
171
|
-
|
172
|
-
<h2>15. Stacked Chart and Bottom Fields</h2>
|
173
|
-
<BarChart
|
174
|
-
:bar-width="70"
|
175
|
-
:data="quarterLabels"
|
176
|
-
:is-bottom-fields-shown="true"
|
177
|
-
:is-legend-shown="true"
|
178
|
-
:series="threeZoneSeries"
|
179
|
-
:value-formatter="kwhFormatter"
|
180
|
-
height="400px"
|
181
|
-
width="800px"
|
182
|
-
@selection-change="handleSelectionChange"
|
183
|
-
/>
|
184
|
-
</div>
|
185
|
-
</template>
|
186
|
-
|
187
|
-
<script setup>
|
188
|
-
import { ref } from 'vue'
|
189
|
-
import BarChart from './components/barchart/index.vue'
|
190
|
-
|
191
|
-
// Formatters
|
192
|
-
const kwhFormatter = (value) => `${value.toLocaleString()} kWh`
|
193
|
-
|
194
|
-
// Basic data
|
195
|
-
const basicData = [
|
196
|
-
{ label: 'Jan', value: 1200 },
|
197
|
-
{ label: 'Feb', value: 1800 },
|
198
|
-
{ label: 'Mar', value: 2200 },
|
199
|
-
{ label: 'Apr', value: 1600 },
|
200
|
-
{ label: 'May', value: 2400 },
|
201
|
-
{ label: 'Jun', value: 2800 },
|
202
|
-
{ label: 'Jul', value: 2200 },
|
203
|
-
{ label: 'Aug', value: 1600 },
|
204
|
-
{ label: 'Sep', value: 2400 },
|
205
|
-
{ label: 'Oct', value: 2800 },
|
206
|
-
{ label: 'Nov', value: 2200 },
|
207
|
-
{ label: 'Dec', value: 1600 },
|
208
|
-
]
|
209
|
-
|
210
|
-
// Minimal data with fewer points
|
211
|
-
const minimalData = [
|
212
|
-
{ label: 'Q1', value: 3500 },
|
213
|
-
{ label: 'Q2', value: 4200 },
|
214
|
-
{ label: 'Q3', value: 5100 },
|
215
|
-
{ label: 'Q4', value: 4800 },
|
216
|
-
]
|
217
|
-
|
218
|
-
// Labels for stacked charts
|
219
|
-
const quarterLabels = [
|
220
|
-
{ label: 'Q1' },
|
221
|
-
{ label: 'Q2' },
|
222
|
-
{ label: 'Q3' },
|
223
|
-
{ label: 'Q4' },
|
224
|
-
]
|
225
|
-
|
226
|
-
const monthLabels = [
|
227
|
-
{ label: 'Jan' },
|
228
|
-
{ label: 'Feb' },
|
229
|
-
{ label: 'Mar' },
|
230
|
-
{ label: 'Apr' },
|
231
|
-
{ label: 'May' },
|
232
|
-
{ label: 'Jun' },
|
233
|
-
{ label: 'Jul' },
|
234
|
-
{ label: 'Aug' },
|
235
|
-
{ label: 'Sep' },
|
236
|
-
{ label: 'Oct' },
|
237
|
-
{ label: 'Nov' },
|
238
|
-
{ label: 'Dec' },
|
239
|
-
]
|
240
|
-
|
241
|
-
const monthlyData = [
|
242
|
-
{ label: 'Jan', value: 300 },
|
243
|
-
{ label: 'Feb', value: 600 },
|
244
|
-
{ label: 'Mar', value: 1000 },
|
245
|
-
{ label: 'Apr', value: 1200 },
|
246
|
-
{ label: 'May', value: 1400 },
|
247
|
-
{ label: 'Jun', value: 1810 },
|
248
|
-
{ label: 'Jul', value: 2000 },
|
249
|
-
{ label: 'Aug', value: 2200 },
|
250
|
-
{ label: 'Sep', value: 2400 },
|
251
|
-
{ label: 'Oct', value: 2600 },
|
252
|
-
{ label: 'Nov', value: 2800 },
|
253
|
-
{ label: 'Dec', value: 3000 },
|
254
|
-
{ label: 'Jan 2024', value: 2800 },
|
255
|
-
{ label: 'Feb 2024', value: 2600 },
|
256
|
-
{ label: 'Mar 2024', value: 2900 },
|
257
|
-
{ label: 'Apr 2024', value: 3100 },
|
258
|
-
{ label: 'May 2024', value: 2700 },
|
259
|
-
{ label: 'Jun 2024', value: 2500 },
|
260
|
-
]
|
261
|
-
|
262
|
-
// Three zone series data
|
263
|
-
const threeZoneSeries = [
|
264
|
-
{
|
265
|
-
name: 'Peak Hours',
|
266
|
-
data: [
|
267
|
-
{ label: 'Q1', value: 800 },
|
268
|
-
{ label: 'Q2', value: 1200 },
|
269
|
-
{ label: 'Q3', value: 1600 },
|
270
|
-
{ label: 'Q4', value: 1400 },
|
271
|
-
],
|
272
|
-
},
|
273
|
-
{
|
274
|
-
name: 'Mid-Peak',
|
275
|
-
data: [
|
276
|
-
{ label: 'Q1', value: 600 },
|
277
|
-
{ label: 'Q2', value: 800 },
|
278
|
-
{ label: 'Q3', value: 1000 },
|
279
|
-
{ label: 'Q4', value: 900 },
|
280
|
-
],
|
281
|
-
},
|
282
|
-
{
|
283
|
-
name: 'Off-Peak',
|
284
|
-
data: [
|
285
|
-
{ label: 'Q1', value: 400 },
|
286
|
-
{ label: 'Q2', value: 500 },
|
287
|
-
{ label: 'Q3', value: 600 },
|
288
|
-
{ label: 'Q4', value: 550 },
|
289
|
-
],
|
290
|
-
},
|
291
|
-
]
|
292
|
-
|
293
|
-
// Six zone series data
|
294
|
-
const tariffZones = [
|
295
|
-
{
|
296
|
-
name: 'Residential',
|
297
|
-
data: monthLabels.map(() => ({
|
298
|
-
label: 'Jan',
|
299
|
-
value: Math.floor(Math.random() * 300) + 100,
|
300
|
-
})),
|
301
|
-
},
|
302
|
-
{
|
303
|
-
name: 'Commercial',
|
304
|
-
data: monthLabels.map(() => ({
|
305
|
-
label: 'Jan',
|
306
|
-
value: Math.floor(Math.random() * 400) + 200,
|
307
|
-
})),
|
308
|
-
},
|
309
|
-
{
|
310
|
-
name: 'Industrial',
|
311
|
-
data: monthLabels.map(() => ({
|
312
|
-
label: 'Jan',
|
313
|
-
value: Math.floor(Math.random() * 500) + 300,
|
314
|
-
})),
|
315
|
-
},
|
316
|
-
{
|
317
|
-
name: 'Agricultural',
|
318
|
-
data: monthLabels.map(() => ({
|
319
|
-
label: 'Jan',
|
320
|
-
value: Math.floor(Math.random() * 200) + 100,
|
321
|
-
})),
|
322
|
-
},
|
323
|
-
{
|
324
|
-
name: 'Public',
|
325
|
-
data: monthLabels.map(() => ({
|
326
|
-
label: 'Jan',
|
327
|
-
value: Math.floor(Math.random() * 300) + 150,
|
328
|
-
})),
|
329
|
-
},
|
330
|
-
{
|
331
|
-
name: 'Special',
|
332
|
-
data: monthLabels.map(() => ({
|
333
|
-
label: 'Jan',
|
334
|
-
value: Math.floor(Math.random() * 250) + 100,
|
335
|
-
})),
|
336
|
-
},
|
337
|
-
].map((zone) => ({
|
338
|
-
...zone,
|
339
|
-
data: zone.data.map((item, index) => ({
|
340
|
-
...item,
|
341
|
-
label: monthLabels[index].label,
|
342
|
-
})),
|
343
|
-
}))
|
344
|
-
|
345
|
-
// Daily data for scrollable example
|
346
|
-
const dailyData = Array.from({ length: 31 }, (_, i) => ({
|
347
|
-
label: `Day ${i + 1}`,
|
348
|
-
value: Math.floor(Math.random() * 200) + 50,
|
349
|
-
}))
|
350
|
-
|
351
|
-
// Time frame options
|
352
|
-
const timeFrameOptions = [
|
353
|
-
{ label: 'Daily', value: 'daily' },
|
354
|
-
{ label: 'Weekly', value: 'weekly' },
|
355
|
-
{ label: 'Monthly', value: 'monthly' },
|
356
|
-
{ label: 'Yearly', value: 'yearly' },
|
357
|
-
]
|
358
|
-
const selectedTimeFrame = ref('monthly')
|
359
|
-
|
360
|
-
// View options
|
361
|
-
const viewOptions = [
|
362
|
-
{ label: 'Chart', value: 'chart' },
|
363
|
-
{ label: 'Table', value: 'table' },
|
364
|
-
{ label: 'Combined', value: 'combined' },
|
365
|
-
]
|
366
|
-
const selectedView = ref('chart')
|
367
|
-
|
368
|
-
// Handlers
|
369
|
-
const handleTimeFrameSelect = (value) => {
|
370
|
-
selectedTimeFrame.value = value
|
371
|
-
console.log(`Time frame changed to: ${value}`)
|
372
|
-
}
|
373
|
-
|
374
|
-
const handleViewSelect = (value) => {
|
375
|
-
selectedView.value = value
|
376
|
-
console.log(`View changed to: ${value}`)
|
377
|
-
}
|
378
|
-
|
379
|
-
const handleSelectionChange = (selection) => {
|
380
|
-
console.log('Selection changed:', selection)
|
381
|
-
}
|
382
|
-
|
383
|
-
const handleValueUpdate = (data) => {
|
384
|
-
console.log('Value updated:', data)
|
385
|
-
}
|
386
|
-
|
387
|
-
// Helper for custom tooltip
|
388
|
-
const getPeakTime = (month) => {
|
389
|
-
const peakTimes = {
|
390
|
-
Jan: '6-8 PM',
|
391
|
-
Feb: '5-7 PM',
|
392
|
-
Mar: '4-6 PM',
|
393
|
-
Apr: '3-5 PM',
|
394
|
-
May: '2-4 PM',
|
395
|
-
Jun: '1-3 PM',
|
396
|
-
}
|
397
|
-
return peakTimes[month] || 'N/A'
|
398
|
-
}
|
399
|
-
|
400
|
-
const getEfficiency = (value) => {
|
401
|
-
if (value < 1500) return 'High Efficiency'
|
402
|
-
if (value < 2500) return 'Medium Efficiency'
|
403
|
-
return 'Low Efficiency'
|
404
|
-
}
|
405
|
-
</script>
|
406
|
-
|
407
|
-
<style scoped>
|
408
|
-
.demo-container {
|
409
|
-
padding: 20px;
|
410
|
-
font-family: 'Figtree', sans-serif;
|
411
|
-
}
|
412
|
-
|
413
|
-
.demo-container > h2 {
|
414
|
-
margin: 40px 0 20px;
|
415
|
-
color: #333;
|
416
|
-
border-bottom: 1px solid #eee;
|
417
|
-
padding-bottom: 10px;
|
418
|
-
}
|
419
|
-
|
420
|
-
h1 {
|
421
|
-
color: #2c3e50;
|
422
|
-
margin-bottom: 30px;
|
423
|
-
}
|
424
|
-
</style>
|