Padmini Posted April 30 Share Posted April 30 I have got some Scatter Plots in a Page and I want to adjust the zoom sliders using some input instead of dragging the sliders to find the exact point. Is it possible? Thanks Link to comment Share on other sites More sharing options...
Solution Jose Leviaguirre Posted April 30 Solution Share Posted April 30 (edited) Hello Padmini You will need to create an Action Control on a Text Area and associate an IronPython script to it. The script will be something like: from Spotfire.Dxp.Application.Visuals import AxisRange, ScatterPlot # vis is a script parameter scatter = vis.As[ScatterPlot]() # update X zoom range axisRangeX = AxisRange(2000,3000) scatter.XAxis.ZoomRange = axisRangeX # update Y zoom range axisRangeY = AxisRange(400,500) scatter.YAxis.ZoomRange = axisRangeY Another option that requires no coding is to use bookmarks Check out these articles on how you can use IronPython to programatically set the zoom sliders to a specific position. https://community.spotfire.com/articles/spotfire/configuring-spotfire-zoom-sliders-scroll-bars-etc-using-ironpython/ https://community.spotfire.com/articles/spotfire/sync-scrollbars-between-visualizations/ Edited April 30 by Jose Leviaguirre Link to comment Share on other sites More sharing options...
Padmini Posted May 1 Author Share Posted May 1 Hello Jose, I modified the script a bit. I am now taking the X-axis min and max values from a input fields and setting the zoom sliders. Similarly for Y-axis. from Spotfire.Dxp.Application.Visuals import AxisRange from Spotfire.Dxp.Application.Visuals import ScatterPlot from Spotfire.Dxp.Application.Visuals import * typedVisualisation = None for vis in Application.Document.ActivePageReference.Visuals: # if it is a visualisation which cannot have a zoom slider, it is ignored if vis.TypeId.Name=="Spotfire.ScatterPlot": typedVisualisation = vis.As[ScatterPlot]() if typedVisualisation is not None: #if resetX: typedVisualisation.XAxis.ZoomRange = AxisRange.DefaultRange #if resetY: typedVisualisation.YAxis.ZoomRange = AxisRange.DefaultRange MyChart = typedVisualisation Xmin = Document.Properties["XaxisZoomMinValue"] Xmax = Document.Properties["XaxisZoomMaxValue"] MyChart.XAxis.ManualZoom = True MyChart.XAxis.ZoomRange = AxisRange(Xmin,Xmax); typedVisualisation = None Thanks for your help. 1 Link to comment Share on other sites More sharing options...
Jose Leviaguirre Posted May 1 Share Posted May 1 Thanks for sharing and glad I was able to help! 1 Link to comment Share on other sites More sharing options...
Prateek Rawat 3 Posted May 8 Share Posted May 8 Hi Jose, I have a scenario where I want to set the zoom slider to latest year: as of now this is the default view of the linechart. when someone opens the analysis they should be able to see below view by default: How can I tweak above scripts to achieve this? Regards, Prateek Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now