Print variable on CDE control panel using html or javascript

I have a dashboard with a pop-up slicer, but as soon as I close the pop-up, it is impossible to determine which variables were selected, so I would like to display a line, a line path above the diagram, including all the parameters that I select in the slicer block.

I tried to refer to them in the HTML layout position, for example: ${size} , ${type} , ${line} and ${service} , but it shows the text as written. No variables are parsed.

I also created a free form component to use Javascript, but I cannot see the data, and I cannot figure out which function to use.

+7
source share
1 answer

One of the most standard ways to do this is to use a text component. In the expression field, you can use something like this:

 function() { return "My Parameter: " + Dashboards.getParameterValue("myParam"); } 

where myParam is the name of your parameter. You will also want to add myParam to the listeners to synchronize the text component with the parameter.

The Freeform component will also be an opportunity, but it is a really free form, you need to do everything yourself. We added it just so that we have an easy way to add arbitrary code to the CDF life cycle. Using the Freeform component, you can do something similar in a custom Script diagram (shows that we reused this property name from the diagram?):

 function() { $("#" + this.htmlObject).text("My parameter: " + Dashboards.getParameterValue("my Param")); } 
+10
source

All Articles