In this video, we'll customize our React ChartJS pie chart by adding a custom legend! It can be common to want to trigger different behaviour when clicking an item in the legend. By combining this with the legend events we can create charts that toggle data series visibility on click of corresponding legend items. Clone via HTTPS Clone with Git or checkout with SVN using the repository’s web address. The legend label configuration is nested below the legend configuration using the labels key. The header property must contain the same number of items as the template. An item label displays the series title. When series have entries in the legend a particular point entry can be added to the legend by setting the points legendEntry_visible to true. Receives 3 parameters, two, If specified, this style of point is used for the legend. The chart legend displays data about the datasets that are appearing on the chart. Sets the click event handler for the legend, which is triggered when the user clicks on a legend item. Plugin that allows you to add extra events, like double / right click on each chart element, for Highcharts. Lets say we wanted instead to link the display of the first two datasets. With standard types like line, column and zooming enabled or with organizational type, clicking a point entry can scroll the point into view. Items passed to the legend onClick function are the ones returned from labels.generateLabels. The legend configuration is passed into the options.plugins.legend namespace. But I'm also trying to add an onClick event to the individual bars of the chart, and it's not finding the method I want it to call. Marks that this box should take the full width of the canvas (pushing down other boxes). Updating Datasets Dynamically. In chart js library legends defaultly have four postions (top,right,bottom,left). Some of the legend features include: Flexible and automated positioning Each series is represented by an item on a Legend. Some of the legend features include: The legend can be positioned anywhere around the chart area by setting the legend.position property. For example, a pie chart where entries represent slices can highlight or explode the pie slice. This tutorial describes how the legend can be manipulated. exporting), add