New Controllers added. Added Charts

This commit is contained in:
2017-09-19 22:01:00 +02:00
parent ccc5b07ddf
commit 930311b550
400 changed files with 30686 additions and 8 deletions

View File

@@ -0,0 +1,67 @@
<script type="text/javascript">
$(function () {
var {{ $model->id }} = new Highcharts.Chart({
chart: {
type: 'area',
renderTo: "{{ $model->id }}",
@include('charts::_partials.dimension.js2')
},
@if($model->title)
title: {
text: "{!! $model->title !!}",
x: -20 //center
},
@endif
@if(!$model->credits)
credits: {
enabled: false
},
@endif
xAxis: {
title: {
text: "{!! $model->x_axis_title !!}"
},
categories: [
@foreach($model->labels as $label)
"{!! $label !!}",
@endforeach
]
},
yAxis: {
title: {
text: "{!! $model->y_axis_title === null ? $model->element_label : $model->y_axis_title !!}"
},
plotLines: [{
value: 0,
height: 0.5,
width: 1,
color: '#808080'
}]
},
@if($model->colors)
plotOptions: {
series: {
color: "{{ $model->colors[0] }}"
}
},
@endif
legend: {
@if(!$model->legend)
enabled: false,
@endif
},
series: [{
name: "{!! $model->element_label !!}",
data: [
@foreach($model->values as $dta)
{{ $dta }},
@endforeach
]
}]
})
});
</script>
@if(!$model->customId)
@include('charts::_partials.container.div')
@endif

View File

@@ -0,0 +1,66 @@
<script type="text/javascript">
$(function () {
var {{ $model->id }} = new Highcharts.Chart({
colors: [
@foreach($model->colors as $c)
"{{ $c }}",
@endforeach
],
chart: {
renderTo: "{{ $model->id }}",
@include('charts::_partials.dimension.js2')
plotBackgroundColor: null,
plotBorderWidth: null,
plotShadow: false,
type: 'column'
},
@if($model->title)
title: {
text: "{!! $model->title !!}"
},
@endif
@if(!$model->credits)
credits: {
enabled: false
},
@endif
plotOptions: {
series: {
colorByPoint: true,
},
},
xAxis: {
title: {
text: "{!! $model->x_axis_title !!}"
},
categories: [
@foreach($model->labels as $label)
"{!! $label !!}",
@endforeach
],
},
yAxis: {
title: {
text: "{!! $model->y_axis_title === null ? $model->element_label : $model->y_axis_title !!}"
},
},
legend: {
@if(!$model->legend)
enabled: false,
@endif
},
series: [{
name: "{!! $model->element_label !!}",
data: [
@foreach($model->values as $dta)
{{ $dta }},
@endforeach
]
}]
})
});
</script>
@if(!$model->customId)
@include('charts::_partials.container.div')
@endif

View File

@@ -0,0 +1,66 @@
<script type="text/javascript">
$(function () {
var {{ $model->id }} = new Highcharts.Chart({
colors: [
@foreach($model->colors as $c)
"{{ $c }}",
@endforeach
],
chart: {
renderTo: "{{ $model->id }}",
@include('charts::_partials.dimension.js2')
plotBackgroundColor: null,
plotBorderWidth: null,
plotShadow: false,
type: 'pie'
},
@if($model->title)
title: {
text: "{!! $model->title !!}"
},
@endif
@if(!$model->credits)
credits: {
enabled: false
},
@endif
tooltip: {
pointFormat: '{point.y} <b>({point.percentage:.1f}%)</strong>'
},
plotOptions: {
pie: {
innerSize: '50%',
allowPointSelect: true,
cursor: 'pointer',
dataLabels: {
enabled: true,
format: '<b>{point.name}</strong>: {point.y} ({point.percentage:.1f}%)',
style: {
color: (Highcharts.theme && Highcharts.theme.contrastTextColor) || 'black'
}
}
}
},
legend: {
@if(!$model->legend)
enabled: false
@endif
},
series: [{
colorByPoint: true,
data: [
@for ($l = 0; $l < count($model->values); $l++)
{
name: "{!! $model->labels[$l] !!}",
y: {{ $model->values[$l] }}
},
@endfor
]
}]
})
});
</script>
@if(!$model->customId)
@include('charts::_partials.container.div')
@endif

View File

