首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在Highcharts组织结构图中进行深入分析?

在Highcharts组织结构图中进行深入分析?
EN

Stack Overflow用户
提问于 2020-06-14 20:50:46
回答 1查看 300关注 0票数 0

您好,是否可以深入了解highcharts组织结构图?

如果是这样,谁能告诉我这个配置出了什么问题?

https://jsfiddle.net/ogLy28tb/1/

我加载了drilldown.js,并将条形图下钻示例与组织结构图数据和节点设置混合在一起,但它没有反应。

谢谢

代码语言:javascript
复制
Highcharts.chart('container', {
    chart: {
        height:600,
        width:1300,
        inverted: true
    },
    title: {
        text: 'Highcharts Org Chart'
    },
    accessibility: {
        point: {
            descriptionFormatter: function (point) {
                var nodeName = point.toNode.name,
                    nodeId = point.toNode.id,
                    nodeDesc = nodeName === nodeId ? nodeName : nodeName + ', ' + nodeId,
                    parentDesc = point.fromNode.id;
                return point.index + '. ' + nodeDesc + ', reports to ' + parentDesc + '.';
            }
        }
    },
    series: [{
        type: 'organization',
        name: 'Highsoft',
       // keys: ['from', 'to','drilldown'],
        data: [
            {   
                from:'CO',
                to:'DIV01',
              drilldown:'DIV01'
            },
            {
                from:'CO',
              to:'DIV02',
              drilldown:'DIV02'
            },
            {
                from:'CO',
              to:'DIV03',
              drilldown:'DIV03'
            },
            {
                from:'CO',
              to:'DIV04',
              drilldown:'DIV04'
            },
            {
                from:'CO',
              to:'DIV05',
              drilldown:'DIV05'
            },
            {
                from:'CO',
              to:'DIV06',
              drilldown:'DIV06'
            }
        ],
        levels: [{
            level: 0,
            color: 'silver',
            dataLabels: {
                color: 'black'
            },
            height: 25
        }, {
            level: 1,
            color: 'silver',
            dataLabels: {
                color: 'black'
            },
            height: 25
        }, {
            level: 2,
            color: '#980104'
        }, {
            level: 4,
            color: '#359154'
        }],
        nodes: [
                {id:'DIV01', title:'Div Hd 1', name:'Div. 1',layout:'hanging'},
            {id:'DIV02', title:'Div Hd 2', name:'Div. 2',layout:'hanging'},
            {id:'DIV03', title:'Div Hd 3', name:'Div. 3',layout:'hanging'},
            {id:'DIV04', title:'Div Hd 4', name:'Div. 4',layout:'hanging'},
            {id:'DIV05', title:'Div Hd 5', name:'Div. 5',layout:'hanging'},
            {id:'DIV06', title:'Div Hd 6', name:'Div. 6',layout:'hanging'}
                ],
        colorByPoint: false,
        color: '#007ad0',
        dataLabels: {
            color: 'white'
                                },
        borderColor: 'white',
        nodeWidth: 120
    }],
    drilldown: {
        series: [
            {
                id: "DIV01",
                name: "DIV01",
                data: [
                      ['DIV01','DEP01']
                ],
                nodes: [
                    {id:'DEP01', title:'Dept Hd 1', name:'Dept. 1',layout:'hanging'}
                                ]
            },
            { 
                    name: "DIV02",
                id: "DIV02",
                data: [
                    ['DIV02','DEP02']
                ],
                 nodes: [
                    {id:'DEP02', title:'Dept Hd 2', name:'Dept. 2',layout:'hanging'}
                                ]
            },
            { 
                    name: "DIV03",
                id: "DIV03",
                data: [
                      ['DIV03','DEP03']
                ],
                 nodes: [
                    {id:'DEP03', title:'Dept Hd 3', name:'Dept. 3',layout:'hanging'}
                            ]
            },
            { 
                    name: "DIV04",
                id: "DIV04",
                data: [
                    ['DIV04','DEP04']
                ],
                 nodes: [
                    {id:'DEP04', title:'Dept Hd 4', name:'Dept. 4',layout:'hanging'}
                            ]
            },
            { 
                    name: "DIV05",
                id: "DIV05",
                data: [
                       ['DIV05','DEP05']
                ],
                 nodes: [
                    {id:'DEP05', title:'Dept Hd 5', name:'Dept. 5',layout:'hanging'}
                            ]
            },
            { 
                    name: "DIV06",
                id: "DIV06",
                data: [
                    ['DIV06','DEP06']
                ],
                 nodes: [
                    {id:'DEP06', title:'Dept Hd 6', name:'Dept. 6',layout:'hanging'}
                            ]
            }
        ]
    },
    tooltip: {
        outside: true
    },
    exporting: {
        allowHTML: true,
        sourceWidth: 800,
        sourceHeight: 600
    }

});

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2020-06-15 13:22:29

根据Highcharts的博客条目,目前还不可能对组织结构图进行深入分析。我在GIT上提出了一个特性请求:https://github.com/highcharts/highcharts/issues/13711

另一种方法是使用按钮触发事件加载数据子集,如下所示:https://jsfiddle.net/BlackLabel/orj8ayne/

代码语言:javascript
复制
let chart = Highcharts.chart('container', {
  series: [{
    type: 'organization',
    keys: ['from', 'to'],
    data: [{
      from: 'A',
      to: 'B',
    }, {
      from: 'B',
      to: 'C',
    }]
  }],
});

document.getElementById("drill").addEventListener("click", function() {
  chart.series[0].update({
    data: [{
      from: 'D',
      to: 'E',
    }]
  });
})
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/62372778

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档