Jump to content

What are ways to configure formatting on multiple visualizations and pages at once?


emck

Recommended Posts

I am plotting data on tens of scatter plots on multiple pages. If I need to change the shape of a category it seems I need to do this on every plot individually. That is obviously very time consuming, so I am looking for a way to make these changes to all scatter plots at once. More generally, this could also be said for changing the colors of the points. Or, lets say I want to add linear fit to all plots.. the list goes on. The amount of time I have to spend makes me feel like I'm missing something. Could someone offer me tips to be more efficient? Does it involve using IronPython? Is the solution different for every feature I want to change?

Thanks for your help!!!

Link to comment
Share on other sites

In general, attributes like shape would need Iron Python (to go through all visualizations containing a given column and change the shape).

Probably the same for linear fit.


For colours, you can assign preferred coloring schemes (continuous or categorical) by going to the column properties menu and selecting a column, and its properties tab.

Without specific use cases it is difficult to say exactly.

  • Like 1
Link to comment
Share on other sites

Thank you for your help Gaia! Would you kindly share with me a iron python code snippet or link to a resource that can instruct me? How about a script to change the shape of 1 category of a column in all scatter plots in the dxp?

Link to comment
Share on other sites

There are a lot of resources, but not always easy to search, so it helps googling something like "spotfire script to do xyz".
For instance, in the case of changing shapes for all scatterplots for all pages, these links helped:

https://spotfired.blogspot.com/2017/11/change-scatterplot-shape.html

Also a comprehensive link could be:

https://community.spotfire.com/articles/spotfire/ironpython-scripting-in-spotfire/

And the API:
https://docs.tibco.com/pub/doc_remote/sfire_dev/area/doc/api/TIB_sfire-analyst_api/

 

 

I am attaching a dxp in which I wrote a script to change the shape of a selected value of the "Species" column in the "iris" table based on these links.
Let me know if you can open it.
The script could be made less hard coded but I hope it is a start. It is based on what you select for shape (I used a separate table into which I put all the available shapes, taken from one of the links) and category (setosa, versicolor or virginica).
 

from Spotfire.Dxp.Application.Visuals import *

column_name = 'Species'
table_name = 'iris'
table = Document.Data.Tables[table_name]
shape = Document.Properties["shape"]
category = Document.Properties["category"]

for p in Document.Pages:
	for v in p.Visuals: 
		if v.TypeId.Name=="Spotfire.ScatterPlot":
			vz = v.As[Visualization]()
			if vz.Data.DataTableReference==table:
				if vz.ShapeAxis.Expression == '<['+column_name+']>':
					markerType = getattr(MarkerType,shape)
					vz.ShapeAxis.ShapeMap[category] = MarkerShape(markerType)

 

changeShape.dxp shapes.txt

  • Like 1
Link to comment
Share on other sites

Editing multiple visualizations at once is a functionality that is available in the new visualization properties panel available in preview since Spotfire 14.1+. You can learn about this and how to enable the new panel from here: 

 

  • Like 3
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...