pombreda / canviz

Automatically exported from code.google.com/p/canviz
0 stars 0 forks source link

Dynamically load color scheme data as needed #20

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Currently if you want to use named colors in a graph, you have to know this 
ahead of time and 
include x11colors.js and/or brewercolors.js. It would be nicer if Canviz would 
dynamically load the 
appropriate color scheme file if necessary for the graph being rendered.

A method for dynamically loading scripts is described here:

http://www.codehouse.com/javascript/articles/external/

Original issue reported on code.google.com by ryandesi...@gmail.com on 16 Oct 2008 at 5:08

GoogleCodeExporter commented 9 years ago
I knew it couldn't be that easy. :)

The method described above shows how to create a new script element and append 
it to the head element. This 
is a fine strategy, but does not tell us when the script file has *fininshed* 
loading, which we need to know so we 
can draw (or maybe redraw) the graph.

The method described here is more complete:

http://www.magichatdevelopment.com/content/blog/article.php?id=4

It creates the script element to load the JavaScript file. The file ends by 
firing a custom event, which we listen for 
to know when the file is done loading. Firing a custom event is new in 
Prototype 1.6, so we need to update our 
Prototype. I filed issue #21 to do that.

Original comment by ryandesi...@gmail.com on 16 Oct 2008 at 8:03

GoogleCodeExporter commented 9 years ago
Some time between 2.21.20081029.0445 and 2.21.20081115.1321 Graphviz started
automatically translating color names to their hex values in xdot output. I had
requested this here:
https://mailman.research.att.com/pipermail/graphviz-devel/2008/000792.html

Thanks to this change, the color scheme files aren't needed anymore for current
Graphviz. But I still want to implement dynamic loading to best support older 
Graphviz.

Original comment by ryandesi...@gmail.com on 26 Dec 2008 at 9:27