@@ -0,0 +1,71 @@
@php
// Get the max / min index
$max = 0;
$min = $model->values ? $model->values[0] : 0;
@endphp
@foreach($model->values as $dta)
@if($dta > $max)
@php($max = $dta)
@elseif($dta < $min)
@php($min = $dta)
@endif
@endforeach
<script type="text/javascript">
$(function () {
var {{ $model->id }} = new Highcharts.Map({
chart: {
renderTo: "{{ $model->id }}",
@include('charts::_partials.dimension.js2')
},
@if($model->title)
title: {
text: "{!! $model->title !!}"
},
@endif
@if(!$model->credits)
credits: {
enabled: false
},
@endif
mapNavigation: {
enabled: true,
enableDoubleClickZoomTo: true
},
colorAxis: {
min: {{ $min }},
@if($model->colors and count($model->colors) >= 2)
minColor: "{{ $model->colors[0] }}",
@endif
max: {{ $max }},
@if($model->colors and count($model->colors) >= 2)
maxColor: "{{ $model->colors[1] }}",
@endif
},
series : [{
data : [
@for ($i = 0; $i < count($model->values); $i++)
{
'code': "{{ $model->labels[$i] }}",
'value': {{ $model->values[$i] }}
},
@endfor
],
mapData: Highcharts.maps['custom/world'],
joinBy: ['iso-a2', 'code'],
name: "{!! $model->element_label !!}",
states: {
hover: {
color: '#BADA55'
}
},
}]
})
});
</script>
@if(!$model->customId)
@include('charts::_partials.container.div')
@endif

View File

@@ -0,0 +1,66 @@
<script type="text/javascript">
$(function () {
var {{ $model->id }} = new Highcharts.Chart({
chart: {
renderTo: "{{ $model->id }}",
@include('charts::_partials.dimension.js2')
},
@if($model->title)
title: {
text: "{!! $model->title !!}",
x: -20 //center
},
@endif
@if(!$model->credits)
credits: {
enabled: false
},
@endif
xAxis: {
title: {
text: "{{ $model->x_axis_title }}"
},
categories: [
@foreach($model->labels as $label)
"{!! $label !!}",
@endforeach
],
},
yAxis: {
title: {
text: "{!! $model->y_axis_title === null ? $model->element_label : $model->y_axis_title !!}"
},
plotLines: [{
value: 0,
height: 0.5,
width: 1,
color: '#808080'
}]
},
@if($model->colors)
plotOptions: {
series: {
color: "{{ $model->colors[0] }}"
},
},
@endif
legend: {
@if(!$model->legend)
enabled: false,
@endif
},
series: [{
name: "{!! $model->element_label !!}",
data: [
@foreach($model->values as $dta)
{{ $dta }},
@endforeach
]
}]
});
});
</script>
@if(!$model->customId)
@include('charts::_partials.container.div')
@endif

View File

@@ -0,0 +1,58 @@
<script type="text/javascript">
$(function () {
var {{ $model->id }} = new Highcharts.Chart({
chart: {
type: 'area',
renderTo: "{{ $model->id }}",
@include('charts::_partials.dimension.js2')
},
@if($model->title)
title: {
text: "{!! $model->title !!}",
x: -20 //center
},
@endif
@if(!$model->credits)
credits: {
enabled: false
},
@endif
xAxis: {
categories: [
@foreach($model->labels as $label)
"{!! $label !!}",
@endforeach
]
},
yAxis: {
title: {
text: "{!! $model->y_axis_title === null ? $model->element_label : $model->y_axis_title !!}"
},
},
legend: {
@if(!$model->legend)
enabled: false,
@endif
},
series: [
@for ($i = 0; $i < count($model->datasets); $i++)
{
name: "{!! $model->datasets[$i]['label'] !!}",
@if($model->colors && count($model->colors) > $i)
color: "{{ $model->colors[$i] }}",
@endif
data: [
@foreach($model->datasets[$i]['values'] as $dta)
{{ $dta }},
@endforeach
]
},
@endfor
]
})
});
</script>
@if(!$model->customId)
@include('charts::_partials.container.div')
@endif

View File

@@ -0,0 +1,67 @@
<script type="text/javascript">
$(function () {
var {{ $model->id }} = new Highcharts.Chart({
chart: {
type: 'areaspline',
renderTo: "{{ $model->id }}",
@include('charts::_partials.dimension.js2')
},
@if($model->title)
title: {
text: "{!! $model->title !!}",
x: -20 //center
},
@endif
@if(!$model->credits)
credits: {
enabled: false
},
@endif
xAxis: {
categories: [
@foreach($model->labels as $label)
"{!! $label !!}",
@endforeach
]
},
yAxis: {
title: {
text: "{!! $model->y_axis_title === null ? $model->element_label : $model->y_axis_title !!}"
},
},
legend: {
@if(!$model->legend)
enabled: false,
@endif
},
tooltip: {
shared: true,
valueSuffix: ' units'
},
plotOptions: {
areaspline: {
fillOpacity: 0.5
}
},
series: [
@for ($i = 0; $i < count($model->datasets); $i++)
{
name: "{!! $model->datasets[$i]['label'] !!}",
@if($model->colors && count($model->colors) > $i)
color: "{{ $model->colors[$i] }}",
@endif
data: [
@foreach($model->datasets[$i]['values'] as $dta)
{{ $dta }},
@endforeach
]
},
@endfor
]
})
});
</script>
@if(!$model->customId)
@include('charts::_partials.container.div')
@endif

