javascript - 未捕获的 FoamTree:元素的维度为零:522 x 0
问题描述
if (CarrotSearchFoamTree.supported) {
var foamtree = new CarrotSearchFoamTree({
id: "visualization",
dataObject: {
groups: [
{ id: "1", label: "Group 1", groups: [
{ id: "1.1", label: "Group 1.1" },
{ id: "1.2", label: "Group 1.2" }
]},
{ id: "2", label: "Group 2", groups: [
{ id: "2.1", label: "Group 2.1" },
{ id: "2.2", label: "Group 2.2" }
]},
{ id: "3", label: "Group 3", groups: [
{ id: "3.1", label: "Group 3.1" },
{ id: "3.2", label: "Group 3.2" }
]},
{ id: "4", label: "Group 4", groups: [
{ id: "4.1", label: "Group 4.1" },
{ id: "4.2", label: "Group 4.2" }
]},
{ id: "5", label: "Group 5", groups: [
{ id: "5.1", label: "Group 5.1" },
{ id: "5.2", label: "Group 5.2" }
]}
]
}
});
} else {
console.log("Visualization not supported.");
}
carrotsearch.foamtree.js 中的胡萝卜搜索问题:未捕获的 FoamTree:元素的维度为零:522 x 0。这是胡萝卜搜索的示例代码,任何帮助将不胜感激
解决方案
您需要定义一个应该嵌入 FoamTree 的 HTML 元素。元素必须具有非零维度。
见例子:
<html>
<body>
<div id="visualization" style="width: 800px; height: 600px"></div>
<script src="https://get.carrotsearch.com/foamtree/demo/carrotsearch.foamtree.js">
</script>
<script>
window.addEventListener("load", function() {
var foamtree = new CarrotSearchFoamTree({
id: "visualization",
dataObject: {
groups: [
{ label: "Your", weight: 1.0 },
{ label: "First", weight: 3.0 },
{ label: "FoamTree", weight: 2.0 },
{ label: "Visualization", weight: 4.0 }
]
}
});
});
</script>
推荐阅读
- marklogic-9 - MarkLogic - 数据库大小单位
- angular - 如何使用 Angular CLI 为特定的 js 文件设置反向代理
- python-3.7 - 如何在 WinPython 发行版上安装 cudatoolkit 包
- php - Change the xslt file of an xml file using php
- ios - 如何从数据库项创建动态 UIButton?
- xml - ODOO 12.0 迁移:系统中未找到外部 ID:stock_account
- angular - *ngFor 获取特定数字索引
- python - Dash Plotly - 如何制作 2 个条件来绘制直方图?
- javascript - 在 JavaScript 的 for 循环中移动数组
- ios - 在视图控制器之间转换的最佳方法是什么