Using treemap as a filter: Is there a way to change the colour of the selected node.

Hi guys,


This might seem like a simple one but it's got me a bit baffled.

I'm using a tree chart as a filter on a layer of a dashboard, for which it works well. But with one exception; I can't find a way to make the colour of the selected node change when it's selected.


Under the properties tab and in the "Look" section; there are further sections called "Selected style" and "unselected style", but unfortunately they don't seem to have any effect.


I've tried to change the colour via scripting (as I already am using a script to filter the data visualisations on the page). But I can't find in the console where in the heirarchy/objects that I can set the colour of the seelcted node.


Has anyone got any suggestions or could point me in the right direction?


Many thanks in advance.

It seems I have misunderstood your question. I answered the same question for a tree diagram, while you were asking for a treemap. In the case of a treemap, you can do this in multiple ways.


One is a hitTest which is a script that detects the spot where you click and marks it as selected:

var args = dundas.Utility.getAdapterHitTestArguments(e.originalEvent, this);
var node = treemap1.control.hitTest(args.offsetX, args.offsetY, args.target);
if (node) {
    node.isSelected = true;
}

Another option is to filter the Brush View parameter, similar to how you filter visualizations. You can disable the default data brushing on the dashboard so that moving the mouse around does not interfere with your filtering.

Most of the filtering can be done without script, but take into account that the adapter you have clicked will be excluded from the data brushing. For example, add a filter action that targets the Brush View parameter and add the following script in a script action after the filter action:

this.onBrushViewParameterChanged(this.parentView.control.brushViewParameter.parameterValue); 

Thanks for getting me started.


I've gone witht he first option and it generates a variable with the properties of the node. However I can only find poperties of the node background colour under the hierarchy node.treemap.nodeBackground.color.

I constructed two new Dundas Color objects with the colour values I desired for when the node was selectred and a default colour.

Unfortunatley; when I attempted to apply it, it changed the colour of BOTH nodes and not the one selected.

Hey Daniel,


If you use the script that Elia provided and place it on the click action of the treemap, you should be able to simply set one of the nodes selected styles properties (i.e. node border) and see that changing based on the clicked node. Note that right now it looks like this doesn’t apply to the node background property – we are checking this internally and will update again as soon as possible.



The node selected properties are available under the treemap Look --> Selected Style properties:


Image title




Note the treemap property you ate trying to set via script, is applicable to the entire chart and hence why you get all nodes colored.

Hi Jordan.

Naturally that was what I initially tried.

But yes, it didnt work which is why I attempted scripting instead.

Unfortunately, you will not be able to bypass this using scripting. Until the background property fix is released (likely in the next minor release), you can use the Brightness, Saturation, and Offset properties to change the look of the node.