11 lines
868 B
JavaScript
11 lines
868 B
JavaScript
"use strict";
|
|
const volume = document.getElementById("volume-data");
|
|
if (volume && window.Chart) {
|
|
const data = JSON.parse(volume.textContent);
|
|
new Chart(document.getElementById("volume-chart"), {
|
|
type: "bar",
|
|
data: {labels: data.labels, datasets: [{data: data.values, backgroundColor: data.values.map((_, i) => i === 7 ? "#294f3a" : "#dbe6bf"), hoverBackgroundColor: "#87a364", borderRadius: 5, maxBarThickness: 34}]},
|
|
options: {responsive: true, maintainAspectRatio: false, plugins: {legend: {display: false}, tooltip: {callbacks: {label: context => `${context.raw.toFixed(2)} km`}}}, scales: {x: {grid: {display: false}, border: {display: false}, ticks: {font: {size: 10}, color: "#949c8b"}}, y: {beginAtZero: true, border: {display: false}, grid: {color: "#f0f2eb"}, ticks: {font: {size: 10}, color: "#949c8b", callback: v => `${v} km`}}}}
|
|
});
|
|
}
|