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,10 @@
@for($i = 0; $i < count($model->datasets); $i++)
var s{{ $i }} = [
@for($k = 0; $k < count($model->datasets[$i]['values']); $k++)
{
x: "{{ $model->labels[$k] }}",
y: {{ $model->datasets[$i]['values'][$k] }},
},
@endfor
];
@endfor

View File

@@ -0,0 +1,11 @@
var data = [
@for($i = 0; $i < count($model->values); $i++)
{
x: "{!! $model->labels[$i] !!}",
y: {{ $model->values[$i] }},
@if($model->colors)
color: "{{ $model->colors[$i] }}"
@endif
},
@endfor
];

View File

@@ -0,0 +1,37 @@
@include('charts::_partials.container.svg')
<script type="text/javascript">
$(function() {
@include('charts::plottablejs._data.one')
var xScale = new Plottable.Scales.Category();
var yScale = new Plottable.Scales.Linear();
var xAxis = new Plottable.Axes.Category(xScale, 'bottom');
var yAxis = new Plottable.Axes.Numeric(yScale, 'left');
var plot = new Plottable.Plots.Area()
.addDataset(new Plottable.Dataset(data))
.x(function(d) { return d.x; }, xScale)
.y(function(d) { return d.y; }, yScale)
@if($model->colors)
.attr('stroke', "{{ $model->colors[0] }}")
.attr('fill', "{{ $model->colors[0] }}")
@endif
.animated(true);
var title;
@if($model->title)
title = new Plottable.Components.TitleLabel("{!! $model->title !!}").yAlignment('center');
@endif
var label = new Plottable.Components.AxisLabel("{!! $model->element_label !!}").yAlignment('center').angle(270);
var table = new Plottable.Components.Table([[null,null, title],[label, yAxis, plot],[null, null, xAxis]]);
table.renderTo('svg#{{ $model->id }}');
window.addEventListener('resize', function() {
table.redraw()
})
});
</script>

View File

@@ -0,0 +1,36 @@
@include('charts::_partials.container.svg')
<script type="text/javascript">
$(function() {
@include('charts::plottablejs._data.one')
var xScale = new Plottable.Scales.Category();
var yScale = new Plottable.Scales.Linear();
var xAxis = new Plottable.Axes.Category(xScale, 'bottom');
var yAxis = new Plottable.Axes.Numeric(yScale, 'left');
var plot = new Plottable.Plots.Bar()
.addDataset(new Plottable.Dataset(data))
.x(function(d) { return d.x; }, xScale)
.y(function(d) { return d.y; }, yScale)
@if($model->colors)
.attr('fill', function(d) { return d.color; })
@endif
.animated(true);
var title;
@if($model->title)
title = new Plottable.Components.TitleLabel("{!! $model->title !!}").yAlignment('center');
@endif
var label = new Plottable.Components.AxisLabel("{!! $model->element_label !!}").yAlignment('center').angle(270);
var table = new Plottable.Components.Table([[null,null, title],[label, yAxis, plot],[null, null, xAxis]]);
table.renderTo('svg#{{ $model->id }}');
window.addEventListener('resize', function() {
table.redraw()
})
});
</script>

View File

@@ -0,0 +1,41 @@
@include('charts::_partials.container.svg')
<script type="text/javascript">
$(function() {
@include('charts::plottablejs._data.one')
var xScale = new Plottable.Scales.Category()
var yScale = new Plottable.Scales.Linear()
var xAxis = new Plottable.Axes.Category(xScale, 'bottom')
var yAxis = new Plottable.Axes.Numeric(yScale, 'left')
var reverseMap = {};
data.forEach(function(d) { reverseMap[d.y] = d.x;});
var plot = new Plottable.Plots.Pie()
.addDataset(new Plottable.Dataset(data))
.sectorValue(function(d) { return d.y; }, yScale)
@if($model->colors)
.attr('fill', function(d) { return d.color; })
@endif
.innerRadius(250, yScale)
.outerRadius(500, yScale)
.labelsEnabled(true)
.labelFormatter(function(n){ return reverseMap[n] ;})
.animated(true);
var title;
@if($model->title)
title = new Plottable.Components.TitleLabel("{!! $model->title !!}").yAlignment('center');
@endif
var table = new Plottable.Components.Table([[title],[plot]]);
table.renderTo('svg#{{ $model->id }}');
window.addEventListener('resize', function() {
table.redraw()
})
});
</script>

View File

@@ -0,0 +1,36 @@
@include('charts::_partials.container.svg')
<script type="text/javascript">
$(function() {
@include('charts::plottablejs._data.one')
var xScale = new Plottable.Scales.Category();
var yScale = new Plottable.Scales.Linear();
var xAxis = new Plottable.Axes.Category(xScale, 'bottom');
var yAxis = new Plottable.Axes.Numeric(yScale, 'left');
var plot = new Plottable.Plots.Line()
.addDataset(new Plottable.Dataset(data))
.x(function(d) { return d.x; }, xScale)
.y(function(d) { return d.y; }, yScale)
@if($model->colors)
.attr('stroke', "{{ $model->colors[0] }}")
@endif
.animated(true);
var title;
@if($model->title)
title = new Plottable.Components.TitleLabel("{!! $model->title !!}").yAlignment('center');
@endif
var label = new Plottable.Components.AxisLabel("{!! $model->element_label !!}").yAlignment('center').angle(270);
var table = new Plottable.Components.Table([[null,null, title],[label, yAxis, plot],[null, null, xAxis]]);
table.renderTo('svg#{{ $model->id }}');
window.addEventListener('resize', function() {
table.redraw()
})
});
</script>

