Jump to content
Welcome to the new Spotfire community! Please see the sidebar announcement for more information on how to log in and get started! ×

IronPython Script code for altering a particular Series color in a Combination Chart


mdettm
Go to solution Solved by Jose Leviaguirre,

Recommended Posts

  • Solution

Hello, 

You can change the color with IronPython by using the Coloring. SetColorForCategory Method

from Spotfire.Dxp.Application.Visuals import CombinationChart, CategoryKey
from System.Drawing import Color

#cast visual to combo chart
combinationChart = vis.As[CombinationChart]()

#get script parameters from doc props
category = CategoryKey(Document.Properties["category"]) #string representing a category from the series
color = Color.FromName(Document.Properties["color"]) #named color such as blue, green, magenta, beige...

# change the color for the corresponding category
combinationChart.ColorAxis.Coloring.SetColorForCategory(category,color)
#color = Color.FromArgb(255,0,0) #if you know the rgb values
#hex_color = "#FF0000"
#color = Color.FromArgb(int(hex_color[1:3], 16), int(hex_color[3:5], 16), int(hex_color[5:7], 16)) #if you know the hex color


combochart.thumb.gif.1df5c0c42b617aefa9f7df8a308c9425.thumb.gif.37c8b5e4bd4c9e636a3b9b6980f92418.gif

Here is an article on how to do so

Edited by Jose Leviaguirre
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...