recherche

Maison  >  Questions et réponses  >  le corps du texte

highcharts - php中highchart中的data赋值了,然后没显示什么,代码如下,谢谢

<script src="assets/highcharts/highcharts.js"></script>
<script src="assets/highcharts/modules/exporting.js"></script>

<p class="row">
    <p id="container" style="min-width: 310px; height: 400px; margin: 0 auto"></p>
</p>
<script>


    $(document).ready(function () {
        var options = {
            chart: {
                renderTo: 'container',
                type: 'line'
            },
            title: {
                text: '内存占用信息图',
                x: -20 //center
            },
            xAxis: {
                title: {
                    text: '时间'
                }
            },
            yAxis: {
                title: {
                    text: '单位:kb'
                }
            },
            legend: {
                enabled: false
            },
            series: []
        };
        $.getJSON("<?php echo $jsonUrl; ?>", function (json) {
            //console.log(json['data']);
            //options.xAxis.categories = json[0]['data']; //xAxis: {categories: []}

            var temp = json['data'];
            var data = [];
            for (i = 0; i < temp.length; i++) {

                date = temp[i].start_time;
                value = parseFloat(temp[i].memusg);
                data.push([
                    date,
                    value]);
            }

            //console.log(data);
            options.series[0] = data;
            chart = new Highcharts.Chart(options);
        });
    });
</script>

下面是data的值

PHP中文网PHP中文网2895 Il y a quelques jours367

répondre à tous(0)je répondrai

Pas de réponse
  • Annulerrépondre