i have a data set being returned as a cubism
's metric
such that it has values
0 = very bad
1 = okay
2 = bad
i can write a d3.scale
such that
var ord = d3.scale.ordinal( [ 0, 1, 2, null ] ).range( [ -2, 2, -1, null ] );
for( var i=0; i<=2; i++ ) {
console.log( i + ': ' + ord(i) );
}
console.log( 'null: ' + ord(null) );
and the terminal returns
0: -2
1: 2
2: -1
null: null
looks good... however, when i try applying this scale to the cubism horizon chart, the chart renders fine, except the data represented doesn't show bad values as negative and good as positive:
d3.select("body").selectAll(".horizon")
.data( metrics )
.enter().insert("div", ".bottom")
.attr("class", "horizon")
.call(
context.horizon()
.scale( d3.scale.ordinal([ 0, 1, 2, null ]).range([ -2, 2, -1, null ]) )
);
what am i doing wrong?