d3.js - scale incoming metric data for representation in cubism -


i have data set being returned cubism's metric such has values

0 = bad 1 = okay 2 = bad 

i can write d3.scale such

var ord = d3.scale.ordinal( [ 0, 1, 2, null ] ).range( [ -2, 2, -1, null ] ); for( var i=0; i<=2; i++ ) {   console.log( + ': ' + ord(i) ); } console.log(  'null: ' + ord(null) ); 

and terminal returns

0: -2 1: 2 2: -1 null: null  

looks good... however, when try applying scale cubism horizon chart, chart renders fine, except data represented doesn't show bad values negative , 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 doing wrong?

check horizon.extent([extent])

https://github.com/square/cubism/wiki/horizon


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -