dc_chart.ordinalColors(["red","green","blue"]);
dc_chart.colorAccessor(function (p, i) { return i; });
dc_chart.x(d3.scale.ordinal().domain(["red","green","blue"]));
dc_chart.xUnits(dc.units.ordinal);
--
You received this message because you are subscribed to the Google Groups "dc-js user group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dc-js-user-gro...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dc-js-user-group/d8dee037-9bea-40bc-a2f6-cc1cb151b85e%40googlegroups.com.
var data= crossfilter( [ {"color":"green"},{"color":"green"},{"color":"blue"},{"color":"red"}, // {"color":"yellow"}, ]);
var dimension = data.dimension(function (d) { return d.color; });var group = dimension.group();
//var color_range = ["red", "yellow", "green", "blue"];var color_range = ['red','green','blue'];//var color_range = ['blue', 'green', 'yellow', 'red'];
var bar = dc.barChart("#bar-chart") .dimension(dimension) .group(group) .x(d3.scale.ordinal().domain(color_range)) // Need the empty val to offset the first value .xUnits(dc.units.ordinal) // Tell Dc.js that we're using an ordinal x axis .brushOn(false); //bar.ordinalColors(color_range);bar.colors(d3.scale.ordinal().range(color_range));bar.colorAccessor(function (p, i) { //return color_range.indexOf(p.key); //return ['red','green','blue'].indexOf(p.key); return p.key;});
dc.renderAll();
--
You received this message because you are subscribed to the Google Groups "dc-js user group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dc-js-user-gro...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dc-js-user-group/e4a3ca09-5401-4808-94e0-a403da2661d9%40googlegroups.com.
In colorAccessor i actually have it figure out based on domain range set and and color array set, which color to return.