View File

@@ -0,0 +1,39 @@
@include('charts::_partials.container.svg')
<script type="text/javascript">
$(function() {
@include('charts::plottablejs._data.multi')
var xScale = new Plottable.Scales.Category();
var yScale = new Plottable.Scales.Linear();
var xAxis = new Plottable.Axes.Category(xScale, 'bottom');
var yAxis = new Plottable.Axes.Numeric(yScale, 'left');
var plot = new Plottable.Plots.Area()
@for($i = 0; $i < count($model->datasets); $i++)
.addDataset(new Plottable.Dataset(s{{ $i }}))
@endfor
.x(function(d) { return d.x; }, xScale)
.y(function(d) { return d.y; }, yScale)
@if($model->colors)
.attr('stroke', "{{ $model->colors[0] }}")
.attr('fill', "{{ $model->colors[0] }}")
@endif
.animated(true);
var title;
@if($model->title)
title = new Plottable.Components.TitleLabel("{!! $model->title !!}").yAlignment('center');
@endif
var label = new Plottable.Components.AxisLabel("{!! $model->element_label !!}").yAlignment('center').angle(270);
var table = new Plottable.Components.Table([[null,null, title],[label, yAxis, plot],[null, null, xAxis]]);
table.renderTo('svg#{{ $model->id }}');
window.addEventListener('resize', function() {
table.redraw()
})
});
</script>

View File

@@ -0,0 +1,41 @@
@include('charts::_partials.container.svg')
<script type="text/javascript">
$(function() {
@include('charts::plottablejs._data.multi')
var xScale = new Plottable.Scales.Category();
var yScale = new Plottable.Scales.Linear();
var xAxis = new Plottable.Axes.Category(xScale, 'bottom');
var yAxis = new Plottable.Axes.Numeric(yScale, 'left');
var plot = new Plottable.Plots.ClusteredBar()
@for($i = 0; $i < count($model->datasets); $i++)
.addDataset(new Plottable.Dataset(s{{ $i }}))
@endfor
.x(function(d) { return d.x; }, xScale)
.y(function(d) { return d.y; }, yScale)
@if($model->colors)
.attr('stroke', "{{ $model->colors[0] }}")
.attr('fill', "{{ $model->colors[0] }}")
@endif
.animated(true);
var title;
@if($model->title)
title = new Plottable.Components.TitleLabel("{!! $model->title !!}").yAlignment('center');
@endif
var label = new Plottable.Components.AxisLabel("{!! $model->element_label !!}")
.yAlignment('center').angle(270);
var table = new Plottable.Components.Table([[null,null, title],[label, yAxis, plot],[null, null, xAxis]]);
table.renderTo('svg#{{ $model->id }}');
window.addEventListener('resize', function() {
table.redraw()
})
});
</script>

View File

@@ -0,0 +1,38 @@
@include('charts::_partials.container.svg')
<script type="text/javascript">
$(function() {
@include('charts::plottablejs._data.multi')
var xScale = new Plottable.Scales.Category();
var yScale = new Plottable.Scales.Linear();
var xAxis = new Plottable.Axes.Category(xScale, 'bottom');
var yAxis = new Plottable.Axes.Numeric(yScale, 'left');
var plot = new Plottable.Plots.Line()
@for($i = 0; $i < count($model->datasets); $i++)
.addDataset(new Plottable.Dataset(s{{ $i }}))
@endfor
.x(function(d) { return d.x; }, xScale)
.y(function(d) { return d.y; }, yScale)
@if($model->colors)
.attr('stroke', "{{ $model->colors[0] }}")
@endif
.animated(true);
var title;
@if($model->title)
title = new Plottable.Components.TitleLabel("{!! $model->title !!}").yAlignment('center');
@endif
var label = new Plottable.Components.AxisLabel("{!! $model->element_label !!}").yAlignment('center').angle(270);
var table = new Plottable.Components.Table([[null,null, title],[label, yAxis, plot],[null, null, xAxis]]);
table.renderTo('svg#{{ $model->id }}');
window.addEventListener('resize', function() {
table.redraw()
})
});
</script>

View File

@@ -0,0 +1,39 @@
@include('charts::_partials.container.svg')
<script type="text/javascript">
$(function() {
@include('charts::plottablejs._data.one')
var xScale = new Plottable.Scales.Category();
var yScale = new Plottable.Scales.Linear();
var xAxis = new Plottable.Axes.Category(xScale, 'bottom');
var yAxis = new Plottable.Axes.Numeric(yScale, 'left');
var reverseMap = {};
data.forEach(function(d) { reverseMap[d.y] = d.x;});
var plot = new Plottable.Plots.Pie()
.addDataset(new Plottable.Dataset(data))
.sectorValue(function(d) { return d.y; }, yScale)
@if($model->colors)
.attr('fill', function(d) { return d.color; })
@endif
.labelsEnabled(true)
.labelFormatter(function(n){ return reverseMap[n] ;})
.outerRadius(500, yScale)
.animated(true);
var title;
@if($model->title)
title = new Plottable.Components.TitleLabel("{!! $model->title !!}").yAlignment('center');
@endif
var table = new Plottable.Components.Table([[title],[plot]]);
table.renderTo('svg#{{ $model->id }}');
window.addEventListener('resize', function() {
table.redraw()
})
});
</script>