2023-03-03 15:54:28 +00:00
|
|
|
export const chartColors = {
|
2023-06-27 16:23:18 +00:00
|
|
|
default: {
|
|
|
|
primary: '#00D1B2',
|
|
|
|
info: '#209CEE',
|
|
|
|
danger: '#FF3860',
|
|
|
|
},
|
|
|
|
};
|
2023-03-03 15:54:28 +00:00
|
|
|
|
2023-06-27 16:23:18 +00:00
|
|
|
const randomChartData = (n) => {
|
|
|
|
const data = [];
|
2023-03-03 15:54:28 +00:00
|
|
|
|
2023-06-27 16:23:18 +00:00
|
|
|
for (let i = 0; i < n; i++) {
|
|
|
|
data.push(Math.round(Math.random() * 200));
|
|
|
|
}
|
2023-03-03 15:54:28 +00:00
|
|
|
|
2023-06-27 16:23:18 +00:00
|
|
|
return data;
|
|
|
|
};
|
2023-03-03 15:54:28 +00:00
|
|
|
|
|
|
|
const datasetObject = (color, points) => {
|
2023-06-27 16:23:18 +00:00
|
|
|
return {
|
|
|
|
fill: false,
|
|
|
|
borderColor: chartColors.default[color],
|
|
|
|
borderWidth: 2,
|
|
|
|
borderDash: [],
|
|
|
|
borderDashOffset: 0.0,
|
|
|
|
pointBackgroundColor: chartColors.default[color],
|
|
|
|
pointBorderColor: 'rgba(255,255,255,0)',
|
|
|
|
pointHoverBackgroundColor: chartColors.default[color],
|
|
|
|
pointBorderWidth: 20,
|
|
|
|
pointHoverRadius: 4,
|
|
|
|
pointHoverBorderWidth: 15,
|
|
|
|
pointRadius: 4,
|
|
|
|
data: randomChartData(points),
|
|
|
|
tension: 0.5,
|
|
|
|
cubicInterpolationMode: 'default',
|
|
|
|
};
|
|
|
|
};
|
2023-03-03 15:54:28 +00:00
|
|
|
|
|
|
|
export const sampleChartData = (points = 9) => {
|
2023-06-27 16:23:18 +00:00
|
|
|
const labels = [];
|
2023-03-03 15:54:28 +00:00
|
|
|
|
2023-06-27 16:23:18 +00:00
|
|
|
for (let i = 1; i <= points; i++) {
|
|
|
|
labels.push(`0${i}`);
|
|
|
|
}
|
2023-03-03 15:54:28 +00:00
|
|
|
|
2023-06-27 16:23:18 +00:00
|
|
|
return {
|
|
|
|
labels,
|
|
|
|
datasets: [datasetObject('primary', points), datasetObject('info', points), datasetObject('danger', points)],
|
|
|
|
};
|
|
|
|
};
|