101 lines
3.1 KiB
PHP
Executable File
101 lines
3.1 KiB
PHP
Executable File
<v-charts-bar <?php echo e($attributes); ?>></v-charts-bar>
|
|
|
|
<?php if (! $__env->hasRenderedOnce('d6709c3e-8b8b-4895-b774-72b9b8823a2f')): $__env->markAsRenderedOnce('d6709c3e-8b8b-4895-b774-72b9b8823a2f');
|
|
$__env->startPush('scripts'); ?>
|
|
<!-- SEO Vue Component Template -->
|
|
<script
|
|
type="text/x-template"
|
|
id="v-charts-bar-template"
|
|
>
|
|
<canvas
|
|
:id="$.uid + '_chart'"
|
|
class="flex w-full max-w-full items-end"
|
|
:style="'aspect-ratio:' + aspectRatio + '/1'"
|
|
style=""
|
|
></canvas>
|
|
</script>
|
|
|
|
<script type="module">
|
|
app.component('v-charts-bar', {
|
|
template: '#v-charts-bar-template',
|
|
|
|
props: {
|
|
labels: {
|
|
type: Array,
|
|
default: [],
|
|
},
|
|
|
|
datasets: {
|
|
type: Array,
|
|
default: [],
|
|
},
|
|
|
|
aspectRatio: {
|
|
type: Number,
|
|
default: 3.23,
|
|
},
|
|
},
|
|
|
|
data() {
|
|
return {
|
|
chart: undefined,
|
|
}
|
|
},
|
|
|
|
mounted() {
|
|
this.prepare();
|
|
},
|
|
|
|
methods: {
|
|
prepare() {
|
|
const barCount = this.datasets.length;
|
|
|
|
this.datasets.forEach((dataset) => {
|
|
dataset.barThickness = Math.max(4, 36 / barCount);
|
|
});
|
|
|
|
if (this.chart) {
|
|
this.chart.destroy();
|
|
}
|
|
|
|
this.chart = new Chart(document.getElementById(this.$.uid + '_chart'), {
|
|
type: 'bar',
|
|
|
|
data: {
|
|
labels: this.labels,
|
|
|
|
datasets: this.datasets,
|
|
},
|
|
|
|
options: {
|
|
aspectRatio: this.aspectRatio,
|
|
|
|
plugins: {
|
|
legend: {
|
|
display: false
|
|
},
|
|
},
|
|
|
|
scales: {
|
|
x: {
|
|
beginAtZero: true,
|
|
|
|
border: {
|
|
dash: [8, 4],
|
|
}
|
|
},
|
|
|
|
y: {
|
|
beginAtZero: true,
|
|
border: {
|
|
dash: [8, 4],
|
|
}
|
|
}
|
|
}
|
|
}
|
|
});
|
|
}
|
|
}
|
|
});
|
|
</script>
|
|
<?php $__env->stopPush(); endif; ?><?php /**PATH /var/www/html/packages/Webkul/Admin/src/Resources/views/components/charts/bar.blade.php ENDPATH**/ ?>
|