fix(frontend): チャートのlegendがクリックに反応しない問題を修正

これにより発生 https://github.com/misskey-dev/misskey/pull/12926
This commit is contained in:
syuilo 2024-02-02 18:15:25 +09:00
parent 430290c084
commit 6c67b2e40e

View file

@ -30,9 +30,9 @@ function onClick(item: LegendItem) {
if (chart.value == null) return;
if (type.value === 'pie' || type.value === 'doughnut') {
// Pie and doughnut charts only have a single dataset and visibility is per item
if (item.index) chart.value.toggleDataVisibility(item.index);
if (item.index != null) chart.value.toggleDataVisibility(item.index);
} else {
if (item.datasetIndex) chart.value.setDatasetVisibility(item.datasetIndex, !chart.value.isDatasetVisible(item.datasetIndex));
if (item.datasetIndex != null) chart.value.setDatasetVisibility(item.datasetIndex, !chart.value.isDatasetVisible(item.datasetIndex));
}
chart.value.update();
}