Control XY Axis zoom scale

  1. Create a document property called 'mySlider' as integer type
  2. Add a text area and add a Property Control and link it to 'mySlider' to it.
  3. Use the script button on the slider widget if available. Otherwise use an Action Control to triger the script once happy with the slider value selection.

from Spotfire.Dxp.Application.Visuals import AxisRange
from Spotfire.Dxp.Application.Visuals import BarChart
#from Spotfire.Dxp.Data import DataPropertyClass

#viz is a scirpt parameter pointing to a barchart visual

MyChart = viz.As[BarChart]()

#read min,max from document properties

min = Document.Properties["mySlider"].Value
#max = Document.Data.Properties.GetProperty(DataPropertyClass.Document, "mySlider").Value

#apply zoom range

MyChart.YAxis.ManualZoom = True
MyChart.YAxis.ZoomRange = AxisRange(min,max);

No comments: