0

I am trying to get those cool network graphs I saw on the cubism.js presentation where the RX was upside down on top and the tx was normal below. The fact is that the only way I seem to get the chart drawing upside down is doing metric.multiply(-1) but then the values are negative so its not exactly ideal.

Any hint?

Charles
  • 50,943
  • 13
  • 104
  • 142
Arkaitz Jimenez
  • 22,500
  • 11
  • 75
  • 105

1 Answers1

1

In the absence of a nice way to do this, you can replace the horizon chart formatter with one that just emits absolute values. You can do something similar with comparison charts too.

Something like this works :

var horizon = cubism.context().horizon();
var existingFormatter = horizon.format(); // Obtain the format function
var absoluteFormatter = function(value) {
    return existingFormatter(Math.abs(value));
};
horizon.format(absoluteFormatter);

This will have the effect of still rendering the charts as a "negative" but will allow you to render your values as desired.

Obviously, you can adopt according to your needs.

PapaLazarou
  • 185
  • 1
  • 6