score:0
try to use bind()
to bind context to a function.
public piechartoptions: chartoptions = {
responsive: true,
legend: {
position: 'left',
onclick: this.handleclick.bind(this, event, item)
},
title: {text: '', display: true}
};
handleclick(ev, item): void {
this.legendclick.emit(item.index)
}
Source: stackoverflow.com
Related Query
- How to add a custom event on legend click
- How to add an on click event to my Line chart using Chart.js
- How to add on click event to chart js
- How can I add functionality to Chartjs Doughnut chart custom legend
- Chart.js & Angular 2 - ng2-charts Custom on Click Event
- How to add OnClick Event on labels in Chart.js v2.0?
- How to add label for ChartJs Legend
- How to change the color of legend in chartjs and be able to add one more legend?
- How to get click event in Chart.js
- How to create custom legend in ChartJS
- How do you add custom text to tooltips in charts.js
- How to add ChartJS code in Html2Pdf to view image
- How to draw a needle on a custom donut chart and add datapoints to the needle?
- Chart.js click event to open a custom tooltip does not work sometimes
- How can I add an event to chart.js legend?
- Using chart js version 3, how to add custom data to external tooltip?
- How do I add time sourced from an external source as an X axis to a ChartJS graph?
- how to add percentage value to legend field in pie chart using chart.js
- how to add legend in pie chart
- How to change React chartjs-2 legend click functionality to hide all except the one clicked?
- How to add custom tooltips to only one label in Chart.js?
- How to register plot or label click event in chart.js
- How to custom legend with react-chartjs-2
- How to set Custom tooltip event with Chartjs version 2.X
- How to add the value for each label to pie legend
- ChartJS - How to add Text between Pie Chart and Legend
- Is it possible to add a click event in chart.js that directs you to a url?
- How to add custom text inside the bar and how to reduce the step size in y axis in chart js( Bar chart )
- How to compute x,y values from a click event using x,y pixel coordinates in ChartJS?
- Hide or show two datasets with one click event of legend in chart.js
More Query from same tag
- what is output format of Utils? (using chartjs in vanillajs, not react/angular)
- ChartJS add tooltip to a grouped bar chart
- Django and Chart.js Not Rendering Graph Correctly
- How to retrieve data from mysql to chart.js
- Chartjs Options are ignored
- Chart.js not working properly to draw lines when is only 1 bar
- Remove Chart.js chart padding
- Chartjs not showing up in Foundation5 Tabs
- Add a second Y-axis for Linechart in Chart.js?
- ChartJS doughnut colors not showing from a Flask app. All gray
- Want to save chart.js charts to image using django cron job
- Chart.js - Add gradient to line chart background
- Chartjs with streaming plugin: update y-range
- Completely hide the Y-axis on chartjs when data is hidden
- Dynamically changing chartjs tick colours
- ChartJS: Custom tooltip always displaying
- Chart.js legendcallback
- how to customize tool tip while mouse go over bars on Chart js bar chart
- Angular canvas is undefined
- Bootstrap grid not working with canvas
- Avoid data resetting when toggling series
- Dynamic rendering of chart with chartjs
- Setting min and max values chart.js
- charts js have a bar spanning negative/positive on y-axis
- How to set additional options for Chart.js BarCharts using React-Chartkick
- angular-chart does not show the series at the top like documentation
- How to display grouped data in ChartJs
- How to give link for lable/Legend in chart.js? and if the value is 0 how to remove the legend?
- chartjs stack bar graph color not working
- ngx-charts-advanced-pie-chart is reading my rest api response as null