Remove scriptability from defaults.font types (#9794)

* Remove scriptability from defaults.font types

* Remove failing test
This commit is contained in:
Jukka Kurkela
2021-10-29 14:32:12 +03:00
committed by GitHub
parent 10106e4ec6
commit 1749e57918
3 changed files with 14 additions and 2 deletions

View File

@@ -1417,7 +1417,7 @@ export interface CoreChartOptions<TType extends ChartType> extends ParsingOption
* base font
* @see Defaults.font
*/
font: Scriptable<Partial<FontSpec>, ScriptableContext<TType>>;
font: Partial<FontSpec>;
/**
* Resizes the chart canvas when its container does (important note...).
* @default true

View File

@@ -7,3 +7,16 @@ Chart.defaults.plugins.title.display = false;
Chart.defaults.datasets.bar.backgroundColor = 'red';
Chart.defaults.animation = { duration: 500 };
Chart.defaults.font.size = 8;
// @ts-expect-error should be number
Chart.defaults.font.size = '8';
// @ts-expect-error should be number
Chart.defaults.font.size = () => '10';
Chart.defaults.font = {
family: "'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",
size: 10
};

View File

@@ -8,7 +8,6 @@ const getConfig = (): ChartConfiguration<'bar'> => {
},
options: {
backgroundColor: (context) => context.active ? '#fff' : undefined,
font: (context) => context.datasetIndex === 1 ? { size: 10 } : { size: 12, family: 'arial' }
}
};
};