Kem Azlan Posted February 6 Share Posted February 6 How to update color group scheme (let say I want to add some column into the group that has been created into Table Visualization) using Spotfire IronPython? Link to comment Share on other sites More sharing options...
Heleen Snelting Posted February 8 Share Posted February 8 Hi @Kem Azlan did you take a look at the list of scripts available here already? If you can't find what you need, please add a bit more detail on what you are trying to achieve and what you have tried already. Thanks! You can attach an example file if you can (do not share confidential data). Link to comment Share on other sites More sharing options...
Kem Azlan Posted February 8 Author Share Posted February 8 (edited) Hi Heleen. Thanks for the reply. I tried to refer on this topic: However, the code above is for creating new color scheme grouping and then add some column into it. But I try to figure out if we need to add new column from the data into color scheme grouping that has been created into Table visualization, but I cannot find the suitable code to configure this. I hope this helps. Edited February 8 by Kem Azlan Link to comment Share on other sites More sharing options...
Kem Azlan Posted February 8 Author Share Posted February 8 (edited) Hi @Heleen Snelting. Alternatively, maybe I can reuse the code sample in this topic: But, all the color that I have applied into color scheme grouping, will be reset to default color. Is there any IronPython code to create color scheme grouping along with below color gradient settings (Noted that the visualization is in Table): I also hope this helps. Edited February 8 by Kem Azlan Image change Link to comment Share on other sites More sharing options...
Solution Magnus Rylander Posted February 9 Solution Share Posted February 9 Hi @Kem Azlan, Here's a script that might help you: # This script sets up continuous coloring of a table plot. # It assumes there are two numerical columns, Y and Y in the table. from Spotfire.Dxp.Application.Visuals import CategoryKey, TablePlot from Spotfire.Dxp.Application.Visuals.ConditionalColoring import ConditionValue from System.Drawing import Color viz = table.As[TablePlot]() # Add a new coloring coloring = viz.Colorings.AddNew("MyColoring"); # Map the columns we want to color to it. viz.Colorings.AddMapping(CategoryKey("X"), coloring) viz.Colorings.AddMapping(CategoryKey("Y"), coloring) # Make the coloring compute its values across all the columns coloring.EvaluatePerColumn = False # Create a color gradient colorRule = coloring.AddContinuousColorRule() colorRule.Breakpoints.Add(ConditionValue.CreateLiteral(0), Color.White) colorRule.Breakpoints.Add(ConditionValue.CreateLiteral(1), Color.LightPink) colorRule.Breakpoints.Add(ConditionValue.MaxValue, Color.Red) # Note that you can use epxressions for the breakpoints if you like # In that case you would reference the cell values with [Axis.Color] like below: # colorRule.Breakpoints.Add(ConditionValue.CreateExpression("Max([Axis.Color])"), Color.Red) Link to comment Share on other sites More sharing options...
Kem Azlan Posted February 11 Author Share Posted February 11 Thanks @Magnus Rylander. It really helps me. 1 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