How to pass value dynamically to upper margin in chart

Hi, how to pass value dynamically to upper margin percentage in chart. I have tired many ways. But I can’t able to pass value to the upper margin dynamically. Please any one knows let me know

This requires digging down into the chart object itself.
Assuming one plot and one defined axis (otherwise, you would need to use an index number for each).

# Get the chart component object
component = event.source.parent.getComponent('Chart')

# Get chart data
chart = component.getChart()

# Get the plot settings
plot = chart.getPlot()

# Get the axis settings
axis = plot.getRangeAxis()

# Now that we have the axis, we can set different things. 

# Set the upperMargin
axis.setUpperMargin(0.5)

# Turn off auto range
axis.setAutoRange(0)

# set upper and lower bounds
axis.setUpperBound(1000)
axis.setLowerBound(500)
1 Like