(e, legendItem, legend)
| 1447 | const defaultLegendClickHandler = Chart.defaults.plugins.legend.onClick; |
| 1448 | const pieDoughnutLegendClickHandler = Chart.controllers.doughnut.overrides.plugins.legend.onClick; |
| 1449 | const newLegendClickHandler = function (e, legendItem, legend) { |
| 1450 | const index = legendItem.datasetIndex; |
| 1451 | const type = legend.chart.config.type; |
| 1452 | |
| 1453 | OCA.Analytics.unsavedChanges = true; |
| 1454 | OCA.Analytics.Filter.toggleSaveButtonDisplay(); |
| 1455 | |
| 1456 | if (index === -1) { |
| 1457 | if (type === 'doughnut') { |
| 1458 | for (let dataIndex = 0; dataIndex < legend.chart.data.labels.length; dataIndex++) { |
| 1459 | if (!legend.chart.getDataVisibility(dataIndex)) { |
| 1460 | legend.chart.toggleDataVisibility(dataIndex); |
| 1461 | } |
| 1462 | } |
| 1463 | } else { |
| 1464 | for (let datasetIndex = 0; datasetIndex < legend.chart.data.datasets.length; datasetIndex++) { |
| 1465 | legend.chart.setDatasetVisibility(datasetIndex, true); |
| 1466 | } |
| 1467 | } |
| 1468 | legend.chart.update(); |
| 1469 | OCA.Analytics.Filter.syncChartLegendSelections(); |
| 1470 | return; |
| 1471 | } |
| 1472 | |
| 1473 | // Do the original logic |
| 1474 | if (type === 'pie' || type === 'doughnut') { |
| 1475 | pieDoughnutLegendClickHandler(e, legendItem, legend) |
| 1476 | } else { |
| 1477 | defaultLegendClickHandler(e, legendItem, legend); |
| 1478 | } |
| 1479 | OCA.Analytics.Filter.syncChartLegendSelections(); |
| 1480 | }; |
| 1481 | |
| 1482 | const defaultGenerateLabels = Chart.defaults.plugins.legend.labels.generateLabels; |
| 1483 | const customGenerateLabels = function (chart) { |
nothing calls this directly
no test coverage detected