【问题标题】:Highcharts chart with column and line using json使用json的带有列和线的Highcharts图表
【发布时间】:2013-03-26 15:43:06
【问题描述】:

我是 Highcharts 的新手,我已经喜欢它了。 我使用 json、php en mysql 制作了一些柱形图(带有给定的示例)。 现在我想使用 json 制作一个带有列和一条线的图表。 谁能告诉我应该怎么做??

$(function () {
var chart;
$(document).ready(function() {
    $.getJSON("DataKwhDagCum.php", function(json) {     
        chart = new Highcharts.Chart({
            chart: {
                renderTo: 'container',
                type: 'column',
                marginRight: 130,
                marginBottom: 25
            },
            title: {
                text: 'In (Enexis) vs Out (Zonnestroom)',
                x: -20 //center
            },
            subtitle: {
                text: '',
                x: -20
            },
            xAxis: {
                categories: ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20','21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31']
            },
            yAxis: {
                title: {
                    text: 'Amount'
                },
                plotLines: [{
                    value: 0,
                    width: 1,
                    color: '#808080'
                }]
            },
            tooltip: {
                formatter: function() {
                        return '<b>'+ this.series.name +'</b><br/>'+
                        this.x +': '+ this.y;
                }
            },
            legend: {
                layout: 'vertical',
                align: 'right',
                verticalAlign: 'top',
                x: -10,
                y: 100,
                borderWidth: 0
            },
            series: json
        });
    });

});

});

【问题讨论】:

  • 你应该先开始一点点编码,然后当你遇到困难时我们会来拯救你:D
  • 你卡在哪里了?你能描述一下你没有达到你想要的结果的地方吗?

标签: php json highcharts


【解决方案1】:

你可以使用两种方式

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-05-03
    • 1970-01-01
    相关资源
    最近更新 更多