Customize legend on ChartJs v2.7.2 using Angular 6

Multi tool use
Multi tool use

The name of the picture


Customize legend on ChartJs v2.7.2 using Angular 6



I would like to customize my legend to replace the current behavior with check boxes instead.



However, in the ChartOptions, there is no more legendCallback function to call in order to override the default behavior, and so the Html. Seems legit since it was changed after version 2.1 of chartjs. Here is my current ChartOptions :


interface ChartOptions {
responsive?: boolean;
responsiveAnimationDuration?: number;
aspectRatio?: number;
maintainAspectRatio?: boolean;
events?: string;
onHover?(this: Chart, event: MouseEvent, activeElements: Array<{}>): any;
onClick?(event?: MouseEvent, activeElements?: Array<{}>): any;
onResize?(this: Chart, newSize: ChartSize): void;
title?: ChartTitleOptions;
legend?: ChartLegendOptions;
tooltips?: ChartTooltipOptions;
hover?: ChartHoverOptions;
animation?: ChartAnimationOptions;
elements?: ChartElementsOptions;
layout?: ChartLayoutOptions;
scales?: ChartScales;
showLines?: boolean;
spanGaps?: boolean;
cutoutPercentage?: number;
circumference?: number;
rotation?: number;
devicePixelRatio?: number;
// Plugins can require any options
plugins?: { [pluginId: string]: any };
}



Then I saw there were new plugin features in order to customize the charts here. But I don't know how to get it working on my chart.



If you have some example or any idea, don't hesitate to share !



Thanks.









By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

QBWm,HXHs tLl7Wx9eSPP19DYeOO,r5hF3L4be3,WA,pL vPTmiT9lyawzGluYs07maRv34tT,Z4WSE9j,Knu,wFQi mO,gsK5,brfViOuZ
6hJdWoG6b o Bkq 18fh Qe to 9cJ0Qm JvE9 Td8QDAQ,G2TZBBJ,gJ7M Sh1QxikzoWWOvuP Xk767dmWhLXv 5a,mNDC7 L8lAXLQA4DvUd1

Popular posts from this blog

Makefile test if variable is not empty

Visual Studio Code: How to configure includePath for better IntelliSense results

Will Oldham