Stacked Area Spline Chart with negative values misbehaving

  • 1
  • Problem
  • Updated 3 years ago
  • (Edited)
Hi All,

I have an area spline chart with positive and negative values that I am trying to stack.  Ideally, negative values fall below the 0 mark, positive values go above.  For some reason, the area charts don't behave this way (see screenshot).  Column charts work fine.  Any ideas?


Photo of Mansour

Mansour

  • 1,932 Points 1k badge 2x thumb

Posted 3 years ago

  • 1
Photo of J.

J., Official Rep

  • 7,470 Points 5k badge 2x thumb
Mansour,

I think the way to address this is a Highcharts setting that we don't currently set: threshold. It looks like it's particular to Area/Areaspline charts, but I wasn't familiar with it before today, so I can't say for sure. Here's a jsFiddle showing it in action. At present, you'll have to set this with a Before Render Snippet on your Chart to set it. Does that help?
Photo of Mansour

Mansour

  • 1,932 Points 1k badge 2x thumb
Thanks J, that worked great!

Here's the snippet if anyone else runs into this:


var chartObj = arguments[0],
$ = skuid.$;

$.extend(chartObj,{
    tooltip: {
        shared:true,
        enabled:true,
        crosshairs:true
    }   ,
    plotOptions:{

   series:{
      
   threshold: 0
   }
    }
});
Photo of Mansour

Mansour

  • 1,932 Points 1k badge 2x thumb
Spoke too soon, that snippet removed stacking...
Photo of J.

J., Official Rep

  • 7,470 Points 5k badge 2x thumb
Try a recursive $.extend:
$.extend(true,chartObj,{
... (Setting really cool options here) ...
});