Jump to content

Heatmap Color Gradient from Document Properties


Funny Cat
Go to solution Solved by Funny Cat,

Recommended Posts

Hi,

I've got a heatmap visualization and added a customized color gradient with 13 colors.

The values for the respective colors are custom expressions calculated based on the two document properties LSL and USL

For example:

${LSL}+(${USL}-${LSL})*0.7

My problem is, that in the legend entries I also get this formula, instead of the numeric result of the formula.

Is there a simple way to show the numeric result in the legend?

Thanks

Link to comment
Share on other sites

Hello,

I assume you are seeing something like the following?

legend.thumb.PNG.ac78b06a7ee1369cfee0956792366194.PNG 

I compared the Heat map legend with a Scatter plot legend - the latter did shows both the formula as well as the numeric result of the formula (the value in parenthesis). That the Heat Map doesn't show this looks like a potential defect to me so I recommend that you open a case with Support about that in the Support Portal: https://support.tibco.com/s/

I can't think of any way around this (unless using another plot type is an option)

Link to comment
Share on other sites

Do you mean the display name? Well, when creating your gradient, maybe you could simply assign display names.

max.thumb.PNG.ea749d460d714cfd690e07414976d281.PNG

If doing it problematically, I would try (can't test and confirm this right now) setting ManualDisplayName - https://docs.tibco.com/pub/doc_remote/sfire_dev/area/doc/api/TIB_sfire-analyst_api/html/T_Spotfire_Dxp_Application_Visuals_ConditionalColoring_ExpressionColorRule.htm

Link to comment
Share on other sites

  • Solution

I couldn't figure out how to access the colorbreakpoints in the heatmap.

I ended up with making a heatmap using the scatterplot with tiled markers.

2023-08-3122_08_59-TransparentBrowser.thumb.png.50101e12cdc692c3413b63ea98731991.png 

In case somebody is interested in the script:

from Spotfire.Dxp.Application.Visuals import *from System.Drawing import Colorfrom Spotfire.Dxp.Application.Visuals.ConditionalColoring import Coloring, ContinuousColorRule, ConditionValue, IntervalMode vcMap = visMap.As[VisualContent]() LSL = Document.Properties["LSL"]USL = Document.Properties["USL"] #remove old color rulescolorRule = vcMap.ColorAxis.Coloring.Clear()#create new color rulecr = vcMap.ColorAxis.Coloring.AddContinuousColorRule()cr.IntervalMode = IntervalMode.Gradient #Create ConditionValues with expressions and literalscv0 = ConditionValue.CreateExpression(str(LSL-0.000001))cv1 = ConditionValue.CreateLiteral(LSL)cv2 = ConditionValue.CreateLiteral(LSL+(USL-LSL)*0.1)cv3 = ConditionValue.CreateLiteral(LSL+(USL-LSL)*0.2)cv4 = ConditionValue.CreateLiteral(LSL+(USL-LSL)*0.3)cv5 = ConditionValue.CreateLiteral(LSL+(USL-LSL)*0.4)cv6 = ConditionValue.CreateLiteral(LSL+(USL-LSL)*0.5)cv7 = ConditionValue.CreateLiteral(LSL+(USL-LSL)*0.6)cv8 = ConditionValue.CreateLiteral(LSL+(USL-LSL)*0.7)cv9 = ConditionValue.CreateLiteral(LSL+(USL-LSL)*0.8)cv10 = ConditionValue.CreateLiteral(LSL+(USL-LSL)*0.9)cv11 = ConditionValue.CreateLiteral(USL)cv12 = ConditionValue.CreateExpression(str(USL+0.000001)) #Add breakpointscr.Breakpoints.Add(cv0,Color.FromArgb(170, 170, 170))cr.Breakpoints.Add(cv1,Color.FromArgb(75, 0, 130))cr.Breakpoints.Add(cv2,Color.FromArgb(38, 0, 193))cr.Breakpoints.Add(cv3,Color.FromArgb(0, 0, 255))cr.Breakpoints.Add(cv4,Color.FromArgb(0, 64, 128))cr.Breakpoints.Add(cv5,Color.FromArgb(12, 105, 12))cr.Breakpoints.Add(cv6,Color.FromArgb(128, 192, 0))cr.Breakpoints.Add(cv7,Color.FromArgb(255, 255, 0))cr.Breakpoints.Add(cv8,Color.FromArgb(255, 210, 0))cr.Breakpoints.Add(cv9,Color.FromArgb(255, 165, 0))cr.Breakpoints.Add(cv10,Color.FromArgb(255, 83, 0))cr.Breakpoints.Add(cv11,Color.FromArgb(255, 0, 0))cr.Breakpoints.Add(cv12,Color.FromArgb(35, 35, 35)) #Set manual display name for the two expressionsfor coloring in vcMap.ColorAxis.Coloring: for breakpoint in coloring.Breakpoints: if breakpoint.Value.Value == str(USL+0.000001): breakpoint.ManualDisplayName = 'higher' if breakpoint.Value.Value == str(LSL-0.000001): breakpoint.ManualDisplayName = 'lower'
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...