@dataloop-ai/components 0.16.20 → 0.16.22
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/components/compound/DlCharts/charts/DlColumnChart/DlColumnChart.vue +12 -1
- package/src/components/compound/DlCharts/types/props.ts +1 -0
- package/src/components/compound/DlCharts/utils.ts +7 -0
- package/src/components/compound/DlDateTime/DlDateTimeRange/DlDateTimeRange.vue +8 -2
package/package.json
CHANGED
|
@@ -101,6 +101,7 @@ import {
|
|
|
101
101
|
import type { Chart, ChartMeta, ChartDataset, ActiveElement } from 'chart.js'
|
|
102
102
|
import { unionBy, orderBy, merge, isEqual } from 'lodash'
|
|
103
103
|
import { useThemeVariables } from '../../../../../hooks/use-theme'
|
|
104
|
+
import { getMaxDatasetValue } from '../../utils'
|
|
104
105
|
|
|
105
106
|
ChartJS.register(
|
|
106
107
|
Title,
|
|
@@ -365,7 +366,17 @@ export default defineComponent({
|
|
|
365
366
|
const chartOptions = reactive(
|
|
366
367
|
updateKey(
|
|
367
368
|
merge(
|
|
368
|
-
{
|
|
369
|
+
{
|
|
370
|
+
onResize,
|
|
371
|
+
onHover,
|
|
372
|
+
scales: {
|
|
373
|
+
y: {
|
|
374
|
+
suggestedMax: getMaxDatasetValue(
|
|
375
|
+
chartData.value.datasets
|
|
376
|
+
)
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
},
|
|
369
380
|
defaultColumnChartProps.options,
|
|
370
381
|
props.options
|
|
371
382
|
),
|
|
@@ -151,3 +151,10 @@ export function getElementsAtEvent(chart: Chart, event: MouseEvent) {
|
|
|
151
151
|
false
|
|
152
152
|
)
|
|
153
153
|
}
|
|
154
|
+
|
|
155
|
+
export const getMaxDatasetValue = (chartDataset: [{ data: number[] }]) => {
|
|
156
|
+
return Math.max.apply(
|
|
157
|
+
null,
|
|
158
|
+
chartDataset.map((data) => [...data.data]).flat(1)
|
|
159
|
+
)
|
|
160
|
+
}
|
|
@@ -147,12 +147,18 @@ export default defineComponent({
|
|
|
147
147
|
{
|
|
148
148
|
title: 'today',
|
|
149
149
|
key: DAY_SIDEBAR_OPTION.today,
|
|
150
|
-
value: {
|
|
150
|
+
value: {
|
|
151
|
+
from: today,
|
|
152
|
+
to: new CustomDate(today).endOf('day').toDate()
|
|
153
|
+
}
|
|
151
154
|
},
|
|
152
155
|
{
|
|
153
156
|
title: 'yesterday',
|
|
154
157
|
key: DAY_SIDEBAR_OPTION.yesterday,
|
|
155
|
-
value: {
|
|
158
|
+
value: {
|
|
159
|
+
from: yesterday,
|
|
160
|
+
to: new CustomDate(yesterday).endOf('day').toDate()
|
|
161
|
+
}
|
|
156
162
|
},
|
|
157
163
|
{
|
|
158
164
|
title: 'last 7 days',
|