zoukankan      html  css  js  c++  java
  • highcharts实现组织机构的点击选中和取消选中事件

    代码

     
      1 Highcharts.chart('container', {
      2     chart: {
      3         height: 600,
      4         inverted: true
      5     },
      6     title: {
      7         text: 'Highsoft 公司组织结构'
      8     },
      9     plotOptions: {
     10         series: {
     11             cursor: 'pointer',
     12             events: {
     13                 click: function (event) {
     14                     let nodes = this.nodes;
     15                     for(let p in nodes){
     16                         if(nodes[p].selected){
     17                             nodes[p].select();
     18                             break;
     19                         }
     20                     }
     21                     event.point.select();
     22                     console.log(event.point.id + " : " +event.point.name);
     23                 }
     24             }
     25         }
     26     },
     27     series: [{
     28         type: 'organization',
     29         name: 'Highsoft',
     30         keys: ['from', 'to'],
     31         data: [
     32             ['股东', '董事会'],
     33             ['董事会', 'CEO'],
     34             ['CEO', 'CTO'],
     35             ['CEO', 'CPO'],
     36             ['CEO', 'CSO'],
     37             ['CEO', 'CMO'],
     38             ['CEO', 'HR'],
     39             ['CTO', 'Product'],
     40             ['CTO', 'Web'],
     41             ['CSO', 'Sales'],
     42             ['CMO', 'Market']
     43         ],
     44         nodes: [ {
     45             id: 'CEO',
     46             title: 'CEO',
     47             name: 'Grethe Hjetland',
     48             image: 'https://wp-assets.highcharts.com/www-highcharts-com/blog/wp-content/uploads/2018/11/12132317/Grethe.jpg'
     49         }, {
     50             id: 'HR',
     51             title: 'HR/CFO',
     52             name: 'Anne Jorunn Fjærestad',
     53             color: '#007ad0',
     54             image: 'https://wp-assets.highcharts.com/www-highcharts-com/blog/wp-content/uploads/2018/11/12132314/AnneJorunn.jpg',
     55             column: 3,
     56             offset: '100%'
     57         }, {
     58             id: 'CTO',
     59             title: 'CTO',
     60             name: 'Christer Vasseng',
     61             column: 4,
     62             image: 'https://wp-assets.highcharts.com/www-highcharts-com/blog/wp-content/uploads/2018/11/12140620/Christer.jpg',
     63             layout: 'hanging'
     64         }, {
     65             id: 'CPO',
     66             title: 'CPO',
     67             name: 'Torstein Hønsi',
     68             column: 4,
     69             image: 'https://wp-assets.highcharts.com/www-highcharts-com/blog/wp-content/uploads/2018/11/12131849/Torstein1.jpg'
     70         }, {
     71             id: 'CSO',
     72             title: 'CSO',
     73             name: 'Anita Nesse',
     74             column: 4,
     75             image: 'https://wp-assets.highcharts.com/www-highcharts-com/blog/wp-content/uploads/2018/11/12132313/Anita.jpg',
     76             layout: 'hanging'
     77         }, {
     78             id: 'CMO',
     79             title: 'CMO',
     80             name: 'Vidar Brekke',
     81             column: 4,
     82             image: 'https://wp-assets.highcharts.com/www-highcharts-com/blog/wp-content/uploads/2018/11/13105551/Vidar.jpg',
     83             layout: 'hanging'
     84         }, {
     85             id: 'Product',
     86             name: '产品研发'
     87         }, {
     88             id: 'Web',
     89             name: '运维',
     90             description: '网站开发,系统维护'
     91         }, {
     92             id: 'Sales',
     93             name: '销售部'
     94         }, {
     95             id: 'Market',
     96             name: '市场部'
     97         }],
     98         colorByPoint: false,
     99         color: '#007ad0',
    100         dataLabels: {
    101             color: 'white'
    102         },
    103         borderColor: 'white',
    104         nodeWidth: 65
    105     }],
    106     tooltip: {
    107         outside: true
    108     },
    109     exporting: {
    110         allowHTML: true,
    111         sourceWidth: 800,
    112         sourceHeight: 600
    113     }
    114 });

    效果

  • 相关阅读:
    Java反射机制的简单应用
    UI组件之AdapterView及其子类关系,Adapter接口及事实上现类关系
    CSDN日报20170406 ——《代码非常烂,所以离职。》
    Swift环境下实现UILabel居上 居中 居下对齐
    在EA中将画出的ER图转换成SQL脚本
    hdu2236
    glm编译错误问题解决 formal parameter with __declspec(align('16')) won't be aligned
    CSS中的相关概念
    javascript jquery 推断对象为空的方式
    swift 给导航添加item,实现界面的跳转
  • 原文地址:https://www.cnblogs.com/janken/p/11738552.html
Copyright © 2011-2022 走看看