Drag and drop on google chart (orgchart to be more specific)

1,619 views
Skip to first unread message

Edwin

unread,
Nov 22, 2011, 4:05:38 AM11/22/11
to Google Visualization API
Hi all,

What I'd like to do is to create a orgchart by dragging and dropping
items onto the chart. So depending on where you drop the item, the
item must be added to that specific branch of the orgchart. Can
anybody show me how to do that? Can I add listeners like onDragEnter,
onDragLeave and onDrop for the individual blocks within the orgchart?
I have tried to google for quite some time (probably with the wrong
keywords), but didn't find any hits. There must be examples available
somewhere of people doing the same. Any help would be must
appreciated! Thank you in advance.

Regards,
Edwin

asgallant

unread,
Nov 22, 2011, 11:11:35 AM11/22/11
to google-visua...@googlegroups.com
The API doesn't expose those events, so you'd have to register them on the table that holds the org chart and then translate table rows into DataTable rows.  Once you've done that translation, add the element(s) to the DataTable object and call the chart's draw() method again.

Edwin

unread,
Nov 22, 2011, 1:28:19 PM11/22/11
to Google Visualization API
Are there any examples available online somewhere? I don't completely
get what you're saying yet...

asgallant

unread,
Nov 22, 2011, 1:42:41 PM11/22/11
to google-visua...@googlegroups.com
There are no drag-and-drop events in javascript, so you'd have to code your own through some combination of 'mousedown', 'mouseup', 'mouseenter' and 'mouseleave' event handlers.  Google for javascript mouse events to get more info. I wish you luck with this one, because it is going to be tricky to implement.
Reply all
Reply to author
Forward
0 new messages