Jump to content

IronPython - Conditional Coloring in Combination Chart


Paul Shumaker

Recommended Posts

Hello,

I'm currently working on a visualization that needs to conditionally color individual bars in a combination chart based on the bar's value. I did not see any options in the properties dialog, just "Series" coloring. This is my progress so far:

 

from Spotfire.Dxp.Application.Visuals import *

from System.Drawing import Color

 

print "test"

 

pg = Document.Pages[0]

 

vis = ''

 

for v in pg.Visuals:

if v.Title == "Monthly Trend":

vis = v.As[CombinationChart]()

 

#print vis.YAxis.Expression

vis.ColorAxis.Coloring.Clear()

 

colorRule1 = vis.ColorAxis.Coloring.AddCategoricalColorRule()

I've checked the documentation and can't really find anything on this so far. I'm not sure if it's even possible. My code so far just resets coloring back to default blue if I've created a series with a different color. Any help would be appreciated.

Link to comment
Share on other sites

Thank you for the idea but that didn't work. The issue with a combination chart is that the series / axis mode must be categorical. I have to have a continuous axis mode to be able to color individual bars based on their values. I think as of now, Spotfire cannot do what I asked.

 

I was able to add a coloring expression rule but it only worked for all bars or no bars since the total was rolled up into a category, hence the nature of combination charts and categorical axis mode.As a workaround, I will be trying to create a bar chart with a continuous axis mode, and a custom line based on the line from my combination chart. Hopefully this will help anyone in the future with similar issues.

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...