52 lines
1.3 KiB
PHP
Raw Normal View History

2017-12-11 19:07:09 +03:00
@if(!$model->customId)
@include('charts::_partials.container.canvas2')
@endif
@include('charts::_partials.helpers.hex2rgb')
2019-11-16 10:21:14 +03:00
@push('body_scripts')
2017-12-11 19:07:09 +03:00
<script type="text/javascript">
2019-11-16 10:21:14 +03:00
var ctx = document.getElementById("{{ $model->id }}");
2017-12-11 19:07:09 +03:00
var data = {
labels: [
2019-11-16 10:21:14 +03:00
@foreach ($model->labels as $label)
"{!! $label !!}",
2017-12-11 19:07:09 +03:00
@endforeach
],
datasets: [{
fill: true,
2019-11-16 10:21:14 +03:00
@if ($model->colors)
backgroundColor: hex2rgba_convert("{{ $model->colors[0] }}", 50),
2017-12-11 19:07:09 +03:00
@endif
label: "{!! $model->element_label !!}",
lineTension: 0.3,
2019-11-16 10:21:14 +03:00
@if ($model->colors)
borderColor: "{{ $model->colors[0] }}",
2017-12-11 19:07:09 +03:00
@endif
data: [
2019-11-16 10:21:14 +03:00
@foreach ($model->values as $dta)
{{ $dta }},
2017-12-11 19:07:09 +03:00
@endforeach
2019-11-16 10:21:14 +03:00
]
2017-12-11 19:07:09 +03:00
}]
};
var myLineChart = new Chart(ctx, {
type: 'line',
data: data,
options: {
responsive: {{ $model->responsive || !$model->width ? 'true' : 'false' }},
maintainAspectRatio: false,
2019-11-16 10:21:14 +03:00
@if ($model->title)
title: {
display: true,
text: "{!! $model->title !!}",
fontSize: 20
}
2017-12-11 19:07:09 +03:00
@endif
}
});
</script>
2019-11-16 10:21:14 +03:00
@endpush