Jump to content

How to link 2 or more visualisations to affect each others' zoom? (Via Python Scrip)


Juan Carlos Gonzalez
Go to solution Solved by Jose Leviaguirre,

Recommended Posts

I have 3 visualisations that all have geological horizons lines, for the best analysis I need that when i zoom in on one of them the other two would be affected as well, so that the horizons lines be alignes alongside the screen. The thing is, that if i want to zoom in on a particular point of the data to compare with the other visuals i need to zoom manually on each of them and align them by eye.

Link to comment
Share on other sites

  • 2 weeks later...
  • Solution

Hello Juan Carlos,

To sync the zoom visuals, you need to use an IronPython script that can be triggered by Action Controls. You can add this control on a text area just like you did on your left side panel. This script only syncs two visuals, but I am sure you can change the code to your needs and apply the zoom slider range to other visuals

# You will need these two classes from the Application.Visual library: AxisRange and ScatterPlot
from Spotfire.Dxp.Application.Visuals import AxisRange, ScatterPlot
 
# We need to cast the visual parameters visA and visB to ScatterPlot object or whatever visual you are using in your analysis
scatterA = visA.As[ScatterPlot]()
scatterB = visB.As[ScatterPlot]()
 
# We create a reference to the Y axis ZoomRange from the first visual (A)
zoomAy = scatterA.YAxis.ZoomRange
 
# We need to create an AxisRange object based on visual A range settings for Y axis
axisRangeY = AxisRange(zoomAy.Low, zoomAy.High)
 
# And apply this axisRangeY object to the second visual B 
scatterB.YAxis.ZoomRange = axisRangeY

 

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