| 613 | // This ensures that if the legend position changes (via an option update) |
| 614 | // the layout system respects the change. See https://github.com/chartjs/Chart.js/issues/7527 |
| 615 | beforeUpdate(chart, _args, options) { |
| 616 | const legend = chart.legend; |
| 617 | layouts.configure(chart, legend, options); |
| 618 | legend.options = options; |
| 619 | }, |
| 620 | |
| 621 | // The labels need to be built after datasets are updated to ensure that colors |
| 622 | // and other styling are correct. See https://github.com/chartjs/Chart.js/issues/6968 |