Funny Cat Posted August 26, 2023 Share Posted August 26, 2023 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 USLFor example:${LSL}+(${USL}-${LSL})*0.7My 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 More sharing options...
Fredrik Rosell Posted August 30, 2023 Share Posted August 30, 2023 Hello,I assume you are seeing something like the following? 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 More sharing options...
Fredrik Rosell Posted August 30, 2023 Share Posted August 30, 2023 Update: Try setting "One scale per" to None. Link to comment Share on other sites More sharing options...
Funny Cat Posted August 30, 2023 Author Share Posted August 30, 2023 Hi Fredrik, thanks for your answers!It works, however, it doesn't look very nice.Would you happen to know, how I could change the values programmatically with ironpython? Link to comment Share on other sites More sharing options...
Fredrik Rosell Posted August 31, 2023 Share Posted August 31, 2023 Do you mean the display name? Well, when creating your gradient, maybe you could simply assign display names. 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 More sharing options...
Solution Funny Cat Posted August 31, 2023 Author Solution Share Posted August 31, 2023 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. 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now