size update

This commit is contained in:
Nate Kelley 2025-04-11 21:06:30 -06:00
parent cfc314d9eb
commit 82ad2b1a99
No known key found for this signature in database
GPG Key ID: FD90372AB8D98B4F
2 changed files with 9 additions and 8 deletions

View File

@ -17,6 +17,7 @@ import {
} from '@/api/asset_interfaces/metric/charts';
import { determineFontColorContrast } from '@/lib/colors';
import { Context } from 'chartjs-plugin-datalabels';
import clamp from 'lodash/clamp';
type PieOptions = ChartProps<'pie'>['options'] | ChartProps<'doughnut'>['options'];
@ -70,13 +71,10 @@ export const piePluginsHandler = ({
)
];
},
font: ({ chart }) => {
const minDimension = Math.min(chart.width, chart.height);
return [
{ size: Math.max(20, minDimension * 0.02) }, // title font
{ size: Math.max(42, minDimension * 0.042) } // value font
];
},
font: [
{ size: 16 }, // title font
{ size: 28 } // value font
],
color: [titleColor, valueColor]
}
}

View File

@ -144,6 +144,7 @@ export const ResizableContainer: Story = {
args: {
selectedChartType: ChartType.Pie,
data: generatePieChartData(),
pieChartAxis: {
x: ['segment'],
y: ['value']
@ -160,7 +161,9 @@ export const ResizableContainer: Story = {
} satisfies IColumnLabelFormat
} satisfies Record<keyof PieChartData, IColumnLabelFormat>,
pieDisplayLabelAs: 'percent',
pieDonutWidth: 0
pieDonutWidth: 0.6,
pieInnerLabelTitle: 'Total',
pieInnerLabelAggregate: 'sum'
},
parameters: {
docs: {