pianello-api/resources/js/components/simple-line-chart/index.js
Ale Gallo 82f958e5da Committing laravel (part 3)
committing js templating files and components
2023-11-10 16:00:59 +01:00

71 lines
2.4 KiB
JavaScript

(function () {
"use strict";
// Chart
if ($(".simple-line-chart").length) {
$(".simple-line-chart").each(function () {
let ctx = $(this)[0].getContext("2d");
let myChart = new Chart(ctx, {
type: "line",
data: {
labels: [
"Jan",
"Feb",
"Mar",
"Apr",
"May",
"Jun",
"Jul",
"Aug",
"Sep",
"Oct",
"Nov",
"Dec",
],
datasets: [
{
label: "# of Votes",
data: helper.randomNumbers(0, 5, 12),
borderWidth: 2,
borderColor:
$(this).data("line-color") !== undefined
? $(this).data("line-color")
: getColor("primary", 0.8),
backgroundColor: "transparent",
pointBorderColor: "transparent",
tension: 0.4,
},
],
},
options: {
maintainAspectRatio: false,
plugins: {
legend: {
display: false,
},
},
scales: {
x: {
ticks: {
display: false,
},
grid: {
display: false,
drawBorder: false,
},
},
y: {
ticks: {
display: false,
},
grid: {
display: false,
drawBorder: false,
},
},
},
},
});
});
}
})();