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,28 @@
<script type="text/javascript">
chart = google.charts.setOnLoadCallback(draw{{ $model->id }})
function draw{{ $model->id }}() {
var data = google.visualization.arrayToDataTable([
['Element', "{!! $model->element_label !!}"],
@for ($i = 0; $i < count($model->values); $i++)
["{!! $model->labels[$i] !!}", {{ $model->values[$i] }}],
@endfor
])
var options = {
@include('charts::_partials.dimension.js')
fontSize: 12,
@include('charts::google.titles')
@include('charts::google.colors')
legend: { position: 'top', alignment: 'end' }
};
var {{ $model->id }} = new google.visualization.AreaChart(document.getElementById("{{ $model->id }}"))
{{ $model->id }}.draw(data, options)
}
</script>
@if(!$model->customId)
@include('charts::_partials.container.div')
@endif

View File

@@ -0,0 +1,43 @@
<script type="text/javascript">
google.charts.setOnLoadCallback(draw{{ $model->id }})
function draw{{ $model->id }}() {
var data = google.visualization.arrayToDataTable([
['', "{!! $model->element_label !!}",
@if($model->colors)
{ role: 'style' }
@endif
],
@for ($i = 0; $i < count($model->values); $i++)
[
"{!! $model->labels[$i] !!}", {{ $model->values[$i] }}
@if($model->colors)
,"{{ $model->colors[$i] }}"
@endif
],
@endfor
])
var options = {
@include('charts::_partials.dimension.js')
legend: { position: 'top', alignment: 'end' },
fontSize: 12,
@include('charts::google.titles')
@if($model->colors)
colors:[
@foreach($model->colors as $color)
"{{ $color}}",
@endforeach
],
@endif
};
var {{ $model->id }} = new google.visualization.ColumnChart(document.getElementById("{{ $model->id }}"))
{{ $model->id }}.draw(data, options)
}
</script>
@if(!$model->customId)
@include('charts::_partials.container.div')
@endif

View File

@@ -0,0 +1,10 @@
@if($model->colors)
colors:[
@foreach($model->colors as $color)
"{{ $color }}",
@endforeach
],
@endif
@if($model->background_color)
backgroundColor: "{{ $model->background_color }}",
@endif

View File

@@ -0,0 +1,27 @@
<script type="text/javascript">
google.charts.setOnLoadCallback(draw{{ $model->id }})
function draw{{ $model->id }}() {
var data = google.visualization.arrayToDataTable([
['Element', 'Value'],
@for ($l = 0; $l < count($model->values); $l++)
["{!! $model->labels[$i] !!}", {{ $model->values[$i] }}],
@endfor
])
var options = {
@include('charts::_partials.dimension.js')
fontSize: 12,
pieHole: 0.4,
@include('charts::google.titles')
@include('charts::google.colors')
};
var {{ $model->id }} = new google.visualization.PieChart(document.getElementById("{{ $model->id }}"))
{{ $model->id }}.draw(data, options)
}
</script>
@if(!$model->customId)
@include('charts::_partials.container.div')
@endif

View File

