Divergent/Negative Bar Chart
Sometimes you may want to compare two values alongside each other to measure impact of one vs the other but without stacking them or having them side by side.
This is often called a divergent bar chart.

This can be done in Sisense with just a little bit of work. First take your left measure and multiply it by -1 to make it negative, you will want to sort ascending on that measure.

This gives us almost what we want, but the tooltips and the axis show negative values which can be misleading! So let's take care of those!
The axis label
We can easily extend the usual sisense formatter to replace its output when it contains a "-" sign.
widget.on('beforeviewloaded',function(se,ev){
old=ev.options.yAxis[0].labels.formatter
ev.options.yAxis[0].labels.formatter= function () {
return old.apply(this).replace("-","")
}
})
The tooltip
Again here we can use the "beforedatapointtooltip" event to access the tooltip context each time and replace the "-" in the tooltip.
widget.on("beforedatapointtooltip", function (se, args){
args.context.points[0].value=args.context.points[0].value.replace("-", "")
})
Updated 03-02-2023
intapiuser
Admin
Joined December 15, 2022