Python scripts does not work completely

Hi,

I run into a bit strange issue when using python in Spotfire 6.5. When running the script in Edit Script window (click on Run Script) or via a button, it works fine.

But when I attached the script to a document property to trigger on change, only part of the script works.

Has anyone encounter something similar?

Thanks,

Edit: added script. This cript run just fine in the edit window or via a button, but if attached to a property control, it does not work on value change.



from Spotfire.Dxp.Application.Visuals import *

#color the chart using same scheme
myColors = [['Yield',0]
            ,['Capacity',0]
            ,['Crude Stream',0]]

#loop through each page to get the coloring scheme of bar chart
for p in Document.Pages:
    for myC in myColors:
        if p.Title == myC[0]:
            for v in p.Visuals: #get the bar chart
                if v.TypeId == VisualTypeIdentifiers.BarChart: #get the coloring scheme
                    myC[1] = v.As[VisualContent]().ColorAxis.Coloring

            for v in p.Visuals: #get the pie chart
                if v.TypeId == VisualTypeIdentifiers.PieChart: #apply coloring scheme
                    v.As[VisualContent]().ColorAxis.Coloring.Apply(myC[1])

 

4 Comments

I think you need to attach your .dxp file itself since there is definitely something else interfering here
Sean Riley - Nov 04, 2015 - 6:45am ::
I think it has something to do with the order in which the script is executed.

I have a bar chart that change color based on the same document property value. I guess the script does not wait until the chart change to execute the rest ...

Any idea to get around?
tai.nguyen - Nov 03, 2015 - 9:43am ::
Hi niko, I added the script.
tai.nguyen - Nov 02, 2015 - 11:44am ::
can you share the script here please?
niko - Nov 02, 2015 - 10:15am ::
View More Comments + Add a Comment

(1) Answer

Login