Skip to content

Commit

Permalink
fix(chart): support all time and date types for X axis
Browse files Browse the repository at this point in the history
Optimising data type rendering #24
  • Loading branch information
ZonaHex committed Dec 9, 2022
1 parent 68e956f commit 2d3664b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/store/modules/code-run/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { getSqlResult } from '@/api/editor'
import { Message } from '@arco-design/web-vue'
import { defineStore } from 'pinia'
import { dateTypes } from '@/views/dashboard/data-explorer/components/data-view/config'

// TODO: Add all the types we decide instead of ECharts if needed in the future.
// const TYPE_MAP: any = {
Expand All @@ -15,7 +16,7 @@ const getDimensionsAndXName = (elements: any) => {
let xAxisName = ''
let findTimeFlag = false
elements.forEach((element: any) => {
if (!findTimeFlag && element.data_type === 'Timestamp') {
if (!findTimeFlag && dateTypes.find((type: string) => type === element.data_type)) {
findTimeFlag = true
xAxisName = element.name
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,5 @@ export const numberTypes = [
'Float32',
'Float64',
]

export const dateTypes = ['Date', 'DateTime', 'Timestamp']

0 comments on commit 2d3664b

Please sign in to comment.