Skip to content

Commit

Permalink
Add date formatter WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
katrinDY committed May 13, 2024
1 parent afd07a2 commit 31be819
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 0 deletions.
15 changes: 15 additions & 0 deletions client/web/compose/src/components/Chart/Report/FunnelChart.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,21 @@
@update:value="setOptions(index, field, $event)"
/>
</b-form-group>
<b-row>
<b-col
cols="12"
lg="6"
>
<b-form-group
label="Format data type values"
label-class="text-primary"
>
<b-input
v-model="dimension.dateFormatter"
/>
</b-form-group>
</b-col>
</b-row>
</template>

<template #metric-options="{ metric, presetFormattedOptions }">
Expand Down
14 changes: 14 additions & 0 deletions client/web/compose/src/components/Chart/Report/GenericChart.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,20 @@
/>
</b-form-group>
</b-col>

<b-col
cols="12"
lg="6"
>
<b-form-group
label="Format data type values"
label-class="text-primary"
>
<b-input
v-model="dimension.dateFormatter"
/>
</b-form-group>
</b-col>
</b-row>
</template>

Expand Down
14 changes: 14 additions & 0 deletions client/web/compose/src/components/Chart/Report/RadarChart.vue
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,20 @@
/>
</b-form-group>
</b-col>

<b-col
cols="12"
lg="6"
>
<b-form-group
label="Format data type values"
label-class="text-primary"
>
<b-input
v-model="dimension.dateFormatter"
/>
</b-form-group>
</b-col>
</b-row>
</template>
</report-edit>
Expand Down
1 change: 1 addition & 0 deletions lib/js/src/compose/types/chart/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,7 @@ export class BaseChart {
conditions: {},
meta: {},
rotateLabel: 0,
dateFormatter: '',
})
}

Expand Down
5 changes: 5 additions & 0 deletions lib/js/src/compose/types/chart/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ export interface Dimension {
timeLabels?: boolean;
autoSkip?: boolean;
rotateLabel?: number;
dateFormatter?: string;
}

export interface Metric {
Expand Down Expand Up @@ -317,6 +318,10 @@ export function formatChartValueAsAccountingNumber (value: number): string {
return result
}

export function dateFormatter (): Date {
return new Date()
}

const chartUtil = {
dimensionFunctions,
hasRelativeDisplay,
Expand Down
4 changes: 4 additions & 0 deletions lib/js/src/compose/types/module-field/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,3 +236,7 @@ export class ModuleField {
}

export const Registry = new Map<string, typeof ModuleField>()

export function getFieldType (fields:any, field: any): string {
return fields[field].kind
}

0 comments on commit 31be819

Please sign in to comment.