feat(dashboard): extend number format option to bar, line and pie charts (#23505)
https://discord.com/channels/1130383047699738754/1509604545381142649 Extends the Format option (Short/Full) added for the Number widget in #21521 to bar, line and pie charts. Format controls the numbers printed on the chart face: data labels and the pie center metric. Axis ticks stay abbreviated and tooltips always show the full value. Defaults to Short, so existing charts render unchanged. Server: nullable `numberFormat` on the bar/line/pie configuration DTOs, exposed in the dashboard AI tool schema. No migration, configuration is jsonb. Deferred: - The Format row has no visible effect while data labels are off, since tooltips are always full. - Number widget format defaults differ by field type (CURRENCY defaults to Short, NUMBER to Full). Pre-existing, untouched here. https://github.com/user-attachments/assets/0778f08a-6681-4e7a-8716-fb3026d1e01f <!-- This is an auto-generated description by cubic. --> <a href="https://cubic.dev/pr/twentyhq/twenty/pull/23505?utm_source=github" target="_blank" rel="noopener noreferrer" data-no-image-dialog="true"><picture><source media="(prefers-color-scheme: dark)" srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img alt="Review in cubic" src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a> <!-- End of auto-generated description by cubic. -->
This commit is contained in:
@@ -165,6 +165,12 @@ export const chartFilterSchema = z
|
||||
|
||||
const displayDataLabelSchema = z.boolean().optional();
|
||||
const displayLegendSchema = z.boolean().optional();
|
||||
const chartNumberFormatSchema = z
|
||||
.enum(CHART_NUMBER_FORMAT_OPTIONS)
|
||||
.optional()
|
||||
.describe(
|
||||
'Display format for data label values: SHORT abbreviates large numbers (1.3m), FULL shows the complete number (1,300,090). Tooltips always show the full value.',
|
||||
);
|
||||
const showCenterMetricSchema = z
|
||||
.boolean()
|
||||
.optional()
|
||||
@@ -391,6 +397,7 @@ const barChartConfigSchemaCore = z.object({
|
||||
.describe('Which axis labels to show'),
|
||||
displayDataLabel: displayDataLabelSchema,
|
||||
displayLegend: displayLegendSchema,
|
||||
numberFormat: chartNumberFormatSchema,
|
||||
groupMode: z
|
||||
.enum(BAR_CHART_GROUP_MODE_OPTIONS)
|
||||
.optional()
|
||||
@@ -482,6 +489,7 @@ const lineChartConfigSchemaCore = z.object({
|
||||
.describe('Which axis labels to show'),
|
||||
displayDataLabel: displayDataLabelSchema,
|
||||
displayLegend: displayLegendSchema,
|
||||
numberFormat: chartNumberFormatSchema,
|
||||
isStacked: z.boolean().optional().describe('Stack multiple lines'),
|
||||
isCumulative: z.boolean().optional().describe('Show running totals'),
|
||||
rangeMin: z.number().optional().describe('Y axis minimum value'),
|
||||
@@ -541,6 +549,7 @@ const pieChartConfigSchemaCore = z.object({
|
||||
color: z.enum(CHART_COLORS).optional().describe('Chart color theme'),
|
||||
displayDataLabel: displayDataLabelSchema,
|
||||
displayLegend: displayLegendSchema,
|
||||
numberFormat: chartNumberFormatSchema,
|
||||
showCenterMetric: showCenterMetricSchema,
|
||||
hideEmptyCategory: hideEmptyCategorySchema,
|
||||
filter: chartFilterSchema.optional(),
|
||||
|
||||
Reference in New Issue
Block a user