18979425409 发表于 2023-5-22 15:19:16

在thingjs低代码中,实现森图表的创建、隐藏功能

本帖最后由 18979425409 于 2023-5-22 15:21 编辑

在ThingJS低代码平台中,可以通过以下步骤实现森图表的创建、隐藏功能:
1.创建森图表代码示例如下:var forestChart;//森图表对象
// 在线开发引入森大屏图表脚本
      THING.Utils.dynamicLoad([
             'https://www.thingjs.com/static/plugins/compile.js',
            'https://www.thingjs.com/static/plugins/vue.min.js',
            'https://charts.thingjs.com/s-static/component/9d3b344197244a05b49644a8a6a9bd36.js'
      ],
            function () {
                /**
               * 园区或地图初始化完成后加载图表
               */
                createButton();
                forestChart= new window.conch['C9d3b344197244a05b49644a8a6a9bd36'](document.querySelector('#chartDom'), {
                  prefix: 'https://charts.thingjs.com/s-static/'
                })
                forestChart.render();
            })
      /**
         * 利用模板字符串 创建页面元素并添加到div2d中
         */
      function createButton() {
            // 使用 bootstrap 样式
            var template =
                `<div id='chartDom' style='position:absolute;left:20px;top:20px;z-index:2;width:500px;height:380px;'></div>`;
            var btn = $('#div2d').append($(template));
            return btn;
      }
2.隐藏森图表要隐藏一个森图表,可以使用thingjs提供的hide()方法。例如,要隐藏名为forestChart的图表,代码示例如下:forestChart.hide()

18796012756@163.com 发表于 4 天前

如何进行离线部署呢,森图表
页: [1]
查看完整版本: 在thingjs低代码中,实现森图表的创建、隐藏功能