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 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
  • ¥500 火焰左右视图、视差(基于双目相机)