Problem:
I have two visualizations with a same column specified in the x-axis and zoom slider enabled.
I want to move the zoom slider in one of the visualization and have the other visualization synchronize to that movement.
Resolution:
This is possible using combination of Property Control and IronPython. The following animated gif demonstrates the final result.
Follow the steps below to implement the above solution to your analysis file.
1. Create two visualizations with a common column in the x-axis (e.g. xaxis).
2. Create a new Filter Scheme (e.g. ZoomSliderScheme).
3. Insert a text area and add a Filter Control with following selection.
Filtering scheme: ZoomSliderScheme Filter: xaxis |
4. Open Data Function properties (File > data > Data function properties) and click [Register New].
5. Register the following TERR script (TIBCO Enterprise Runtime Engine for R).
OutMin <- min(XAxis)
OutMax <- max(XAxis)
OutStr <- paste(OutMin, OutMax, sep = ",")
6. Define the following input parameter.
Parameter name: XAxis Type: column Allowed data typese: All |
7. Define the following output parameter.
Parameter name: OutMin Data type: value |
Property name: OutMax Data type: value |
Property name: OutStr Data type: value |
8. Run the Data function.
9. Specify the following input parameters.
Parameter name: Xaxis Data table: <Name of your data table> |
10. Specify the following input parameters.
Parameter name: OutMin Output handler: Document property Property: XaxisMin |
Parameter name: OutMax Output handler: Document property Property: XaxisMax |
Parameter name: OutStr Output handler: Document property Property: XaxisStr |
10. Press OK to run.
11. Open the Properties dialog (File > Document Properties > Properties).
12. Add a new property XAxisMin, XAxisMax, and XAxisStr as follows.
Property name: XAxisMin Data type: Integer Value: 0 |
Property name: XAxisMax Data type: Integer Value: 0 |
Property name: XAxisStr Data type: String Value: 0 |
13. Select the entry "XAxisStr" in the properties dialog and click [Scripts].
14. Select [Execute the script selected below:] and click [New].
15. Copy and paste the following IronPython script in the [Script] field.
from Spotfire.Dxp.Application.Visuals import VisualContent
from Spotfire.Dxp.Application.Visuals import AxisRange
vc = vis.As[VisualContent]()
vc2 = vis2.As[VisualContent]()
vc.XAxis.ZoomRange = AxisRange(Xmin, Xmax)
vc2.XAxis.ZoomRange = AxisRange(Xmin, Xmax)
16. Define the following parameters in the [Script parameters].
Parameter name: vis Type: Visualization Debug value > Select visualization: Title of the first visualization |
Parameter name: vis2 Type: Visualization Debug value > Select visualization: Title of the second visualization |
Parameter name: Xmin Type: Integer Debug value > Property: DocumentProperty("XAxisMin") |
Parameter name: Xmax Type: Integer Debug value > Property: DocumentProperty("XAxisMax") |
17. All is set! Move the Filter Control to control the movement of zoom sliders in two visualizations.
Comments
0 comments
Article is closed for comments.