Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
In Qlikview extensions, I could explicitly provide a label for each of the measures I wanted my user to use. In the end, this was just a clarification or my convention to make the users' life easier; as a developers I still accessed measures[0] or measures[1] and I had to again apply each to its specific purpose (i.e. it's not like Qlikview NAMED my measures for me; like measures['tooltip'], measures['background-color']
In Qlik Sense, there is the "measures" property panel; but I can't even clarify what the default measures should be?
In this extension for example, the extension author clarified via Javascript comments; but an average user wouldn't read it.
measures: { | |
uses: "measures", | |
min: 0, | |
max: 3 | |
/* | |
1. Measure: title text for hover popup (optional) | |
2. Measure: CSS class name for styling or number 1 to 10 for class color-a = "QlikSense dark blue" to color-j = "Qlik Sense dark red" (optional) | |
3. Measure: group name to group items in swim lanes (optional) | |
*/ | |
}, |
That extension also clarified their convention in plain English on their Qlik Branch page, which an average user may read.
Maybe I can use the extension initialProperties instead of the definition or the measures property panel, but I can't find an example yet, so I'm still searching.
Just to be clear, I want a way to communicate user how each Measure will be used by my extension (i.e. for a tooltip, for a background color). If I could prepopulate my extension to look like this, that'd be great:
I'm still curious if I can force the user to fill out exactly 3 measures, each of which has a static label that defines its purpose.
But I stumbled on this extension. It defines its measures in a way that lets the users pick from a "Type", which drives the ref "qDef.amGraph.type", (important to use qDef?) (and many other things like smoothness, etc) so that in my Javascript I can check what the user intended for a measure to do. That could work!
Notice this solution has nothing to do with initialProperties as I speculated. Instead it uses the items property of the measures object, so I could customize what user can specify about a given measure.
EDIT:
While this is great, I'm not sure how to READ this property from inside my extension, so I know which measure the user wants with which treatment. Oh! Now I see: It's available on the relevant measureDef element of the array layout.hyperCube.qMeasureInfo. From the amGraph type above. Note, you must save (Ctrl+S) the configuration you apply; the "amGraph.type" you pick, in order for this behavior to continue in normal "Done" mode after a refresh!
self.hyperCube.qMeasureInfo.forEach(function(measureDef, mindex) {
var graph;
if (measureDef.amGraph.type == 'Waterfall') {