Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/285.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和mysql中提取highchart中柱形图和样条曲线图的数据_Php_Mysql_Json_Highcharts - Fatal编程技术网

如何从php和mysql中提取highchart中柱形图和样条曲线图的数据

如何从php和mysql中提取highchart中柱形图和样条曲线图的数据,php,mysql,json,highcharts,Php,Mysql,Json,Highcharts,我试着用样条曲线图表制作一个柱组合图。我想要highcharts[link]中的这种类型的图表。但我的问题是,我想显示我的动态数据,包括样条曲线和柱状图,它们来自data.php,使用json进行数据检索。但我的图表不会像这样正确显示[链接] 我希望通过我的代码显示这种类型的图形。在样条线中,我希望显示query1中的“bsp值”,在柱状图中,我希望显示设备评级。下面是我通过json提取数据的代码:- data.php 这里我是为graph设计的: $(function () {

我试着用样条曲线图表制作一个柱组合图。我想要highcharts[link]中的这种类型的图表。但我的问题是,我想显示我的动态数据,包括样条曲线和柱状图,它们来自data.php,使用json进行数据检索。但我的图表不会像这样正确显示[链接]

我希望通过我的代码显示这种类型的图形。在样条线中,我希望显示query1中的“bsp值”,在柱状图中,我希望显示设备评级。下面是我通过json提取数据的代码:-

data.php

这里我是为graph设计的:

       $(function () {
        var chart;
        $(document).ready(function() {
         $.getJSON("data.php", function(json) {
       $('#container').highcharts({
        chart: {
            zoomType: 'xy'
        },
        title: {
            text: 'Project facility Rating'
        },
        subtitle: {
            text: 'testing'
        },
        xAxis: [{
            categories: []
        }],
        yAxis: [{ // Primary yAxis
            labels: {
              //  format: '{value} Rs.',
                style: {
                    color: Highcharts.getOptions().colors[1]
                }
            },
            title: {
                text: 'Bsp Cost',
                style: {
                    color: Highcharts.getOptions().colors[1]
                }
            }
        }, { // Secondary yAxis
            title: {
                text: 'Facility Rating',
                style: {
                    color: Highcharts.getOptions().colors[0]
                }
            },
            labels: {
                //format: '{value} out of 100',
                style: {
                    color: Highcharts.getOptions().colors[0]
                }
            },
            opposite: true
        }],
        tooltip: {
            shared: true
        },
        legend: {
            layout: 'vertical',
            align: 'left',
            x: 120,
            verticalAlign: 'top',
            y: 100,
            floating: true,
            backgroundColor: (Highcharts.theme &&    Highcharts.theme.legendBackgroundColor) || '#FFFFFF'
        },
        series: json
    });
      });
       });
        }); 

请告诉我为什么我的json代码不创建图形。

旁注:停止使用不推荐的
mysql.*
函数。使用或代替。这是一个适用于PDO的好方法。@Raptor我不知道MySQLi或PDO的语法。因此,请您建议如何通过我的示例编写代码。两个JSFIDLE链接都是相同的。另外,显示你的json。你的json看起来怎么样?@jdo请查看上面写的[link]和my data.php代码
       $(function () {
        var chart;
        $(document).ready(function() {
         $.getJSON("data.php", function(json) {
       $('#container').highcharts({
        chart: {
            zoomType: 'xy'
        },
        title: {
            text: 'Project facility Rating'
        },
        subtitle: {
            text: 'testing'
        },
        xAxis: [{
            categories: []
        }],
        yAxis: [{ // Primary yAxis
            labels: {
              //  format: '{value} Rs.',
                style: {
                    color: Highcharts.getOptions().colors[1]
                }
            },
            title: {
                text: 'Bsp Cost',
                style: {
                    color: Highcharts.getOptions().colors[1]
                }
            }
        }, { // Secondary yAxis
            title: {
                text: 'Facility Rating',
                style: {
                    color: Highcharts.getOptions().colors[0]
                }
            },
            labels: {
                //format: '{value} out of 100',
                style: {
                    color: Highcharts.getOptions().colors[0]
                }
            },
            opposite: true
        }],
        tooltip: {
            shared: true
        },
        legend: {
            layout: 'vertical',
            align: 'left',
            x: 120,
            verticalAlign: 'top',
            y: 100,
            floating: true,
            backgroundColor: (Highcharts.theme &&    Highcharts.theme.legendBackgroundColor) || '#FFFFFF'
        },
        series: json
    });
      });
       });
        });