Jump to content

Switch Map chart to CrossTable; execute ExportText all in memory


Georgi Koemdzhiev

Recommended Posts

Hello, I am wondering if it's possible to convert the Map chart to CrossTable (I need to execute the ExportText method that is part of the CrossTable class) in memory I don't want to "visually" change the Analysis's page, the only reason I want to convert the above visualizations is to be able to execute the ExportText method.

 

The code below does work but it switches the visualizations. Any ideas

 

 

from System.IO import Path, File, StreamWriter

from Spotfire.Dxp.Application.Visuals import *

 

for vis in Document.ActivePageReference.Visuals:

if vis.TypeId == VisualTypeIdentifiers.MapChart2:

 

vis.TypeId = VisualTypeIdentifiers.CrossTable

ct = vis.As[CrossTablePlot]()

writer = StreamWriter("C:\Users\user\Desktop\GDAta.txt")

ct.ExportText(writer)

print("Export done")

vis.TypeId = VisualTypeIdentifiers.MapChart2

vis.As[MapChart]()

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