vendredi 2 mars 2018

Using HighCharts with LARAVEL

I would like to use Highchart for laravel but i don't know how to pass data from controller to blade with the correct syntax. Actually i'm using static data and the graph is displayed correctly.

statistiche.blade.php

<div class="row">
    <div class="col-md-12">
        <div id="container2" style="height: 400px; min-width: 310px"></div>
    </div>
</div>

<script>
// Create the chart
        Highcharts.stockChart('container2', {

            rangeSelector: {
                selected: 1
            },

            title: {
                text: 'AAPL Stock Price'
            },

            plotOptions: {
                spline: {
                    marker: {
                        enabled: true
                    }
                }
            },

            series: [{
                name: 'Richieste scadute',
                data: [
                    [Date.UTC(1970, 9, 21), 0],
                    [Date.UTC(1970, 10, 4), 0.28],
                    [Date.UTC(1970, 10, 9), 0.25],
                    [Date.UTC(1970, 10, 27), 0.2],
                    [Date.UTC(1970, 11, 2), 0.28]
                ]
            }, {
                name: 'Richieste evase',
                data: [
                    [Date.UTC(1970, 9, 29), 0],
                    [Date.UTC(1970, 10, 9), 0.4],
                    [Date.UTC(1970, 11, 1), 0.25],
                    [Date.UTC(1971, 0, 1), 1.66],
                    [Date.UTC(1971, 0, 10), 1.8]
                ]
            }, {
                name: 'Richieste in attesa',
                data: [
                    [Date.UTC(1970, 10, 25), 0],
                    [Date.UTC(1970, 11, 6), 0.25],
                    [Date.UTC(1970, 11, 20), 1.41],
                    [Date.UTC(1970, 11, 25), 1.64],
                    [Date.UTC(1971, 0, 4), 1.6]
                ]
            }]
        });

I would to use controller for extract data and pass there into the blade. Some advice?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire