Sha256: ae0b003e5bf44d114928c6912400f2a6a9777fc48826eba1cea951d291b033e8
Contents?: true
Size: 811 Bytes
Versions: 12
Compression:
Stored size: 811 Bytes
Contents
import htmlLegendPlugin from "html_legend_plugin"; function renderCharts(animate) { const charts = document.querySelectorAll('.chart'); for (let i = 0; i < charts.length; i++) { const chartEl = charts[i]; const chartData = JSON.parse(chartEl.dataset.json); chartData.options ||= {}; if (chartData.options.plugins?.legend?.vertical) { chartData.plugins = [htmlLegendPlugin]; chartData.options.plugins = { ...chartData.options.plugins, legend: { display: false, } } } chartData.options.animation = animate; chartData.options.responsive = true; chartData.options.maintainAspectRatio = false; const ctx = chartEl.getContext('2d'); const chart = new Chart(ctx, chartData); } } export { renderCharts as default };
Version data entries
12 entries across 12 versions & 1 rubygems