Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/238.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更新Jquery数据系列_Php_Jquery_Mysql_Charts - Fatal编程技术网

使用php更新Jquery数据系列

使用php更新Jquery数据系列,php,jquery,mysql,charts,Php,Jquery,Mysql,Charts,如何使用可从Mysql使用php获得的数据更新图表的以下Jquery数据系列 var data = { labels: ['JAN', 'FEB', 'MAR', 'APR', 'MAY', 'JUN', 'JUL', 'AUG', 'SEP', 'OCT', 'NOV', 'DEC'], series: [{ name: 'series-1', data: [5, 9, 7, 8, 5, 3, 5, 4, 5, 9, 7, 8] }, {

如何使用可从Mysql使用php获得的数据更新图表的以下Jquery数据系列

var data = {
    labels: ['JAN', 'FEB', 'MAR', 'APR', 'MAY', 'JUN', 'JUL', 'AUG', 'SEP', 'OCT', 'NOV', 'DEC'],
    series: [{
        name: 'series-1',
        data: [5, 9, 7, 8, 5, 3, 5, 4, 5, 9, 7, 8]
    }, {
        name: 'series-2',
        data: [11,14,11,19,15,12,14,18,11,10,13,15]
    }]
};

下面是图表js的完整代码。我尝试创建一个javascript变量并为其分配一个php变量,但没有成功

jQuery(document).ready(function() {

// Chartist

    var options = {
        low: 0,
        high: 20,
        showArea: true,
        showPoint: false,
        fullWidth: true,
        axisY: {
            labelInterpolationFnc: function(value) {
                return '$'+value+'k';
            },
            scaleMinSpace: 20
        },
        series: {
            'series-2': {
                showArea: true,
                showPoint: false,
                fullWidth: true,
            },
            'series-1': {
                fullWidth: true,
            }
        }
    };

    var data = {
        labels: ['JAN', 'FEB', 'MAR', 'APR', 'MAY', 'JUN', 'JUL', 'AUG', 'SEP', 'OCT', 'NOV', 'DEC'],
        series: [{
            name: 'series-1',
            data: [5, 9, 7, 8, 5, 3, 5, 4, 5, 9, 7, 8]
        }, {
            name: 'series-2',
            data: [11,14,11,19,15,12,14,18,11,10,13,15]
        }]
    };

    new Chartist.Line("#fullChart", data, options);

    var data = {
        series: [1, 5]
    };

    var sum = function(a, b) { return a + b };

    new Chartist.Pie('#chartistPie', data, {
        labelInterpolationFnc: function(value) {
            return '';
        }
    });

    new Chartist.Line('#areaChart', {
        labels: [1, 2, 3, 4, 5, 6, 7],
        series: [
            [5, 9, 7, 8, 5, 3, 5]
        ]
    }, {
    low: 0,
    showArea: true,
    fullWidth: true,
    fullWidth: true,
    showPoint: false,
    colors:["#f44336"],
    axisY: {
        showGrid: false,
        showLabel: false,
        offset: 0
    },
        axisX:{
        showGrid: false,
        showLabel: false,
        offset: 0
      },

        lineSmooth: true,
    });

// Extrabar
    $("#layout-static .static-content-wrapper").append("<div class='extrabar-underlay'></div>");

// Calendar

    $('#calendar').datepicker({todayHighlight: true});

// Easypie chart
    try{
        $('.easypiechart#chart1').easyPieChart({
            barColor: "#00bcd4",
            trackColor: 'rgba(255,255,255,0.1)',
            scaleColor: 'transparent',
            scaleLength: 8,
            lineCap: 'round',
            lineWidth: 4,
            size: 144,
            onStep: function(from, to, percent) {
                $(this.el).find('.percent').text(Math.round(percent));
            }
        });
    }
    catch(e){}


    $('.progress-pie-chart').each(function(index, obj) {
        new Chartist.Pie(obj, {
            series: [$(obj).attr('data-percent'), 15]
        }, {
            labelInterpolationFnc: function(value) {
                return '';
            },
            width: '42px',
            height: '42px',
        });
    })

// Sparklines    
    var sparker = function() {
        var barSpacing = ($('#dailysales2').width() - 13*6)/13;
        $("#dailysales, #dailysales2").sparkline([5,6,7,2,0,4,2,4,6,8,1,4,6,4], {
            type: 'bar',
            height: '144px',
            width: '100%',
            barWidth: 4,
            barSpacing: Math.floor(barSpacing),
            barColor: 'rgba(255,255,255,0.3)'});

        $("#biglines").sparkline([11,5,8,13,10,12,5,9,11], {
            type: 'line',
            width: '100%',
            height: '106px',
            lineWidth: 0.01,
            lineColor: '#fff',
            fillColor: '#e0e0e0',
            highlightSpotColor: '#b0bec5',
            highlightLineColor: '#b0bec5',
            chartRangeMin: 0,chartRangeMax: 20,
            spotRadius: 0
        });
        $("#biglines").sparkline([9,5,10,8,12,5,12,7,10], {
            type: 'line',
            width: '100%',
            height: '106px',
            lineWidth: 0.01,
            lineColor: '#fff',
            fillColor: '#3f51b5',
            highlightSpotColor: '#546e7a',
            highlightLineColor: '#546e7a',
            chartRangeMin: 0,
            chartRangeMax: 20,
            composite: true,
            spotRadius: 0
        });



        $('#dashboard-sparkline-indigo').sparkline([5,2,4,9,3,4,7,2,6,4], { type: 'bar', barColor: 'rgba(255,255,255,0.5)', height: '48px',width: '100%', barWidth: 2, barSpacing: 4, spotRadius: 4, chartRangeMin: 1});
        $('#dashboard-sparkline-gray').sparkline([5,3,1,4,3,4,7,8,2,3], { type: 'bar', barColor: 'rgba(255,255,255,0.5)', height: '48px',width: '100%', barWidth: 2, barSpacing: 4, spotRadius: 4, chartRangeMin: 1});
        $('#dashboard-sparkline-primary').sparkline([1,3,2,9,1,6,5,2,6,9], { type: 'bar', barColor: 'rgba(255,255,255,0.5)', height: '48px',width: '100%', barWidth: 2, barSpacing: 4, spotRadius: 4, chartRangeMin: 1});
        $('#dashboard-sparkline-success').sparkline([2,5,4,9,6,3,7,1,5,1], { type: 'bar', barColor: 'rgba(255,255,255,0.5)', height: '48px',width: '100%', barWidth: 2, barSpacing: 4, spotRadius: 4, chartRangeMin: 1});
    }
    var sparkResize;

    $(window).resize(function(e) {
        clearTimeout(sparkResize);
        sparkResize = setTimeout(sparker, 500);
    });
    sparker();


});
jQuery(文档).ready(函数(){
//图表作者
变量选项={
低:0,,
高:20,,
展区:没错,
卖点:错,
全宽:对,
axisY:{
labelInterpolationFnc:函数(值){
返回“$”+值+'k';
},
比例空间:20
},
系列:{
“系列-2”:{
展区:没错,
卖点:错,
全宽:对,
},
“系列-1”:{
全宽:对,
}
}
};
风险值数据={
标签:[一月、二月、三月、四月、五月、六月、七月、八月、九月、十月、十一月、十二月],
系列:[{
名称:'series-1',
数据:[5,9,7,8,5,3,5,4,5,9,7,8]
}, {
名称:'series-2',
数据:[11,14,11,19,15,12,14,18,11,10,13,15]
}]
};
新的图表列表线(#fullChart),数据,选项);
风险值数据={
系列:[1,5]
};
var sum=函数(a,b){返回a+b};
新的ChartList.Pie(“#chartistPie”,数据{
labelInterpolationFnc:函数(值){
返回“”;
}
});
新图表列表线(“#面积图”{
标签:[1,2,3,4,5,6,7],
系列:[
[5, 9, 7, 8, 5, 3, 5]
]
}, {
低:0,,
展区:没错,
全宽:对,
全宽:对,
卖点:错,
颜色:[“#f44336”],
axisY:{
showGrid:false,
showLabel:false,
偏移量:0
},
axisX:{
showGrid:false,
showLabel:false,
偏移量:0
},
是的,
});
//附加条
$(“#布局静态.静态内容包装”).append(“”);
//历法
$(“#日历”).datepicker({todayHighlight:true});
//简易图表
试一试{
$('.easypiechart#chart1')。easypiechart({
barColor:#00bcd4“,
trackColor:'rgba(255255,0.1)',
scaleColor:'透明',
刻度长度:8,
线头:“圆形”,
线宽:4,
尺码:144,
onStep:函数(从,到,百分比){
$(this.el).find('.percent').text(Math.round(percent));
}
});
}
捕获(e){}
$(“.进度饼图”)。每个(函数(索引,obj){
新图表师。派(obj{
系列:[$(obj).attr('data-percent'),15]
}, {
labelInterpolationFnc:函数(值){
返回“”;
},
宽度:“42px”,
高度:'42px',
});
})
//闪闪发光
var sparker=函数(){
变量barSpacing=($('#dailysales2').width()-13*6)/13;
美元(“#dailysales,#dailysales2”)。小苏打([5,6,7,2,0,4,2,4,4,6,8,1,4,6,4]{
类型:'bar',
高度:'144px',
宽度:“100%”,
条宽:4,
酒吧间距:数学地板(酒吧间距),
barColor:'rgba(255255,0.3)};
美元(“#biglines”)。小苏打([11,5,8,13,10,12,5,9,11]{
键入:“行”,
宽度:“100%”,
高度:'106px',
线宽:0.01,
线条颜色:“#fff”,
填充颜色:'#e0',
highlightSpotColor:“#b0bec5”,
highlightLineColor:“#b0bec5”,
chartRangeMin:0,chartRangeMax:20,
光斑半径:0
});
$(“#biglines”)。小苏打([9,5,10,8,12,5,12,7,10]{
键入:“行”,
宽度:“100%”,
高度:'106px',
线宽:0.01,
线条颜色:“#fff”,
填充颜色:“#3f51b5”,
highlightSpotColor:“#546e7a”,
highlightLineColor:“#546e7a”,
chartRangeMin:0,
chartRangeMax:20,
是的,
光斑半径:0
});
$(#dashboard Sparkine indigo')。Sparkine([5,2,4,9,3,4,7,2,6,4],{type:'bar',barColor:'rgba(255255255,0.5)”,高度:'48px',宽度:'100%,barWidth:2,barSpacing:4,spotRadius:4,chartRangeMin:1});
$(“#仪表板亮闪闪灰色”)。亮闪闪([5,3,1,4,3,4,7,8,2,3],{type:'bar',barColor:'rgba(255255255,0.5)”,高度:'48px',宽度:'100%,barWidth:2,barSpacing:4,spotRadius:4,chartRangeMin:1});
$(#dashboard Sparkine primary')。Sparkine([1,3,2,9,1,6,5,2,6,9],{type:'bar',barColor:'rgba(255255255,0.5)”,高度:'48px',宽度:'100%,barWidth:2,barSpacing:4,spotRadius:4,chartRangeMin:1});
$(#dashboard Sparkine success')。Sparkine([2,5,4,9,6,3,7,1,5,1],{type:'bar',barColor:'rgba(255255255,0.5)”,高度:'48px',宽度:'100%,barWidth:2,barSpacing:4,spotRadius:4,chartRangeMin:1});
}
var-sparkResize;
$(窗口)。调整大小(函数(e){
clearTimeout(sparkResize);
sparkResize=设置超时(sparker,500);
});
火花器();
});
类似

$data = array(
        'labels' => array('JAN', 'FEB', 'MAR', 'APR', 'MAY', 'JUN', 'JUL', 'AUG', 'SEP', 'OCT', 'NOV', 'DEC'),
        'series' => array(array(
            'name' => 'series-1',
            'data' => array(5, 9, 7, 8, 5, 3, 5, 4, 5, 9, 7, 8)
        ), array(
            'name' => 'series-2',
            'data' => array(11,14,11,19,15,12,14,18,11,10,13,15)
        ))
    );
    return json_encode($data);
简单JS数组[]-变为简单PHP数组(),JS对象{key:value}变为关联PHP数组('key'=>'value')

类似于

$data = array(
        'labels' => array('JAN', 'FEB', 'MAR', 'APR', 'MAY', 'JUN', 'JUL', 'AUG', 'SEP', 'OCT', 'NOV', 'DEC'),
        'series' => array(array(
            'name' => 'series-1',
            'data' => array(5, 9, 7, 8, 5, 3, 5, 4, 5, 9, 7, 8)
        ), array(
            'name' => 'series-2',
            'data' => array(11,14,11,19,15,12,14,18,11,10,13,15)
        ))
    );
    return json_encode($data);

简单JS数组[]-变为简单PHP数组(),JS对象{key:value}变为关联PHP数组('key'=>'value')

向我们展示您自己迄今为止所做的尝试,这不是一个编码服务。我尝试创建一个这样的变量,并将其添加到数据系列中,但它不起作用var value1=“”;你在用什么图表?我没有看到任何图表名称。它来自一个名为paper admin的管理模板。在这里显示图表代码向我们显示您自己到目前为止尝试过的内容,因此不是一个编码服务我尝试创建一个这样的变量并将其添加到数据系列中,但它不起作用