Code Cakephp to select the data using the query and view in the view file

advertisements

The data coming from query like below image..

[enter image description here][1]

plz tell me how to echo data in my view.

I tried below code to echo but not working...

I need to echo data in below highcharts....

please help me

<script type="text/javascript">
$(function () {
    $('#container').highcharts({
        chart: {
            type: 'column'
        },
        title: {
            text: ''
        },
        subtitle: {
            text: ''
        },
        xAxis: {
            categories: [
                '1000',
                '2000',
                '3000',
                '4000',
                '5000',
                '6000',
                '7000',
                '8000',
                '9000',
                '10000',
                '11000',
                '12000'
            ],
            crosshair: true

        },
        yAxis: {
            min:0 ,
            title: {
                text: null
            }
        },
        tooltip: {
            headerFormat: '<span style="font-size:10px">{point.key}</span><table>',
            pointFormat: '<tr><td style="color:{series.color};padding:0">{series.name}: </td>' +
                '<td style="padding:0"><b>{point.y} mm</b></td></tr>',
            footerFormat: '</table>',
            shared: true,
            useHTML: true
        },
        legend: {
                    layout: 'vertical',
                    align: 'center',
                    verticalAlign: 'top',

                    floating: true,
                    borderWidth: 1,
                    width: 100,
                    height: 100
                },
        plotOptions: {
           series: {
                borderWidth: 0,
                dataLabels: {
                    enabled: true,
                    format: '{point.y}'
                }
            }
        },
        labels:
        {
          enabled: false
        },
        series: [{
            name: 'Tokyo',
            data: [<?php echo $dest_pcode; ?>, 121, 111, 154, 143, 143, 165, 148, 216, 194, 95,142]

        },{
            name: 'Berlin',
            data: [<?php echo $origin_pcode; ?>, 33, 176, 39, 52, 75, 133, 47, 177, 46, 51,110]
            }]
    });
});
</script>


Use $.parseJSON to parse the array and put it to jquery variable

var content=$.parseJSON('<?php echo $comparequotes;?>');

then give that variable in data as according to your need