PackTree(logical Tree)
✓ Published0🌍 Public
11Cr18Ni9
Last edited Apr 8, 2020
Created on Dec 2, 2019
This example demonstrates an interactive pack layout for managing logical search queries. Users build a tree of data nodes representing query criteria, which can be merged into AND or OR logical groups using drag-and-drop or keyboard shortcuts. The visualization uses D3.js v4's pack layout algorithms, including `d3.packSiblings` and `d3.packEnclose`, to arrange circles representing criteria and logical containers. Built with Vue.js, it renders as animated SVG elements and fetches initial collection and document data from JSON files via axios, with the query-building interface provided by a Vue-based dialog form.
AI-generated descriptionAuthor: cxhair@163.com
Amended based on my previous work: Dynamic Pack.
Node category:
- dataNode: created by use when filling dialog
- andNode: logical node created by dataNode merged
- orNode: logical node created by dataNode merged
How does node merging work
- If two dataNodes come close merge them into a new andNode
- If two andNodes come close,one of them will grow into a bigger andNode and the another will be removed
- If two orNodes come close merge them into a new bigger orNode
- If one node is dataNode and another is logic node(wrapper node), dataNode will be merged into that logic node
- If both are logic node but NOT the same type, andNode will be merged into orNode
Chart Events
- Right click on blank canvas will pop the dialog that used for creating dataNode
- Right click on nodes: dismissed from parent logical node or removed after user confirmed.
- Ctrl + Click: hold on the Ctrl then click on dataNode under the root teee will merge those dataNode into a bigger orNode
- Drag dataNode close to another dataNode will merged into a andNode
- Double click on dataNode will pop dialog and update it after user confirmed.
Dialog Events
- Esc: close dialog
- Query items can be shifted by dragging on handlers
- Data validation
mit Licensed