Вопрос

I'm using cubism with data coming from graphite

The data's domain is continuos [0,100] and the range is continuos [0,100] but anything below 100 is nonsense so I modified the scale and used a threshold scale so that:

values < 100 will be 0 and 100 will be 100. I tested that with:

var scale = d3.scale.threshold().domain([100]).range([0,100])

console.log(scale(1)) //returns 0
console.log(scale(99.9)) //returns 0
console.log(scale(88.9)) //returns 0
console.log(scale(100)) //returns 100

When I apply it, it the whole chart becomes empty

.call(context.horizon().height(100)
    .colors(colors)
    .scale(d3.scale.threshold().domain([100]).range([0,100])) // range([0,1]) doesn't work either
);

enter image description here

without applying the scale (notice the small white area)

    .call(context.horizon().height(100)
    .colors(colors)
    // .scale(d3.scale.threshold().domain([100]).range([0,100])) // range([0,1]) doesn't work either
);

enter image description here

Это было полезно?

Решение

Scale didn't work so I used graphite's functions

specifically I used

removeAboveValue(keepLastValue(xxx),99.99999)

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top