Changing the chart legends on boolean series types

  • 2
  • Question
  • Updated 2 years ago
  • Answered
I guess this is a question, but might also just be a solution; if I have worked something out right myself (Stupid isn't stupid if it works, right?)

I need to do a stacked bar chart of Opportunities broken down over month by won status. Seems really simple right. I built my model of Opps, with the standard IsWon field and put them into the stacked bar chart appropriately, got to this point in no time:



It looked good to me, except the "Series" - which is showing the count of "IsWon" values in each month is reflecting it's actual values... IsWon = false, and IsWon = true.

I couldn't for the life of me work out in Skuid how to tell it to display something different here (and I guess its fair enough, as really the chart component doesn't know what values are actually going in there until runtime (esp if the series was split over a picklist or date/text/number etc.etc.)

So what I did is create a UI only field on the model called "WonLabel" - which was a formula - and did this:



I then told the chart to split over the "WonLabel" field instead of IsWon and I now of course get this:





(and the mouse over values look great too).

So - this worked. I was pleased with it because of that.. but I have an itch in the back of my head, because Skuid is normally so powerful and clever, this almost seems a little cheeky or hacky, which I am not used to! Are there any performance/memory issues I should be aware of with UI-only formulae? Is this a common practise, am I reinventing the wheel? (or maybe have I even just had a eureka moment!)

Also - out of interest, how do I get it to use "Won" as the first value and "Lost" as series element 2.... first idea is just flip my Formula round - but might it be that the Series order from the values available is not stable any way?
Photo of srlawr

srlawr

  • 494 Points 250 badge 2x thumb

Posted 2 years ago

  • 2
Photo of Amy Dewaal

Amy Dewaal, Official Rep

  • 8,200 Points 5k badge 2x thumb
Srlawr,

Well, there's a slightly easier way to do what you want, but it's the same concept. On the split on your chart, make template the split type. Then, in the template you can put something like {{#IsWon}}Won{{/IsWon}}{{^IsWon}}Lost{{/IsWon}} instead of having to put that in a ui-only field and then split on that. As for the order of the values, it looks like it's determined by the first record, so you could sort to show Won records first and I think that should always make your Won label first.