Changing graph colors

21 views
Skip to first unread message

Rockpsl76

unread,
Jul 26, 2010, 12:25:15 PM7/26/10
to canviz
I would like to be able to change node colors individually from
javascript. When I click on a button in my javascript I want to be
able to change the outline color of a specific node. Whats the best
way to do this?

Ron Newman

unread,
Jul 26, 2010, 3:01:59 PM7/26/10
to can...@googlegroups.com
There seem to be some questions lately that assume that Canviz is interactive and asking how to interact with it.  While very powerful, Canviz is a tool for rendering a graph from xdot, and the interactive portion is what the users must supply, in most cases using a saved state on the server, as Ryan points out.

I've done the interactive communication between server-side graphviz rendering and client-side canviz, including integrating clickable areas within Canviz shapes, changing colors, etc., in the IdeaTree API.  You might look there for an example of what to do.   www.ideatree.us/api

Ron Newman

Rockpsl76

unread,
Jul 26, 2010, 3:16:39 PM7/26/10
to canviz
I'm not talking about interacting with caviz. I'm talking about
interacting with the html which is generated by canviz. I'm trying to
add interactivity on the client side (more efficient) through
javascript instead of going all the way back to the server to
regenerate the viz. If canviz didn't strip the ID fields out of
xdot, this would be easy to do. As it is, hacking the href field
isn't a very good idea because it has other repercussions. I was
hoping someone else knew of a way to identify nodes in canviz. I'll
check out ideatree and see if its a better fit for what I'm trying to
do.

Thanks

Ron Newman

unread,
Jul 26, 2010, 3:28:39 PM7/26/10
to can...@googlegroups.com
So do I understand correctly that you don't care if the change you make to the html is persistent?  That is, it's ok if you change a node color but when you open the browser again it's back to the same color, right?

Rockpsl76

unread,
Jul 26, 2010, 4:30:33 PM7/26/10
to canviz
Correct.

On Jul 26, 3:28 pm, Ron Newman <ron.new...@gmail.com> wrote:
> So do I understand correctly that you don't care if the change you make to
> the html is persistent?  That is, it's ok if you change a node color but
> when you open the browser again it's back to the same color, right?
>

Ryan Schmidt

unread,
Jul 26, 2010, 7:27:17 PM7/26/10
to can...@googlegroups.com
On Jul 26, 2010, at 14:16, Rockpsl76 wrote:

> I'm not talking about interacting with caviz. I'm talking about
> interacting with the html which is generated by canviz. I'm trying to
> add interactivity on the client side (more efficient) through
> javascript instead of going all the way back to the server to
> regenerate the viz.

Absolutely, and I do totally intend for you to be able to do this. See my response in the "ID for nodes and edges and graphs?" thread about how I intend for you to do this by manipulating the JavaScript graph object.

> I'll
> check out ideatree and see if its a better fit for what I'm trying to
> do.

Note that Ron's ideatree API does use Canviz for drawing.

Reply all
Reply to author
Forward
0 new messages