View File

@@ -0,0 +1,66 @@
<script type="text/javascript">
$(function () {
var {{ $model->id }} = new Highcharts.Chart({
chart: {
renderTo: "{{ $model->id }}",
@include('charts::_partials.dimension.js2')
plotBackgroundColor: null,
plotBorderWidth: null,
plotShadow: false,
type: 'column'
},
@if($model->title)
title: {
text: "{!! $model->title !!}"
},
@endif
@if(!$model->credits)
credits: {
enabled: false
},
@endif
plotOptions: {
column: {
pointPadding: 0.2,
borderWidth: 0
}
},
xAxis: {
categories: [
@foreach($model->labels as $label)
"{!! $label !!}",
@endforeach
],
},
yAxis: {
title: {
text: "{!! $model->y_axis_title === null ? $model->element_label : $model->y_axis_title !!}"
},
},
legend: {
@if(!$model->legend)
enabled: false,
@endif
},
series: [
@for ($i = 0; $i < count($model->datasets); $i++)
{
name: "{!! $model->datasets[$i]['label'] !!}",
@if($model->colors && count($model->colors) > $i)
color: "{{ $model->colors[$i] }}",
@endif
data: [
@foreach($model->datasets[$i]['values'] as $dta)
{{ $dta }},
@endforeach
]
},
@endfor
]
})
});
</script>
@if(!$model->customId)
@include('charts::_partials.container.div')
@endif

View File

@@ -0,0 +1,57 @@
<script type="text/javascript">
$(function () {
var {{ $model->id }} = new Highcharts.Chart({
chart: {
renderTo: "{{ $model->id }}",
@include('charts::_partials.dimension.js2')
},
@if($model->title)
title: {
text: "{!! $model->title !!}",
x: -20 //center
},
@endif
@if(!$model->credits)
credits: {
enabled: false
},
@endif
xAxis: {
categories: [
@foreach($model->labels as $label)
"{!! $label !!}",
@endforeach
]
},
yAxis: {
title: {
text: "{!! $model->y_axis_title === null ? $model->element_label : $model->y_axis_title !!}"
},
},
legend: {
@if(!$model->legend)
enabled: false,
@endif
},
series: [
@for ($i = 0; $i < count($model->datasets); $i++)
{
name: "{!! $model->datasets[$i]['label'] !!}",
@if($model->colors && count($model->colors) > $i)
color: "{{ $model->colors[$i] }}",
@endif
data: [
@foreach($model->datasets[$i]['values'] as $dta)
{{ $dta }},
@endforeach
]
},
@endfor
]
})
});
</script>
@if(!$model->customId)
@include('charts::_partials.container.div')
@endif

View File

@@ -0,0 +1,65 @@
<script type="text/javascript">
$(function () {
var {{ $model->id }} = new Highcharts.Chart({
colors: [
@foreach($model->colors as $c)
"{{ $c }}",
@endforeach
],
chart: {
renderTo: "{{ $model->id }}",
@include('charts::_partials.dimension.js2')
plotBackgroundColor: null,
plotBorderWidth: null,
plotShadow: false,
type: 'pie'
},
@if($model->title)
title: {
text: "{!! $model->title !!}",
},
@endif
@if(!$model->credits)
credits: {
enabled: false
},
@endif
tooltip: {
pointFormat: '{point.y} <b>({point.percentage:.1f}%)</strong>'
},
plotOptions: {
pie: {
allowPointSelect: true,
cursor: 'pointer',
dataLabels: {
enabled: true,
format: '<b>{point.name}</strong>: {point.y} ({point.percentage:.1f}%)',
style: {
color: (Highcharts.theme && Highcharts.theme.contrastTextColor) || 'black'
}
}
}
},
legend: {
@if(!$model->legend)
enabled: false
@endif
},
series: [{
colorByPoint: true,
data: [
@for($i = 0; $i < count($model->values); $i++)
{
name: "{!! $model->labels[$i] !!}",
y: {{ $model->values[$i] }}
},
@endfor
]
}]
})
});
</script>
@if(!$model->customId)
@include('charts::_partials.container.div')
@endif

View File

