donglang6656 2014-02-04 13:44
浏览 46
已采纳

数据阵列中的Highcharts类别

I'm trying to pull data from a mysql table and set it as the x-axis categories but I don't quite understand how.

Basically, I have Job numbers in a table, and I want to pull those and make them the categories on the x-axis, eventually when a column is clicked for a specific job, it'll drill down for more columns (which add up to the total percentage of the job number).

Here's an example of what I'm trying to do, it works with the column data when using an array there but not with the categories so it wouldn't work this way.

http://codepen.io/anon/pen/BoJqA

How would I go about doing this?

  • 写回答

4条回答 默认 最新

  • douque8855 2014-02-04 14:09
    关注

    I'm not sure if the question is "how can i do this with php/mysql" or "how can i define column names in highcharts". i'll try to answer the latter. try this code to show custom column names instead of 1,2,3,...:

    $(function () { 
        var data = {"name":"Percentage","data":[50,28,150,125,34,75]};
        var categories = [5600, 5700,5800,5900,6000,6100];
        chart = new Highcharts.Chart({
            chart: {
                renderTo: 'container',
                type: 'column'
            },
            title: {
                text: 'Job Budget Report'
            },
            xAxis: {
                categories: categories
            },
            yAxis: {
                title: {
                    text: '% Budget hrs'
                },
                plotLines: [{
                    value: 0,
                    width: 1,
                    color: '#808080'
                 }]
            },
            series: [data]
        });
    });
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)

报告相同问题?

悬赏问题

  • ¥15 HFSS 中的 H 场图与 MATLAB 中绘制的 B1 场 部分对应不上
  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?