Trying to apply Pie Chart's colors through IronPython

Hi,

I have a Pie Chart, which I want to color in different shades of green. the values are the numbers between 0 and 5 (it's month weeks).

The reason I need IronPython script is that a certain user button can make changes in the chart's definitions (filters etc), and a side effect is a reset of the colors to Spotfire's default.

I already have the following code that sets the coloring to "GreenCategorical".

    from Spotfire.Dxp.Application.Visuals import *

    from System.IO import MemoryStream, FileStream, FileMode as fm, SeekOrigin as so, FileAccess as fa

    #for vis in Application.Document.Pages[0].Visuals:

    for vis in Application.Document.ActivePageReference.Visuals:

        if vis.Title == "Offer completion - breakdown by week":

            visual = vis.As[VisualContent]()

    #Apply green coloring scheme to the visualization:

    visual.ColorAxis.Coloring.Apply("GreenCategorical")

The problem is sometimes the colors are not in the right order. For example "3" is brighter than "2", while "2" is darker than "1". I am looking for more like setting color for each category/value saperately (0=#ABEBC6, 1=#58D68D, 2=#2ECC71, 3=#28B463, 4=#239B56, 5=#1D8348).

Any help here will be appreciated, Thanks!

 

 

 

(1) Answer

Login