d3.js - D3 Radar Chart Colors -
i using d3 radar chart plot data:
https://github.com/alangrafu/radar-chart-d3
i trying configure used d3 chart using hex codes, #ffffff.
this website:
http://graves.cl/radar-chart-d3/
proposes
var mycfg = { color: function(){ c = ['red', 'yellow', 'pink', 'green', 'blue', 'olive', 'aqua', 'cadetblue', 'crimson']; m = c.length - 1; x = parseint(math.random()*100); return c[x%m]; //get random color } }
but returns random function... more like:
var mycfg = { color: function(){ c = ['red', 'yellow', 'pink', 'green', 'blue', 'olive', 'aqua', 'cadetblue', 'crimson']; return c; //get non-random color } }
without randomization... return type of function incorrect...
if want set own colors based on series order:
var mycfg = { color: function(i) { c = ['red', 'yellow', 'pink', 'green', 'blue', 'olive', 'aqua', 'cadetblue', 'crimson']; return c[i]; } }
the first series red
, second yellow
, etc...
example here.
Comments
Post a Comment