mirror of https://github.com/buster-so/buster.git
Update chartjs-plugin-tick-duplicate.ts
This commit is contained in:
parent
ec4a851bda
commit
ddde654a0a
|
@ -4,17 +4,6 @@ declare module 'chart.js' {
|
||||||
interface PluginOptionsByType<TType extends ChartType> {}
|
interface PluginOptionsByType<TType extends ChartType> {}
|
||||||
}
|
}
|
||||||
|
|
||||||
const safeFormat = (adapter, value, formatStr) => {
|
|
||||||
try {
|
|
||||||
return adapter.format(value, formatStr);
|
|
||||||
} catch {
|
|
||||||
console.log('safeFormat', value, formatStr);
|
|
||||||
// fallback to toISOString + slicing or your own logic
|
|
||||||
const date = new Date(value);
|
|
||||||
return date.toLocaleString('default', { month: 'short' }); // e.g., 'Jan'
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
export const ChartJSTickDuplicatePlugin: Plugin<ChartType> = {
|
export const ChartJSTickDuplicatePlugin: Plugin<ChartType> = {
|
||||||
id: 'chartjs-plugin-tick-duplicate',
|
id: 'chartjs-plugin-tick-duplicate',
|
||||||
afterBuildTicks(chart) {
|
afterBuildTicks(chart) {
|
||||||
|
|
Loading…
Reference in New Issue