как настроить высоту горизонтальной диаграммы в chart js — Q&A Хекслет
2026-02-26 17:25 Diff
const ctx = document.getElementById("myChart").getContext('2d'); const myChart = new Chart(ctx, { type: 'horizontalBar', data: { labels: ["Red", "Blue", "Yellow", "Green", "Purple", "Orange"], datasets: [{ label: 'Colors', data: [12, 19, 3, 5, 2, 3], backgroundColor: [ 'red', 'blue', 'yellow', 'green', 'purple', 'orange' ] }] }, options: { responsive: true, maintainAspectRatio: false, scales: { x: { beginAtZero: true } }, plugins: { legend: { display: true } }, layout: { padding: { top: 50, bottom: 50, } }, height: 400 } });