@dataloop-ai/components 0.19.245 → 0.19.248
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dataloop-ai/components",
|
|
3
|
-
"version": "0.19.
|
|
3
|
+
"version": "0.19.248",
|
|
4
4
|
"exports": {
|
|
5
5
|
".": "./index.ts",
|
|
6
6
|
"./models": "./models.ts",
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
"@types/lodash": "^4.14.184",
|
|
28
28
|
"@types/sortablejs": "^1.15.7",
|
|
29
29
|
"chart.js": "^3.9.1",
|
|
30
|
+
"chartjs-plugin-datalabels": "^2.2.0",
|
|
30
31
|
"flat": "^5.0.2",
|
|
31
32
|
"highlight.js": "^11.8.0",
|
|
32
33
|
"lodash": "^4.17.21",
|
|
@@ -40,8 +41,7 @@
|
|
|
40
41
|
"vanilla-jsoneditor": "^0.10.2",
|
|
41
42
|
"vue-demi": "^0.14.5",
|
|
42
43
|
"vue-sortable": "^0.1.3",
|
|
43
|
-
"vue2-teleport": "^1.0.1"
|
|
44
|
-
"zero-md": "^2.5.3"
|
|
44
|
+
"vue2-teleport": "^1.0.1"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@babel/core": "^7.17.9",
|
|
@@ -1,21 +1,9 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div :class="chartWrapperClasses">
|
|
3
|
-
<div
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
<dl-empty-state
|
|
8
|
-
v-if="isEmpty"
|
|
9
|
-
v-bind="emptyStateProps"
|
|
10
|
-
>
|
|
11
|
-
<template
|
|
12
|
-
v-for="(_, slot) in $slots"
|
|
13
|
-
#[slot]="props"
|
|
14
|
-
>
|
|
15
|
-
<slot
|
|
16
|
-
:name="slot"
|
|
17
|
-
v-bind="props"
|
|
18
|
-
/>
|
|
3
|
+
<div class="canvas-container" :style="`height: ${wrapperHeight}`">
|
|
4
|
+
<dl-empty-state v-if="isEmpty" v-bind="emptyStateProps">
|
|
5
|
+
<template v-for="(_, slot) in $slots" #[slot]="props">
|
|
6
|
+
<slot :name="slot" v-bind="props" />
|
|
19
7
|
</template>
|
|
20
8
|
</dl-empty-state>
|
|
21
9
|
<Bar
|
|
@@ -26,11 +14,12 @@
|
|
|
26
14
|
:style="chartStyles"
|
|
27
15
|
:data="chartData"
|
|
28
16
|
:options="chartOptions"
|
|
17
|
+
:plugins="chartPlugins"
|
|
29
18
|
@mouseout="onChartLeave"
|
|
30
19
|
@wheel.native="handleChartScroll"
|
|
31
20
|
/>
|
|
32
21
|
<dl-chart-scroll-bar
|
|
33
|
-
v-if="
|
|
22
|
+
v-if="maxItems > thisItemsInView && !isEmpty"
|
|
34
23
|
:wrapper-styles="{
|
|
35
24
|
marginTop: '10px'
|
|
36
25
|
}"
|
|
@@ -391,6 +380,8 @@ export default defineComponent({
|
|
|
391
380
|
)
|
|
392
381
|
)
|
|
393
382
|
|
|
383
|
+
const chartPlugins = props.plugins
|
|
384
|
+
|
|
394
385
|
watch(
|
|
395
386
|
() => chart.value?.scales?.x?.width,
|
|
396
387
|
(val: string) => {
|
|
@@ -541,13 +532,14 @@ export default defineComponent({
|
|
|
541
532
|
)
|
|
542
533
|
)
|
|
543
534
|
|
|
544
|
-
chart.value.update()
|
|
535
|
+
chart.value.update?.()
|
|
545
536
|
})
|
|
546
537
|
|
|
547
538
|
return {
|
|
548
539
|
variables,
|
|
549
540
|
chartData,
|
|
550
541
|
chartOptions,
|
|
542
|
+
chartPlugins,
|
|
551
543
|
xLabels,
|
|
552
544
|
barChart,
|
|
553
545
|
maxItems,
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
display: flex;
|
|
5
5
|
width: 900px;
|
|
6
6
|
flex-wrap: wrap;
|
|
7
|
-
flex-direction:
|
|
7
|
+
flex-direction: column;
|
|
8
8
|
gap: 0px;
|
|
9
9
|
"
|
|
10
10
|
>
|
|
@@ -22,6 +22,19 @@
|
|
|
22
22
|
:items-in-view="6"
|
|
23
23
|
is-empty
|
|
24
24
|
/>
|
|
25
|
+
|
|
26
|
+
<div style="color: var(--dl-color-darker); margin-bottom: 30px">
|
|
27
|
+
Customized DlBarChart with data labels
|
|
28
|
+
</div>
|
|
29
|
+
<!-- @vue-ignore -->
|
|
30
|
+
<dl-bar-chart
|
|
31
|
+
:data="cdlData"
|
|
32
|
+
:options="cdlOptions"
|
|
33
|
+
:plugins="cdlPlugins"
|
|
34
|
+
:items-in-view="data.labels.length + 1"
|
|
35
|
+
>
|
|
36
|
+
<template #legend><span /></template>
|
|
37
|
+
</dl-bar-chart>
|
|
25
38
|
</div>
|
|
26
39
|
</template>
|
|
27
40
|
|
|
@@ -29,6 +42,7 @@
|
|
|
29
42
|
import { defineComponent } from 'vue-demi'
|
|
30
43
|
import { ChartOptions } from 'chart.js'
|
|
31
44
|
import { DlBarChart } from '../components'
|
|
45
|
+
import ChartDataLabels from 'chartjs-plugin-datalabels'
|
|
32
46
|
|
|
33
47
|
const labelsFn = () => {
|
|
34
48
|
const a = []
|
|
@@ -78,6 +92,76 @@ const options: ChartOptions = {
|
|
|
78
92
|
}
|
|
79
93
|
}
|
|
80
94
|
|
|
95
|
+
const cdlData = {
|
|
96
|
+
labels: labelsFn().map((l) => `Data [${l}]:`),
|
|
97
|
+
datasets: [
|
|
98
|
+
{
|
|
99
|
+
label: 'Duh',
|
|
100
|
+
backgroundColor: '--dl-color-secondary',
|
|
101
|
+
borderRadius: 4,
|
|
102
|
+
data: dataFn(),
|
|
103
|
+
datalabels: {
|
|
104
|
+
align: 'end',
|
|
105
|
+
anchor: 'start'
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
label: 'Duh',
|
|
110
|
+
backgroundColor: '--dl-color-info-background',
|
|
111
|
+
borderRadius: 4,
|
|
112
|
+
data: dataFn().map((n) => 20 - n),
|
|
113
|
+
datalabels: {
|
|
114
|
+
align: 'start',
|
|
115
|
+
anchor: 'end'
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
]
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
const cdlOptions: ChartOptions = {
|
|
122
|
+
plugins: {
|
|
123
|
+
datalabels: {
|
|
124
|
+
color: '--dl-color-darker',
|
|
125
|
+
font: {
|
|
126
|
+
weight: 'bold'
|
|
127
|
+
},
|
|
128
|
+
formatter (value, context) {
|
|
129
|
+
switch (context.datasetIndex) {
|
|
130
|
+
case 0:
|
|
131
|
+
return context.chart.data.labels[context.dataIndex]
|
|
132
|
+
case 1:
|
|
133
|
+
return (
|
|
134
|
+
'Value is ' +
|
|
135
|
+
context.chart.data.datasets[0].data[
|
|
136
|
+
context.dataIndex
|
|
137
|
+
]
|
|
138
|
+
)
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
tooltip: {
|
|
143
|
+
callbacks: {
|
|
144
|
+
label (tooltipItem) {
|
|
145
|
+
return 'Value is ' + tooltipItem.formattedValue
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
filter (tooltipItem) {
|
|
149
|
+
return tooltipItem.datasetIndex === 0
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
},
|
|
153
|
+
scales: {
|
|
154
|
+
x: {
|
|
155
|
+
stacked: true,
|
|
156
|
+
display: false
|
|
157
|
+
},
|
|
158
|
+
y: {
|
|
159
|
+
stacked: true,
|
|
160
|
+
display: false
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
81
165
|
export default defineComponent({
|
|
82
166
|
name: 'DlChartDemo',
|
|
83
167
|
components: {
|
|
@@ -85,6 +169,9 @@ export default defineComponent({
|
|
|
85
169
|
},
|
|
86
170
|
data() {
|
|
87
171
|
return {
|
|
172
|
+
cdlData,
|
|
173
|
+
cdlOptions,
|
|
174
|
+
cdlPlugins: [ChartDataLabels],
|
|
88
175
|
data,
|
|
89
176
|
options,
|
|
90
177
|
legendProps
|