From 6ee6b9dfb0742044dc498d002f38467d3d25b28a Mon Sep 17 00:00:00 2001 From: ulleo Date: Thu, 15 Aug 2024 14:33:07 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E5=9B=BE=E8=A1=A8):=20=E5=8C=BA=E9=97=B4?= =?UTF-8?q?=E6=9D=A1=E5=BD=A2=E5=9B=BE=E9=80=89=E6=8B=A9=E6=97=B6=E9=97=B4?= =?UTF-8?q?=E8=8C=83=E5=9B=B4=E5=90=8E=EF=BC=8C=E6=A8=AA=E8=BD=B4=E6=A0=BC?= =?UTF-8?q?=E5=BC=8F=E8=B7=9F=E9=9A=8F=E6=8C=87=E6=A0=87=E7=9A=84=E6=97=A5?= =?UTF-8?q?=E6=9C=9F=E6=98=BE=E7=A4=BA=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #11346 --- .../editor/drag-item/DimensionItem.vue | 2 ++ .../js/panel/charts/bar/range-bar.ts | 33 +++++++++++++++++-- 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/core/core-frontend/src/views/chart/components/editor/drag-item/DimensionItem.vue b/core/core-frontend/src/views/chart/components/editor/drag-item/DimensionItem.vue index c3a58e9980..ca5213d124 100644 --- a/core/core-frontend/src/views/chart/components/editor/drag-item/DimensionItem.vue +++ b/core/core-frontend/src/views/chart/components/editor/drag-item/DimensionItem.vue @@ -412,6 +412,7 @@ onMounted(() => { @@ -428,6 +429,7 @@ onMounted(() => { { const isDate = !!chart.data.isDate + const axis = chart.yAxis ?? chart.yAxisExt ?? [] + let dateFormat: string + const dateSplit = axis[0]?.datePattern === 'date_split' ? '/' : '-' + switch (axis[0]?.dateStyle) { + case 'y': + dateFormat = 'YYYY' + break + case 'y_M': + dateFormat = 'YYYY' + dateSplit + 'MM' + break + case 'y_M_d': + dateFormat = 'YYYY' + dateSplit + 'MM' + dateSplit + 'DD' + break + // case 'H_m_s': + // dateFormat = 'HH:mm:ss' + // break + case 'y_M_d_H': + dateFormat = 'YYYY' + dateSplit + 'MM' + dateSplit + 'DD' + ' HH' + break + case 'y_M_d_H_m': + dateFormat = 'YYYY' + dateSplit + 'MM' + dateSplit + 'DD' + ' HH:mm' + break + case 'y_M_d_H_m_s': + dateFormat = 'YYYY' + dateSplit + 'MM' + dateSplit + 'DD' + ' HH:mm:ss' + break + default: + dateFormat = 'YYYY-MM-dd HH:mm:ss' + } + const minTime = chart.data.minTime const maxTime = chart.data.maxTime @@ -143,7 +172,7 @@ export class RangeBar extends G2PlotChartView { type: 'time', min: minTime, max: maxTime, - mask: 'YYYY-MM-DD HH:mm:ss' + mask: dateFormat }, tempId: { key: true @@ -153,7 +182,7 @@ export class RangeBar extends G2PlotChartView { values: { min: minNumber, max: maxNumber, - mask: 'YYYY-MM-DD HH:mm:ss' + mask: dateFormat }, tempId: { key: true