問題描述
我需要設置一個組織"類型的 Highcharts 圖表,它應該支持 Drag &將節點放在一起(移動樹內的節點).
I need to set up a Highcharts chart of type "organization" which should support Drag & Drop the Nodes on each other (to move the nodes inside the tree).
目前,我有一個組織"圖表,其中顯示了所有需要的信息.
Currently, I got an "organization" chart which displays all the needed information.
我嘗試使用 Highcharts.plotOptions.series.dragDrop
-Events 但這根本不起作用.我還嘗試使用 Highcharts.series[organization].dataLabels.nodeFormatter
-Callback 將外部 div 替換為具有屬性的 div: draggable="true" ondragstart="fun1(event)" ondrag="fun2(event)" ondrop="fun3(event)" ondragover="func(event)"
I tried to use the Highcharts.plotOptions.series.dragDrop
-Events but that wasn't working at all.
I also tried to use Highcharts.series[organization].dataLabels.nodeFormatter
-Callback to replace the outer div by a div with attributes: draggable="true" ondragstart="fun1(event)" ondrag="fun2(event)" ondrop="fun3(event)" ondragover="func(event)"
我剛剛使用了 w3schools 的函數:
I just used the functions from w3schools:
function allowDrop(ev) {
ev.preventDefault();
}
function drag(ev) {
ev.dataTransfer.setData("text", ev.target.id);
}
function drop(ev) {
ev.preventDefault();
var data = ev.dataTransfer.getData("text");
ev.target.appendChild(document.getElementById(data));
}
但這也不起作用.所以現在我被卡住了.
But that wasn't working either. So now I am stuck.
推薦答案
似乎Organizations圖表類型沒有實現拖放.您可以在官方 highcharts 論壇或 github 問題上閱讀該主題.
It seems that drag and drop is not implemented on Organizations chart type. You can read the thread in official highcharts forum or on github issues.
關注以下對話:Highcharts 論壇和Github 問題
這篇關于我如何啟用 Drag &加入 Highcharts 組織結構圖?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!