0.0.1-alpha.3 • Published 3 years ago

depot-octopus v0.0.1-alpha.3

Weekly downloads
1
License
ISC
Repository
-
Last release
3 years ago

API 与 options

名称说明类型默认值
id指定画布容器 idString#body
canvasWidth指定画布宽度Numberwindow.innerWidth
canvasHeight指定画布高度Numberwindow.innerHeight
canvasMin缩放最小比例Number0.2
canvasMax缩放最大比例Number3
canvasBackground指定画布背景String#fff
duration动画持续时长Number750
dataSource数据Array--
onlyKeyNamecodeNameStringcode
openSearch开启搜索Booleantrue
searchPlaceHolder搜索框占位文字String搜索
onSelect选择回调Function(data, { status: 'all' \|\| 'selected' \|\| 'unSelect' })-

实例方法

名称说明类型默认值
deleteSelect删除选中项, 只对信息项有效Function(Array信息项code))-
clearSelect清除所有选中信息项Function()-
updataInfoItems更新信息项Function(Array完整信息项)-

updataInfoItems Array 为所有选中的信息项, Array 包含的信息项选中, 并清除不包含在内的信息项选中状态

mars.loadScript("/mars/thirdparty/dataV/D3JS-v4.13.0/d3-v4.js", false); mars.loadScript("/mars/thirdparty/dataV/Octopus/octopus.js", false);

if (d3 && d3.version === '4.13.0' && Octopus) {
  var octopusIns = new Octopus({
    /* 
      json 格式

      {

        key: value,
        children: [{
          key: value
        }]
      }

    */
    dataSource: json,
    onSelect: function(data, obj) {
      // status == 'selected'
      // status === 'all'
      // status === 'unSelect'
      var load = obj,  status = obj;
      if (load) {
        return new Promise(function (resolve, reject) {
          resolve(infoItemList);
        });
      }
      if (status == 'selected' || status === 'all') {
        console.log('onSelect::', data);
      } else {
        // unSelect
        console.log('onSelect unSelect::', data);
      }
    },
    onClearSelect: function (data, obj) {
      // { status: 'clear' }
      console.log('onClearSelect:', data);
    }
  });

}