@dataloop-ai/components 0.13.18 → 0.14.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/.nvmrc +1 -0
- package/README.md +3 -1
- package/package.json +19 -17
- package/src/assets/globals.scss +38 -3
- package/src/assets/grid.scss +9 -0
- package/src/components/DlAccordion/DlAccordion.vue +4 -4
- package/src/components/DlAlert.vue +6 -6
- package/src/components/DlChart/BrushThumb.vue +83 -0
- package/src/components/DlChart/DlBarChart.vue +545 -0
- package/src/components/DlChart/DlBrush.vue +475 -0
- package/src/components/DlChart/DlChartLabels.vue +279 -0
- package/src/components/DlChart/DlChartLegend.vue +141 -0
- package/src/components/DlChart/DlColumnChart.vue +555 -0
- package/src/components/DlChart/DlLineChart.vue +644 -0
- package/src/components/DlChart/DlScrollBar.vue +147 -0
- package/src/components/DlChart/Doughnut/DlDoughnutChart.vue +448 -0
- package/src/components/DlChart/Doughnut/DlDoughnutChartLegend.vue +281 -0
- package/src/components/DlChart/Doughnut/DlDoughnutChartWidget.vue +64 -0
- package/src/components/DlChart/Doughnut/types/TDoughnutChartAnimation.ts +4 -0
- package/src/components/DlChart/Doughnut/types/TDoughnutChartData.ts +16 -0
- package/src/components/DlChart/Doughnut/types/TDoughnutChartOptions.ts +11 -0
- package/src/components/DlChart/Doughnut/types/TDoughnutChartProps.ts +8 -0
- package/src/components/DlChart/Doughnut/types/TDoughnutWithOriginalColor.ts +13 -0
- package/src/components/DlChart/chart.ts +122 -0
- package/src/components/DlChart/index.ts +36 -0
- package/src/components/DlChart/props.ts +348 -0
- package/src/components/DlChart/typedCharts.ts +88 -0
- package/src/components/DlChart/types.ts +63 -0
- package/src/components/DlChart/utils.ts +153 -0
- package/src/components/DlChip/DlChip.vue +40 -13
- package/src/components/DlCounters.vue +31 -7
- package/src/components/DlDatePicker/DlCalendar.vue +22 -10
- package/src/components/DlDatePicker/DlDatePicker.vue +8 -5
- package/src/components/DlDateTimeRange/types.ts +2 -2
- package/src/components/DlDialogBox/DlDialogBox.vue +0 -8
- package/src/components/DlDialogBox/DlDialogBoxHeader.vue +6 -22
- package/src/components/DlDropdownButton.vue +16 -4
- package/src/components/DlPagination/RowsSelector.vue +15 -1
- package/src/components/DlRange/DlRange.vue +3 -2
- package/src/components/DlSearch.vue +1 -1
- package/src/components/DlSelect/DlSelect.vue +1 -19
- package/src/components/DlSlider/sliderStyles.scss +4 -0
- package/src/components/DlSlider/useSlider.ts +39 -12
- package/src/components/DlSpinner.vue +259 -0
- package/src/components/DlTable/DlTable.vue +4 -1
- package/src/components/DlTable/hooks/tablePagination.ts +8 -2
- package/src/components/DlTextArea.vue +9 -0
- package/src/components/DlTextInput.vue +6 -42
- package/src/components/DlThemeProvider.vue +22 -13
- package/src/components/DlToastMessage/api/useToast.ts +23 -0
- package/src/components/DlToastMessage/components/ToastComponent.vue +279 -0
- package/src/components/DlToastMessage/index.ts +5 -0
- package/src/components/DlToastMessage/types.ts +4 -0
- package/src/components/DlToastMessage/utils/config.ts +17 -0
- package/src/components/DlToastMessage/utils/render.ts +54 -0
- package/src/components/DlTypography.vue +1 -1
- package/src/components/DlWidget/DlGrid.vue +33 -0
- package/src/components/DlWidget/DlGridRow.vue +32 -0
- package/src/components/DlWidget/DlWidget.vue +202 -11
- package/src/components/DlWidget/index.ts +2 -2
- package/src/components/DlWidget/utils.ts +26 -19
- package/src/components/index.ts +8 -3
- package/src/demo/BarChartDemo.vue +77 -0
- package/src/demo/ColumnChartDemo.vue +230 -0
- package/src/demo/DlButtonDemo.vue +1 -1
- package/src/demo/DlChartDoughnutDemo.vue +229 -0
- package/src/demo/DlChipDemo.vue +42 -18
- package/src/demo/DlDialogBoxDemo.vue +4 -4
- package/src/demo/DlLineChartDemo.vue +375 -0
- package/src/demo/DlSpinnerDemo.vue +20 -0
- package/src/demo/DlTableDemo.vue +13 -94
- package/src/demo/DlToastMessageDemo.vue +143 -0
- package/src/demo/DlWidgetDemo.vue +105 -143
- package/src/demo/index.ts +20 -2
- package/src/hooks/use-theme.ts +19 -0
- package/src/utils/abbreviate-to-string.ts +14 -0
- package/src/utils/colors.ts +47 -0
- package/src/utils/getRootStyles.ts +1 -1
- package/src/utils/index.ts +1 -0
- package/src/utils/swapNodes.ts +30 -0
- package/src/utils/update-key.ts +90 -0
- package/tsconfig.json +0 -1
- package/vite.config.ts +17 -0
- package/Dockerfile +0 -12
- package/jest.config.js +0 -16
- package/jest.setup.js +0 -59
- package/src/components/DlWidget/DlWidgetGrid.vue +0 -360
- package/storybook.js +0 -8
|
@@ -1,30 +1,37 @@
|
|
|
1
|
-
export function
|
|
1
|
+
export function getElementAbove(el: HTMLElement, className: string) {
|
|
2
2
|
//@ts-ignore
|
|
3
3
|
for (; el && el !== document; el = el.parentNode) {
|
|
4
|
-
if (el.classList.contains(
|
|
4
|
+
if (el.classList.contains(className)) {
|
|
5
5
|
return el
|
|
6
6
|
}
|
|
7
7
|
}
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
export function
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
export function addMouseEnter(className: string, method: EventListenerObject) {
|
|
11
|
+
Array.from(document.getElementsByClassName(className)).forEach((widget) => {
|
|
12
|
+
widget.addEventListener('mouseenter', method)
|
|
13
|
+
})
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function removeMouseEnter(
|
|
17
|
+
className: string,
|
|
18
|
+
method: EventListenerObject
|
|
13
19
|
) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
targetElement.style.top = `${
|
|
18
|
-
sourceElement.getBoundingClientRect().y + 20
|
|
19
|
-
}px`
|
|
20
|
-
targetElement.style.left = `${
|
|
21
|
-
sourceElement.getBoundingClientRect().x - 10
|
|
22
|
-
}px`
|
|
20
|
+
Array.from(document.getElementsByClassName(className)).forEach((widget) => {
|
|
21
|
+
widget.removeEventListener('mouseenter', method)
|
|
22
|
+
})
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
export function
|
|
26
|
-
|
|
27
|
-
row
|
|
28
|
-
|
|
29
|
-
|
|
25
|
+
export function setFlexBasis() {
|
|
26
|
+
Array.from(document.getElementsByClassName('dl-grid-row')).forEach(
|
|
27
|
+
(row) => {
|
|
28
|
+
Array.from(row.children).forEach((widget: any) => {
|
|
29
|
+
widget.style.flexBasis = `${100 / row.children.length}%`
|
|
30
|
+
})
|
|
31
|
+
}
|
|
32
|
+
)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export function insertAfter(newNode: HTMLElement, existingNode: HTMLElement) {
|
|
36
|
+
existingNode.parentNode.insertBefore(newNode, existingNode.nextSibling)
|
|
30
37
|
}
|
package/src/components/index.ts
CHANGED
|
@@ -50,8 +50,10 @@ import { DlDateTimeRange } from './DlDateTimeRange'
|
|
|
50
50
|
import { DateInterval } from './DlDatePicker/types'
|
|
51
51
|
import { DlSmartSearch } from './DlSmartSearch'
|
|
52
52
|
import { DlWidget } from './DlWidget'
|
|
53
|
-
import {
|
|
53
|
+
import { DlGrid } from './DlWidget'
|
|
54
54
|
import DlTextHolder from './DlTextHolder.vue'
|
|
55
|
+
import { DlColumnChart, DlLineChart } from './DlChart'
|
|
56
|
+
import DlSpinner from './DlSpinner.vue'
|
|
55
57
|
|
|
56
58
|
export {
|
|
57
59
|
DlAccordion,
|
|
@@ -111,8 +113,11 @@ export {
|
|
|
111
113
|
DlDateTimeRange,
|
|
112
114
|
DlSmartSearch,
|
|
113
115
|
DlWidget,
|
|
114
|
-
|
|
115
|
-
DlTextHolder
|
|
116
|
+
DlGrid,
|
|
117
|
+
DlTextHolder,
|
|
118
|
+
DlColumnChart,
|
|
119
|
+
DlLineChart,
|
|
120
|
+
DlSpinner
|
|
116
121
|
}
|
|
117
122
|
|
|
118
123
|
export type { StepState, DateInterval }
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
style="
|
|
4
|
+
display: flex;
|
|
5
|
+
width: 900px;
|
|
6
|
+
flex-wrap: wrap;
|
|
7
|
+
flex-direction: row;
|
|
8
|
+
gap: 0px;
|
|
9
|
+
"
|
|
10
|
+
>
|
|
11
|
+
<dl-bar-chart
|
|
12
|
+
:legend-props="legendProps"
|
|
13
|
+
:data="data"
|
|
14
|
+
:options="options"
|
|
15
|
+
:items-in-view="6"
|
|
16
|
+
/>
|
|
17
|
+
</div>
|
|
18
|
+
</template>
|
|
19
|
+
|
|
20
|
+
<script lang="ts">
|
|
21
|
+
import { defineComponent } from 'vue-demi'
|
|
22
|
+
import DlBarChart from '../components/DlChart/DlBarChart.vue'
|
|
23
|
+
|
|
24
|
+
const labelsFn = () => {
|
|
25
|
+
const a = []
|
|
26
|
+
for (let i = 0; i < 20; i++) {
|
|
27
|
+
a.push(`${i}`)
|
|
28
|
+
}
|
|
29
|
+
return a
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const dataFn = () => {
|
|
33
|
+
const a = []
|
|
34
|
+
for (let i = 1; i <= 20; i++) {
|
|
35
|
+
a.push(i)
|
|
36
|
+
}
|
|
37
|
+
return a
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const data = {
|
|
41
|
+
labels: labelsFn(),
|
|
42
|
+
datasets: [
|
|
43
|
+
{
|
|
44
|
+
label: 'Data One',
|
|
45
|
+
backgroundColor: '--dl-color-secondary',
|
|
46
|
+
borderRadius: 4,
|
|
47
|
+
data: dataFn()
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
label: 'Data Two',
|
|
51
|
+
backgroundColor: '--dl-color-warning',
|
|
52
|
+
borderRadius: 4,
|
|
53
|
+
data: dataFn()
|
|
54
|
+
}
|
|
55
|
+
]
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const legendProps = {
|
|
59
|
+
alignItems: 'center'
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export default defineComponent({
|
|
63
|
+
name: 'DlChartDemo',
|
|
64
|
+
components: {
|
|
65
|
+
DlBarChart
|
|
66
|
+
},
|
|
67
|
+
data() {
|
|
68
|
+
return {
|
|
69
|
+
data,
|
|
70
|
+
legendProps
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
methods: {}
|
|
74
|
+
})
|
|
75
|
+
</script>
|
|
76
|
+
|
|
77
|
+
<style scoped lang="scss"></style>
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
style="
|
|
4
|
+
display: flex;
|
|
5
|
+
width: 800px;
|
|
6
|
+
flex-wrap: wrap;
|
|
7
|
+
flex-direction: row;
|
|
8
|
+
gap: 0;
|
|
9
|
+
"
|
|
10
|
+
>
|
|
11
|
+
<dl-column-chart
|
|
12
|
+
:brush-props="brushProps"
|
|
13
|
+
:legend-props="legendProps"
|
|
14
|
+
:data="data[0]"
|
|
15
|
+
:options="options[0]"
|
|
16
|
+
style="width: 50%"
|
|
17
|
+
/>
|
|
18
|
+
<dl-column-chart
|
|
19
|
+
:brush-props="brushProps"
|
|
20
|
+
:legend-props="legendProps"
|
|
21
|
+
:data="data[1]"
|
|
22
|
+
:options="options[1]"
|
|
23
|
+
style="width: 50%"
|
|
24
|
+
>
|
|
25
|
+
<template #axe-x-labels="{ labels, chartWidth }">
|
|
26
|
+
<div
|
|
27
|
+
:style="`display: flex; width: ${chartWidth}; align-self: flex-end; justify-content: space-between;`"
|
|
28
|
+
>
|
|
29
|
+
<div
|
|
30
|
+
v-for="(url, key) in labels"
|
|
31
|
+
:key="key"
|
|
32
|
+
style="
|
|
33
|
+
display: flex;
|
|
34
|
+
width: 100%;
|
|
35
|
+
justify-content: center;
|
|
36
|
+
"
|
|
37
|
+
>
|
|
38
|
+
<dl-avatar size="24px">
|
|
39
|
+
<img :src="url">
|
|
40
|
+
</dl-avatar>
|
|
41
|
+
<div />
|
|
42
|
+
</div>
|
|
43
|
+
</div>
|
|
44
|
+
</template>
|
|
45
|
+
</dl-column-chart>
|
|
46
|
+
|
|
47
|
+
<dl-column-chart
|
|
48
|
+
:brush-props="brushProps"
|
|
49
|
+
:legend-props="legendProps"
|
|
50
|
+
:data="data[0]"
|
|
51
|
+
:options="options[0]"
|
|
52
|
+
style="width: 100%"
|
|
53
|
+
/>
|
|
54
|
+
</div>
|
|
55
|
+
</template>
|
|
56
|
+
|
|
57
|
+
<script lang="ts">
|
|
58
|
+
import { defineComponent } from 'vue-demi'
|
|
59
|
+
import DlColumnChart from '../components/DlChart/DlColumnChart.vue'
|
|
60
|
+
import DlAvatar from '../components/DlAvatar.vue'
|
|
61
|
+
|
|
62
|
+
import { orderBy } from 'lodash'
|
|
63
|
+
|
|
64
|
+
import {
|
|
65
|
+
Chart as ChartJS,
|
|
66
|
+
Title,
|
|
67
|
+
Tooltip,
|
|
68
|
+
Legend,
|
|
69
|
+
BarElement,
|
|
70
|
+
CategoryScale,
|
|
71
|
+
LinearScale
|
|
72
|
+
} from 'chart.js'
|
|
73
|
+
|
|
74
|
+
ChartJS.register(CategoryScale, LinearScale, BarElement, Title, Tooltip, Legend)
|
|
75
|
+
|
|
76
|
+
const data = [
|
|
77
|
+
{
|
|
78
|
+
labels: [
|
|
79
|
+
'JanuaryJanuaryJanuaryJanuary',
|
|
80
|
+
'February',
|
|
81
|
+
'March',
|
|
82
|
+
'April',
|
|
83
|
+
'May',
|
|
84
|
+
'June'
|
|
85
|
+
],
|
|
86
|
+
datasets: [
|
|
87
|
+
{
|
|
88
|
+
label: 'Data One 1',
|
|
89
|
+
backgroundColor: '--dl-color-secondary',
|
|
90
|
+
borderRadius: 4,
|
|
91
|
+
data: [35, 30, 25, 20, 15, 5]
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
label: 'Data Two 2',
|
|
95
|
+
backgroundColor: '--dl-color-warning',
|
|
96
|
+
borderRadius: 4,
|
|
97
|
+
data: [15, 20, 15, 30, 25, 10]
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
label: 'Data One 3',
|
|
101
|
+
backgroundColor: '--dl-color-negative',
|
|
102
|
+
borderRadius: 4,
|
|
103
|
+
data: [35, 30, 25, 20, 15, 5]
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
label: 'Data Two 4',
|
|
107
|
+
backgroundColor: '--dl-color-positive',
|
|
108
|
+
borderRadius: 4,
|
|
109
|
+
data: [15, 20, 15, 30, 25, 10]
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
label: 'Data One 5',
|
|
113
|
+
backgroundColor: '--dl-color-secondary',
|
|
114
|
+
borderRadius: 4,
|
|
115
|
+
data: [35, 30, 25, 20, 15, 5]
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
label: 'Data Two 6',
|
|
119
|
+
backgroundColor: '--dl-color-warning',
|
|
120
|
+
borderRadius: 4,
|
|
121
|
+
data: [15, 20, 15, 30, 25, 10]
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
label: 'Data One 7',
|
|
125
|
+
backgroundColor: '--dl-color-secondary',
|
|
126
|
+
borderRadius: 4,
|
|
127
|
+
data: [35, 30, 25, 20, 15, 5]
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
label: 'Data Two 8',
|
|
131
|
+
backgroundColor: '--dl-color-warning',
|
|
132
|
+
borderRadius: 4,
|
|
133
|
+
data: [15, 20, 15, 30, 25, 10]
|
|
134
|
+
}
|
|
135
|
+
]
|
|
136
|
+
},
|
|
137
|
+
|
|
138
|
+
{
|
|
139
|
+
labels: [
|
|
140
|
+
'https://picsum.photos/200/200',
|
|
141
|
+
'https://picsum.photos/200/200',
|
|
142
|
+
'https://picsum.photos/200/200',
|
|
143
|
+
'https://picsum.photos/200/200',
|
|
144
|
+
'https://picsum.photos/200/200',
|
|
145
|
+
'https://picsum.photos/200/200'
|
|
146
|
+
],
|
|
147
|
+
datasets: [
|
|
148
|
+
{
|
|
149
|
+
label: 'Data One',
|
|
150
|
+
backgroundColor: '--dl-color-secondary',
|
|
151
|
+
borderRadius: 4,
|
|
152
|
+
data: [35, 30, 25, 20, 15, 5]
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
label: 'Data Two',
|
|
156
|
+
backgroundColor: '--dl-color-warning',
|
|
157
|
+
borderRadius: 4,
|
|
158
|
+
data: [15, 20, 15, 30, 25, 10]
|
|
159
|
+
}
|
|
160
|
+
]
|
|
161
|
+
}
|
|
162
|
+
]
|
|
163
|
+
|
|
164
|
+
const brushProps = {
|
|
165
|
+
min: 0,
|
|
166
|
+
max: orderBy(data[0].datasets, (o) => o.data.length)[0].data.length - 1
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
const options = [
|
|
170
|
+
{
|
|
171
|
+
scales: {
|
|
172
|
+
y: {
|
|
173
|
+
ticks: {
|
|
174
|
+
callback(value: string, index: number, ticks: string[]) {
|
|
175
|
+
return value + 's'
|
|
176
|
+
}
|
|
177
|
+
},
|
|
178
|
+
suggestedMax: 45
|
|
179
|
+
},
|
|
180
|
+
x: {
|
|
181
|
+
min: 0,
|
|
182
|
+
max:
|
|
183
|
+
orderBy(data[0].datasets, (o) => o.data.length)[0].data
|
|
184
|
+
.length - 1
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
},
|
|
188
|
+
|
|
189
|
+
{
|
|
190
|
+
scales: {
|
|
191
|
+
y: {
|
|
192
|
+
ticks: {
|
|
193
|
+
callback(value: string, index: number, ticks: string[]) {
|
|
194
|
+
return value + 's'
|
|
195
|
+
}
|
|
196
|
+
},
|
|
197
|
+
suggestedMax: 45
|
|
198
|
+
},
|
|
199
|
+
x: {
|
|
200
|
+
min: 0,
|
|
201
|
+
max:
|
|
202
|
+
orderBy(data[1].datasets, (o) => o.data.length)[0].data
|
|
203
|
+
.length - 1
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
]
|
|
208
|
+
|
|
209
|
+
const legendProps = {
|
|
210
|
+
alignItems: 'center'
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
export default defineComponent({
|
|
214
|
+
name: 'DlColumnChartDemo',
|
|
215
|
+
components: {
|
|
216
|
+
DlColumnChart,
|
|
217
|
+
DlAvatar
|
|
218
|
+
},
|
|
219
|
+
data() {
|
|
220
|
+
return {
|
|
221
|
+
options,
|
|
222
|
+
data,
|
|
223
|
+
brushProps,
|
|
224
|
+
legendProps
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
})
|
|
228
|
+
</script>
|
|
229
|
+
|
|
230
|
+
<style scoped lang="scss"></style>
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div style="display: flex; flex-wrap: wrap; flex-direction: row; gap: 0">
|
|
3
|
+
<div>
|
|
4
|
+
<div>
|
|
5
|
+
<DlDoughnutChart
|
|
6
|
+
:data="doughnutLessData"
|
|
7
|
+
:animation="doughnutAnimation"
|
|
8
|
+
/>
|
|
9
|
+
</div>
|
|
10
|
+
<div>
|
|
11
|
+
<DlDoughnutChart :data="doughnutData" />
|
|
12
|
+
</div>
|
|
13
|
+
<div>
|
|
14
|
+
<DlDoughnutChart
|
|
15
|
+
:data="doughnutData"
|
|
16
|
+
:has-summary="true"
|
|
17
|
+
/>
|
|
18
|
+
</div>
|
|
19
|
+
<div class="grid grid-cols-3">
|
|
20
|
+
<div>
|
|
21
|
+
<DlDoughnutChart
|
|
22
|
+
:data="doughnutData"
|
|
23
|
+
:is-small="true"
|
|
24
|
+
:has-summary="true"
|
|
25
|
+
/>
|
|
26
|
+
</div>
|
|
27
|
+
<div>
|
|
28
|
+
<DlDoughnutChart
|
|
29
|
+
:data="doughnutLessData"
|
|
30
|
+
:is-small="true"
|
|
31
|
+
/>
|
|
32
|
+
</div>
|
|
33
|
+
<div>
|
|
34
|
+
<DlDoughnutChart
|
|
35
|
+
:data="doughnutData"
|
|
36
|
+
:is-small="true"
|
|
37
|
+
:has-summary="true"
|
|
38
|
+
/>
|
|
39
|
+
</div>
|
|
40
|
+
</div>
|
|
41
|
+
<div class="grid grid-cols-2">
|
|
42
|
+
<div>
|
|
43
|
+
<DlDoughnutChart
|
|
44
|
+
:data="doughnutData"
|
|
45
|
+
:is-small="true"
|
|
46
|
+
/>
|
|
47
|
+
</div>
|
|
48
|
+
<div>
|
|
49
|
+
<DlDoughnutChart
|
|
50
|
+
:data="doughnutLessData"
|
|
51
|
+
:is-small="true"
|
|
52
|
+
/>
|
|
53
|
+
</div>
|
|
54
|
+
</div>
|
|
55
|
+
<div>
|
|
56
|
+
<DlDoughnutChart
|
|
57
|
+
:data="doughnutData"
|
|
58
|
+
:is-small="true"
|
|
59
|
+
:has-summary="true"
|
|
60
|
+
:animation="doughnutAnimation"
|
|
61
|
+
/>
|
|
62
|
+
</div>
|
|
63
|
+
</div>
|
|
64
|
+
</div>
|
|
65
|
+
</template>
|
|
66
|
+
|
|
67
|
+
<script lang="ts">
|
|
68
|
+
import { defineComponent, ref } from 'vue-demi'
|
|
69
|
+
import DlDoughnutChart from '../components/DlChart/Doughnut/DlDoughnutChart.vue'
|
|
70
|
+
import { DoughnutControllerChartOptions } from 'chart.js'
|
|
71
|
+
import { TDoughnutChartData } from '../components/DlChart/Doughnut/types/TDoughnutChartData'
|
|
72
|
+
|
|
73
|
+
export default defineComponent({
|
|
74
|
+
name: 'DlChartDoughnutDemo',
|
|
75
|
+
components: {
|
|
76
|
+
DlDoughnutChart
|
|
77
|
+
},
|
|
78
|
+
setup() {
|
|
79
|
+
const doughnutAnimation = ref<
|
|
80
|
+
DoughnutControllerChartOptions['animation']
|
|
81
|
+
>({
|
|
82
|
+
animateRotate: true,
|
|
83
|
+
animateScale: true
|
|
84
|
+
})
|
|
85
|
+
|
|
86
|
+
const doughnutData: TDoughnutChartData = {
|
|
87
|
+
labels: [
|
|
88
|
+
'Label 1 very very very very very very very long title',
|
|
89
|
+
'Label 2',
|
|
90
|
+
'Label 3',
|
|
91
|
+
'Label 4',
|
|
92
|
+
'Label 5',
|
|
93
|
+
'Label 6',
|
|
94
|
+
'Label 7',
|
|
95
|
+
'Label 8',
|
|
96
|
+
'Label 9',
|
|
97
|
+
'Label 10',
|
|
98
|
+
'Label 11',
|
|
99
|
+
'Label 12',
|
|
100
|
+
'Label 13',
|
|
101
|
+
'Label 14',
|
|
102
|
+
'Label 15',
|
|
103
|
+
'Label 16',
|
|
104
|
+
'Label 17',
|
|
105
|
+
'Label 18',
|
|
106
|
+
'Label 19',
|
|
107
|
+
'Label 20'
|
|
108
|
+
],
|
|
109
|
+
datasets: [
|
|
110
|
+
{
|
|
111
|
+
label: 'My Doughnut',
|
|
112
|
+
data: [
|
|
113
|
+
9999, 200, 300, 400, 500, 600, 700, 800, 900, 1000,
|
|
114
|
+
1100, 1200, 1000, 1400, 1500, 1600, 1700, 1800, 1900,
|
|
115
|
+
2000
|
|
116
|
+
],
|
|
117
|
+
backgroundColor: [
|
|
118
|
+
'#3452FF',
|
|
119
|
+
'#4DB1D3',
|
|
120
|
+
'#FF2F7A',
|
|
121
|
+
'#D4E3FF',
|
|
122
|
+
'#BECB5D',
|
|
123
|
+
'#839E30',
|
|
124
|
+
'#6B5935',
|
|
125
|
+
'#752B86',
|
|
126
|
+
'#BB96A3',
|
|
127
|
+
'#870F49',
|
|
128
|
+
'#CC566C',
|
|
129
|
+
'#F0A18C',
|
|
130
|
+
'#EDAB55',
|
|
131
|
+
'#FF5934',
|
|
132
|
+
'#9CD2E3',
|
|
133
|
+
'#1481A4',
|
|
134
|
+
'#928F80',
|
|
135
|
+
'#575567',
|
|
136
|
+
'#979797',
|
|
137
|
+
'#D9D9D9'
|
|
138
|
+
],
|
|
139
|
+
hoverBackgroundColor: [
|
|
140
|
+
'#3452FF',
|
|
141
|
+
'#4DB1D3',
|
|
142
|
+
'#FF2F7A',
|
|
143
|
+
'#D4E3FF',
|
|
144
|
+
'#BECB5D',
|
|
145
|
+
'#839E30',
|
|
146
|
+
'#6B5935',
|
|
147
|
+
'#752B86',
|
|
148
|
+
'#BB96A3',
|
|
149
|
+
'#870F49',
|
|
150
|
+
'#CC566C',
|
|
151
|
+
'#F0A18C',
|
|
152
|
+
'#EDAB55',
|
|
153
|
+
'#FF5934',
|
|
154
|
+
'#9CD2E3',
|
|
155
|
+
'#1481A4',
|
|
156
|
+
'#928F80',
|
|
157
|
+
'#575567',
|
|
158
|
+
'#979797',
|
|
159
|
+
'#D9D9D9'
|
|
160
|
+
],
|
|
161
|
+
lightColor: [
|
|
162
|
+
'#D6DCFF',
|
|
163
|
+
'#EDF7FB',
|
|
164
|
+
'#FFCBDD',
|
|
165
|
+
'#F4F8FF',
|
|
166
|
+
'#EFF2D7',
|
|
167
|
+
'#E0E7CB',
|
|
168
|
+
'#DAD5CD',
|
|
169
|
+
'#DDCAE1',
|
|
170
|
+
'#DDCBD1',
|
|
171
|
+
'#DDCBD1',
|
|
172
|
+
'#F2D5DA',
|
|
173
|
+
'#FBE7E2',
|
|
174
|
+
'#FBEAD5',
|
|
175
|
+
'#FFD5CC',
|
|
176
|
+
'#E7F4F8',
|
|
177
|
+
'#C4DFE8',
|
|
178
|
+
'#E4E3DF',
|
|
179
|
+
'#D5D5D9',
|
|
180
|
+
'#E5E5E5',
|
|
181
|
+
'#F5F5F5'
|
|
182
|
+
],
|
|
183
|
+
borderWidth: 0
|
|
184
|
+
}
|
|
185
|
+
]
|
|
186
|
+
}
|
|
187
|
+
const doughnutLessData: TDoughnutChartData = {
|
|
188
|
+
labels: [
|
|
189
|
+
'Label 1 very very very very very very very long title',
|
|
190
|
+
'Label 2',
|
|
191
|
+
'Label 3',
|
|
192
|
+
'Label 4'
|
|
193
|
+
],
|
|
194
|
+
datasets: [
|
|
195
|
+
{
|
|
196
|
+
label: 'My Doughnut',
|
|
197
|
+
data: [999, 2000, 300, 400],
|
|
198
|
+
backgroundColor: [
|
|
199
|
+
'--dl-color-secondary',
|
|
200
|
+
'#4DB1D3',
|
|
201
|
+
'#FF2F7A',
|
|
202
|
+
'#D4E3FF'
|
|
203
|
+
],
|
|
204
|
+
hoverBackgroundColor: [
|
|
205
|
+
'--dl-color-secondary',
|
|
206
|
+
'#4DB1D3',
|
|
207
|
+
'#FF2F7A',
|
|
208
|
+
'#D4E3FF'
|
|
209
|
+
],
|
|
210
|
+
lightColor: [
|
|
211
|
+
'--dl-color-link',
|
|
212
|
+
'#EDF7FB',
|
|
213
|
+
'#FFCBDD',
|
|
214
|
+
'#F4F8FF'
|
|
215
|
+
],
|
|
216
|
+
borderWidth: 0
|
|
217
|
+
}
|
|
218
|
+
]
|
|
219
|
+
}
|
|
220
|
+
return {
|
|
221
|
+
doughnutData,
|
|
222
|
+
doughnutLessData,
|
|
223
|
+
doughnutAnimation
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
})
|
|
227
|
+
</script>
|
|
228
|
+
|
|
229
|
+
<style scoped lang="scss"></style>
|