Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/codeigniter/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 使用Codeigniter和highcharts的highcharts中的空白数据_Php_Codeigniter_Highcharts - Fatal编程技术网

Php 使用Codeigniter和highcharts的highcharts中的空白数据

Php 使用Codeigniter和highcharts的highcharts中的空白数据,php,codeigniter,highcharts,Php,Codeigniter,Highcharts,我在使用codeigniter方面是新手。我们的老师要求我们在系统中设置图表,但图表显示如图所示 我的观点: $(function () { $('#chart-A').highcharts({ chart: { type: 'column' }, title: { text: 'Reports for Most Ordered Pizza'

我在使用codeigniter方面是新手。我们的老师要求我们在系统中设置图表,但图表显示如图所示

我的观点:

$(function () {
        $('#chart-A').highcharts({
            chart: {
                type: 'column'
            },
            title: {
                text: 'Reports for Most Ordered Pizza'
            },
            subtitle: {
                text: 'Ordered Pizzas Only'
            },
            xAxis: {
                type: 'category',
                labels: {
                    rotation: -45,
                    align: 'right',
                    style: {
                        fontSize: '13px',
                        fontFamily: 'Verdana, sans-serif'
                    }
                }
            },
            yAxis: {
                min: 0,
                title: {
                    text: 'Sales (Peso)'
                }
            },
            // plotOptions: {
            //     series: {
            //         minPointLength: 0
            //     }
            // },
            legend: {
                enabled: false
            },
            tooltip: {
                pointFormat: '<b>{point.y} Pesos</b>',
            },
            series: [{
                name: 'Sales',
                data: <?php echo json_encode($pizzas);?>,
                dataLabels: {
                    enabled: true,
                    rotation: -90,
                    color: '#FFFFFF',
                    align: 'right',
                    x: 4,
                    y: 10,
                    style: {
                        fontSize: '13px',
                        fontFamily: 'Verdana, sans-serif',
                        textShadow: '0 0 3px black'
                    }
                }
            }]
        });
public function tabular()
    {
        $data['pizzas'] = $this->user_model->tabular();
        var_dump($this->user_model->tabular());

        $this->load->view('template/header');
        $this->load->view('template/menubar');
        $this->load->view('template/highcharts',$data);
        $this->load->view('template/footer');

    }
public function tabular() {
        $this->db->select('products.name AS name, SUM(order_details.price) AS total');
        $this->db->from('order_details');
        $this->db->join('products', 'products.prod_id = order_details.prod_id', 'LEFT');
        $this->db->group_by("products.prod_id");
        $query = $this->db->get();
        foreach ($query->result() as $row){
            $results[] = array(
                'name' => $row->name,
                'total' => (float) $row->total
            );

        }
        return $results;
    }
我的型号:

$(function () {
        $('#chart-A').highcharts({
            chart: {
                type: 'column'
            },
            title: {
                text: 'Reports for Most Ordered Pizza'
            },
            subtitle: {
                text: 'Ordered Pizzas Only'
            },
            xAxis: {
                type: 'category',
                labels: {
                    rotation: -45,
                    align: 'right',
                    style: {
                        fontSize: '13px',
                        fontFamily: 'Verdana, sans-serif'
                    }
                }
            },
            yAxis: {
                min: 0,
                title: {
                    text: 'Sales (Peso)'
                }
            },
            // plotOptions: {
            //     series: {
            //         minPointLength: 0
            //     }
            // },
            legend: {
                enabled: false
            },
            tooltip: {
                pointFormat: '<b>{point.y} Pesos</b>',
            },
            series: [{
                name: 'Sales',
                data: <?php echo json_encode($pizzas);?>,
                dataLabels: {
                    enabled: true,
                    rotation: -90,
                    color: '#FFFFFF',
                    align: 'right',
                    x: 4,
                    y: 10,
                    style: {
                        fontSize: '13px',
                        fontFamily: 'Verdana, sans-serif',
                        textShadow: '0 0 3px black'
                    }
                }
            }]
        });
public function tabular()
    {
        $data['pizzas'] = $this->user_model->tabular();
        var_dump($this->user_model->tabular());

        $this->load->view('template/header');
        $this->load->view('template/menubar');
        $this->load->view('template/highcharts',$data);
        $this->load->view('template/footer');

    }
public function tabular() {
        $this->db->select('products.name AS name, SUM(order_details.price) AS total');
        $this->db->from('order_details');
        $this->db->join('products', 'products.prod_id = order_details.prod_id', 'LEFT');
        $this->db->group_by("products.prod_id");
        $query = $this->db->get();
        foreach ($query->result() as $row){
            $results[] = array(
                'name' => $row->name,
                'total' => (float) $row->total
            );

        }
        return $results;
    }

我怎样才能解决这个问题?请帮帮我。

您似乎错过了图表中的CSS。重新加载页面并按F12键,然后检查控制台是否缺少.css文件。另外,请确保启用PHP代码中显示的错误,以确保后端代码正常工作,不会出现任何错误。

我猜您缺少按格式化顺序传递数据的
highchart
格式。 看看下面的例子


[

这不是答案。这是commentbootstrap.js:8未捕获错误:Bootstrap的JavaScript要求在Bootstrap.js:8 Bootstrap.min.js:6未捕获错误:Bootstrap的JavaScript要求在Bootstrap.min.js:6在Bootstrap.js.js:6上使用jQuery。你能粘贴$pizzas json吗?在这里粘贴json_编码($pizzas)。string'[{“name”:“pizza burger”,“total”:870},{“name”“水牛鸡”,“总数”:1085},{“名称”:“培根蘑菇”,“总数”:165},{“名称”:“香肠狂热”,“总数”:450},{“名称”:“牛肉沙瓦玛”,“总数”:1575},{“名称”:“美味热狗”,“总数”:230},{“名称”:“奥利奥皮纳”,“总数”:240},{“名称”:“金枪鱼大蒜”,“总数”:130},{“名称”:“所有匈牙利人”,“总数”:135},{“名称”:“牛肉辣味香肠”,“总数”:135},{“名称”:“夏威夷人”,“total”:480}]'(length=401)当我var_转储json_编码时,这是用于注释的结果tnx,但我无法计算出来