@@ -0,0 +1,80 @@
<script type="text/javascript">
$(function () {
Highcharts.setOptions({global: { useUTC: false } })
{{ $model->id }} = new Highcharts.Chart({
chart: {
renderTo: "{{ $model->id }}",
type: 'area',
events: {
load: update{{ $model->id }}
},
@include('charts::_partials.dimension.js2')
},
@if($model->title)
title: {
text: "{!! $model->title !!}",
},
@endif
@if(!$model->credits)
credits: {
enabled: false
},
@endif
xAxis: {
type: 'datetime',
},
yAxis: {
title: {
text: "{!! $model->element_label !!}"
},
plotLines: [{
value: 0,
height: 0.5,
width: 1,
color: '#808080'
}]
},
@if($model->colors)
plotOptions: {
series: {
color: "{{ $model->colors[0] }}"
}
},
@endif
legend: {
@if(!$model->legend)
enabled: false,
@endif
},
series: [{
name: "{!! $model->element_label !!}",
data: [],
pointStart: new Date().getTime(),
pointInterval: {{ ( $model->interval / 1000 ) * 1000 }} // one day
}]
})
function update{{ $model->id }}() {
$.ajax({
url: "{{ $model->url }}",
success: function(point) {
var series = {{ $model->id }}.series[0],
shift = series.data.length >= {{ $model->max_values }}; // shift if the series is longer than 20
// add the point
{{ $model->id }}.series[0].addPoint(point["{{ $model->value_name }}"], true, shift)
{{ $model->id }}.xAxis.categories
// call it again after one second
setTimeout(update{{ $model->id }}, {{ $model->interval }})
},
cache: false
})
}
});
</script>
@if(!$model->customId)
@include('charts::_partials.container.div')
@endif

View File

@@ -0,0 +1,84 @@
<script type="text/javascript">
$(function () {
Highcharts.setOptions({global: { useUTC: false } })
{{ $model->id }} = new Highcharts.Chart({
colors: [
@foreach($model->colors as $c)
"{{ $c }}",
@endforeach
],
chart: {
renderTo: "{{ $model->id }}",
type: 'column',
events: {
load: update{{ $model->id }}
},
@include('charts::_partials.dimension.js2')
},
@if($model->title)
title: {
text: "{!! $model->title !!}",
x: -20 //center
},
@endif
@if(!$model->credits)
credits: {
enabled: false
},
@endif
xAxis: {
type: 'datetime',
},
yAxis: {
title: {
text: "{!! $model->element_label !!}"
},
plotLines: [{
value: 0,
height: 0.5,
width: 1,
color: '#808080'
}]
},
plotOptions: {
series: {
colorByPoint: true,
},
},
legend: {
@if(!$model->legend)
enabled: false,
@endif
},
series: [{
name: "{!! $model->element_label !!}",
data: [],
pointStart: new Date().getTime(),
pointInterval: {{ $model->interval }},
}]
})
function update{{ $model->id }}() {
$.ajax({
url: "{{ $model->url }}",
success: function(point) {
var series = {{ $model->id }}.series[0],
shift = series.data.length >= {{ $model->max_values }} // shift if the series is longer than 20
// add the point
{{ $model->id }}.series[0].addPoint(point["{{ $model->value_name }}"], true, shift)
{{ $model->id }}.xAxis.categories
// call it again after one second
setTimeout(update{{ $model->id }}, {{ $model->interval }})
},
cache: false
})
}
});
</script>
@if(!$model->customId)
@include('charts::_partials.container.div')
@endif

View File

@@ -0,0 +1,80 @@
<script type="text/javascript">
$(function () {
Highcharts.setOptions({global: { useUTC: false } })
{{ $model->id }} = new Highcharts.Chart({
chart: {
renderTo: "{{ $model->id }}",
events: {
load: update{{ $model->id }}
},
@include('charts::_partials.dimension.js2')
},
@if($model->title)
title: {
text: "{!! $model->title !!}",
x: -20 //center
},
@endif
@if(!$model->credits)
credits: {
enabled: false
},
@endif
xAxis: {
type: 'datetime',
},
yAxis: {
title: {
text: "{!! $model->element_label !!}"
},
plotLines: [{
value: 0,
height: 0.5,
width: 1,
color: '#808080'
}]
},
@if($model->colors)
plotOptions: {
series: {
color: "{{ $model->colors[0] }}"
}
},
@endif
legend: {
@if(!$model->legend)
enabled: false,
@endif
},
series: [{
name: "{!! $model->element_label !!}",
data: [],
pointStart: new Date().getTime(),
pointInterval: {{ ($model->interval / 1000) * 1000 }} // one day
}]
})
function update{{ $model->id }}() {
$.ajax({
url: "{{ $model->url }}",
success: function(point) {
var series = {{ $model->id }}.series[0],
shift = series.data.length >= {{ $model->max_values }}; // shift if the series is longer than 20
// add the point
{{ $model->id }}.series[0].addPoint(point[ "{{ $model->value_name }}"], true, shift)
{{ $model->id }}.xAxis.categories
// call it again after one second
setTimeout(update{{ $model->id }}, {{ $model->interval }})
},
cache: false
})
}
});
</script>
@if(!$model->customId)
@include('charts::_partials.container.div')
@endif