@@ -0,0 +1,74 @@
<script type="text/javascript">
google.charts.setOnLoadCallback(draw{{ $model->id }})
function draw{{ $model->id }}() {
var data = google.visualization.arrayToDataTable([
['Element', 'Value'],
["{!! $model->element_label !!}", {{ $model->values[0] }}],
])
var options = {
@include('charts::_partials.dimension.js')
@if(count($model->values) >= 2 and $model->values[1] <= $model->values[0])
@php($min = $model->values[1])
min: {{ $min }},
@else
@php($min = 0)
@endif
@if(count($model->values) >= 3 and $model->values[2] >= $model->values[0])
@php($max = $model->values[2])
max: {{ $max }},
@else
@php($max = 100)
@endif
@if($model->gauge_style == 'right')
// Calculate warning area
@php
$low_warning = round(0.40 * $max, 2)
$warning = round(0.25 * $max, 2)
$max_warning = round(0.10 * $max, 2)
@endphp
greenColor: '#c8e6c9', yellowColor: '#ffd54f', redColor: '#e57373',
greenFrom: $low_warning, greenTo: $max,
yellowFrom: $max_warning, yellowTo: $low_warning,
redFrom: $min, redTo: $max_warning,
@elseif($model->gauge_style == 'center') {
// Calculate warning area
@php
$warning = round(0.25 * $max, 2)
$warning2 = round(0.75 * $max, 2)
@endphp
greenColor: '#c8e6c9', yellowColor: '#ffd54f', redColor: '#ffd54f',
greenFrom: $warning, greenTo: $warning2,
yellowFrom: $min, yellowTo: $warning,
redFrom: $warning2, redTo: $max,
@else
// Calculate warning area
@php
$low_warning = round(0.60 * $max, 2)
$warning = round(0.75 * $max, 2)
$max_warning = round(0.90 * $max, 2)
@endphp
greenColor: '#c8e6c9', yellowColor: '#ffd54f', redColor: '#e57373',
greenFrom: $min, greenTo: $low_warning,
yellowFrom: $low_warning, yellowTo: $max_warning,
redFrom: $max_warning, redTo: $max,
@endif
minorTicks: 10,
};
var {{ $model->id }} = new google.visualization.Gauge(document.getElementById("{{ $model->id }}"))
{{ $model->id }}.draw(data, options)
}
</script>
@if(!$model->customId)
@include('charts::_partials/container.div-titled')
@endif

View File

@@ -0,0 +1,34 @@
<script type="text/javascript">
google.charts.setOnLoadCallback(draw{{ $model->id }})
function draw{{ $model->id }}() {
var data = google.visualization.arrayToDataTable([
['Country', "{!! $model->element_label !!}"],
@for ($i = 0; $i < count($model->values); $i++)
["{{ $model->labels[$i] }}", {{ $model->values[$i] }}],
@endfor
])
var options = {
@include('charts::_partials.dimension.js')
colorAxis: {
colors: [
@if($model->colors and count($model->colors >= 2))
"{{ $model->colors[0] }}", "{{ $model->colors[1] }}"
@endif
]
},
region: "{{ $model->region ? $model->region : 'world' }}",
datalessRegionColor: "#e0e0e0",
defaultColor: "#607D8",
};
var {{ $model->id }} = new google.visualization.GeoChart(document.getElementById("{{ $model->id }}"))
{{ $model->id }}.draw(data, options)
}
</script>
@if(!$model->customId)
@include('charts::_partials/container.div-titled')
@endif

View File

@@ -0,0 +1,29 @@
<script type="text/javascript">
chart = google.charts.setOnLoadCallback(drawChart)
function drawChart() {
var data = google.visualization.arrayToDataTable([
[
'Element', "{!! $model->element_label !!}"],
@for ($i = 0; $i < count($model->values); $i++)
["{!! $model->labels[$i] !!}", {{ $model->values[$i] }}],
@endfor
])
var options = {
@include('charts::_partials.dimension.js')
fontSize: 12,
@include('charts::google.titles')
@include('charts::google.colors')
legend: { position: 'top', alignment: 'end' }
};
var chart = new google.visualization.LineChart(document.getElementById("{{ $model->id }}"))
chart.draw(data, options)
}
</script>
@if(!$model->customId)
@include('charts::_partials.container.div')
@endif

View File

@@ -0,0 +1,38 @@
<script type="text/javascript">
chart = google.charts.setOnLoadCallback(draw{{ $model->id }})
function draw{{ $model->id }}() {
var data = google.visualization.arrayToDataTable([
[
'Element',
@for ($i = 0; $i < count($model->datasets); $i++)
"{{ $model->datasets[$i]['label'] }}",
@endfor
],
@for($l = 0; $l < count($model->labels); $l++)
[
"{{ $model->labels[$l] }}",
@for ($i = 0; $i < count($model->datasets); $i++)
{{ $model->datasets[$i]['values'][$l] }},
@endfor
],
@endfor
])
var options = {
@include('charts::_partials.dimension.js')
fontSize: 12,
@include('charts::google.titles')
@include('charts::google.colors')
legend: { position: 'top', alignment: 'end' }
};
var {{ $model->id }} = new google.visualization.AreaChart(document.getElementById("{{ $model->id }}"))
{{ $model->id }}.draw(data, options)
}
</script>
@if(!$model->customId)
@include('charts::_partials.container.div')
@endif

View File

@@ -0,0 +1,38 @@
<script type="text/javascript">
google.charts.setOnLoadCallback(draw{{ $model->id }})
function draw{{ $model->id }}() {
var data = google.visualization.arrayToDataTable([
[
'Element',
@for ($i = 0; $i < count($model->datasets); $i++)
"{{ $model->datasets[$i]['label'] }}",
@endfor
],
@for ($l = 0; $l < count($model->labels); $l++)
[
"{{ $model->labels[$l] }}",
@for ($i = 0; $i < count($model->datasets); $i++)
{{ $model->datasets[$i]['values'][$l] }},
@endfor
],
@endfor
])
var options = {
@include('charts::_partials.dimension.js')
legend: { position: 'top', alignment: 'end' },
fontSize: 12,
@include('charts::google.titles')
@include('charts::google.colors')
};
var {{ $model->id }} = new google.visualization.ColumnChart(document.getElementById("{{ $model->id }}"))
{{ $model->id }}.draw(data, options)
}
</script>
@if(!$model->customId)
@include('charts::_partials.container.div')
@endif

View File

@@ -0,0 +1,38 @@
<script type="text/javascript">
chart = google.charts.setOnLoadCallback(drawChart)
function drawChart() {
var data = google.visualization.arrayToDataTable([
[
'Element',
@for ($i = 0; $i < count($model->datasets); $i++)
"{{ $model->datasets[$i]['label'] }}",
@endfor
],
@for($l = 0; $l < count($model->labels); $l++)
[
"{{ $model->labels[$l] }}",
@for ($i = 0; $i < count($model->datasets); $i++)
{{ $model->datasets[$i]['values'][$l] }},
@endfor
],
@endfor
])
var options = {
@include('charts::_partials.dimension.js')
fontSize: 12,
@include('charts::google.titles')
@include('charts::google.colors')
legend: { position: 'top', alignment: 'end' }
};
var chart = new google.visualization.LineChart(document.getElementById("{{ $model->id }}"))
chart.draw(data, options)
}
</script>
@if(!$model->customId)
@include('charts::_partials.container.div')
@endif

View File

@@ -0,0 +1,26 @@
<script type="text/javascript">
google.charts.setOnLoadCallback(drawPieChart)
function drawPieChart() {
var data = google.visualization.arrayToDataTable([
['Element', 'Value'],
@for($i = 0; $i < count($model->values); $i++)
["{!! $model->labels[$i] !!}", {{ $model->values[$i] }}],
@endfor
])
var options = {
@include('charts::_partials.dimension.js')
fontSize: 12,
@include('charts::google.titles')
@include('charts::google.colors')
};
var chart = new google.visualization.PieChart(document.getElementById("{{ $model->id }}"))
chart.draw(data, options)
}
</script>
@if(!$model->customId)
@include('charts::_partials.container.div')
@endif

View File

@@ -0,0 +1,84 @@
<script type="text/javascript">
google.charts.setOnLoadCallback(draw{{ $model->id }})
function draw{{ $model->id }}() {
var data = google.visualization.arrayToDataTable([
['Element', 'Value'],
@if($model->values)
["{!! $model->element_label !!}", {{ $model->values[0] }}],
@else
["{!! $model->element_label !!}", 0],
@endif
])
var options = {
@include('charts::_partials.dimension.js')
@if(count($model->values) >= 2 and $model->values[1] <= $model->values[0])
@php($min = $model->values[1])
min: {{ $min }},
@else
@php($min = 0)
@endif
@if(count($model->values) >= 3 and $model->values[2] >= $model->values[0])
@php($max = $model->values[2])
max: {{ $max }},
@else
@php($max = 100)
@endif
@if($model->gauge_style == 'right')
// Calculate warning area
@php
$low_warning = round(0.40 * $max, 2);
$warning = round(0.25 * $max, 2);
$max_warning = round(0.10 * $max, 2);
@endphp
greenColor: '#c8e6c9', yellowColor: '#ffd54f', redColor: '#e57373',
greenFrom: {{ $low_warning }}, greenTo: {{ $max }},
yellowFrom: {{ $max_warning }}, yellowTo: {{ $low_warning }},
redFrom: {{ $min }}, redTo: {{ $max_warning }},
@elseif($model->gauge_style == 'center') {
// Calculate warning area
@php
$warning = round(0.25 * $max, 2);
$warning2 = round(0.75 * $max, 2);
@endphp
greenColor: '#c8e6c9', yellowColor: '#ffd54f', redColor: '#ffd54f',
greenFrom: {{ $warning }}, greenTo: {{ $warning2 }},
yellowFrom: {{ $min }}, yellowTo: {{ $warning }},
redFrom: {{ $warning2 }}, redTo: {{ $max }},
@else
// Calculate warning area
@php
$low_warning = round(0.60 * $max, 2);
$warning = round(0.75 * $max, 2);
$max_warning = round(0.90 * $max, 2);
@endphp
greenColor: '#c8e6c9', yellowColor: '#ffd54f', redColor: '#e57373',
greenFrom: {{ $min }}, greenTo: {{ $low_warning }},
yellowFrom: {{ $low_warning }}, yellowTo: {{ $max_warning }},
redFrom: {{ $max_warning }}, redTo: {{ $max }},
@endif
minorTicks: 10,
};
var {{ $model->id }} = new google.visualization.Gauge(document.getElementById("{{ $model->id }}"))
{{ $model->id }}.draw(data, options)
setInterval(function() {
$.getJSON("{{ $model->url }}", function( jdata ) {
data.setValue(0, 1, jdata["{{ $model->value_name }}"])
{{ $model->id }}.draw(data, options)
})
}, {{ $model->interval }})
}
</script>
@if(!$model->customId)
@include('charts::_partials/container.div-titled')
@endif

View File

@@ -0,0 +1,33 @@
<script type="text/javascript">
chart = google.charts.setOnLoadCallback(drawChart)
function drawChart() {
var data = google.visualization.arrayToDataTable([
[
'Element', "{!! $model->element_label !!}"],
@for ($i = 0; $i < count($model->values); $i++)
["{!! $model->labels[$i] !!}", {{ $model->values[$i] }}],
@endfor
])
var options = {
@include('charts::_partials.dimension.js')
fontSize: 12,
@include('charts::google.titles')
@include('charts::google.colors')
@if(!$model->legend)
legend: null
@else
legend: { position: 'top', alignment: 'end' }
@endif
};
var chart = new google.visualization.ScatterChart(document.getElementById("{{ $model->id }}"))
chart.draw(data, options)
}
</script>
@if(!$model->customId)
@include('charts::_partials.container.div')
@endif

View File

@@ -0,0 +1,10 @@
@if($model->title)
title: "{!! $model->title !!}",
@endif
@if($model->x_axis_title)
hAxis: {title: "{{ $model->x_axis_title }}"},
@endif
@if($model->y_axis_title)
vAxis: {title: "{{ $model->y_axis_title }}"},
@endif