agdar/static/data/chart-js/code-2.json
2025-11-02 14:35:35 +03:00

39 lines
1.6 KiB
JSON
Executable File

<!-- required files -->
<script src="../assets/plugins/chart.js/dist/chart.umd.js"></script>
<!-- html -->
<canvas id="bar-chart"></canvas>
<!-- script -->
<script>
Chart.defaults.color = 'rgba('+ app.color.componentColorRgb + ', .65)';
Chart.defaults.font.family = app.font.family;
Chart.defaults.font.weight = 500;
Chart.defaults.scale.grid.color = 'rgba('+ app.color.componentColorRgb + ', .15)';
Chart.defaults.scale.ticks.backdropColor = 'rgba('+ app.color.componentColorRgb + ', 0)';
var randomScalingFactor = function() {
return Math.round(Math.random()*100)
};
var ctx2 = document.getElementById('bar-chart').getContext('2d');
var barChart = new Chart(ctx2, {
type: 'bar',
data: {
labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July'],
datasets: [{
label: 'Dataset 1',
borderWidth: 1,
borderColor: app.color.indigo,
backgroundColor: 'rgba('+ app.color.indigoRgb + ', .3)',
data: [randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor()]
}, {
label: 'Dataset 2',
borderWidth: 1,
borderColor: 'rgba('+ app.color.componentColorRgb + ', .85)',
backgroundColor: 'rgba('+ app.color.componentColorRgb + ', .3)',
data: [randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor(), randomScalingFactor()]
}]
}
});
</script>