tethys.backend/resources/js/Components/Charts/chart.config.js
Arno Kaimbacher 68928b5e07
All checks were successful
CI Pipeline / japa-tests (push) Successful in 50s
- HomeController.ts: addes api method for showing number of publications per month for given year
- adapted command ValidateChecksum.ts: on published files are checked. better information logging
- better LineChart.vue component: showing real statistics
- start/routes/apu.ts: added Route.get('/statistic/:year', 'HomeController.findPublicationsPerMonth');
2024-02-02 14:00:54 +01:00

51 lines
1.2 KiB
JavaScript

export const chartColors = {
default: {
primary: '#00D1B2',
info: '#209CEE',
danger: '#FF3860',
},
};
const randomChartData = (n) => {
const data = [];
for (let i = 0; i < n; i++) {
data.push(Math.round(Math.random() * 200));
}
return data;
};
const datasetObject = (color, points) => {
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',
};
};
export const sampleChartData = (points = 12) => {
const labels = [];
for (let i = 1; i <= points; i++) {
labels.push(`0${i}`);
}
return {
labels,
datasets: [datasetObject('primary', points), datasetObject('info', points), datasetObject('danger', points)],
};
};