Jump to content

Magnus Rylander

Spotfire Team
  • Posts

    23
  • Joined

  • Last visited

Community Answers

  1. Magnus Rylander's post in Add column into color scheme grouping using Spotfire Ironpython was marked as the answer   
    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)  
×
×
  • Create New...