Class: SimpleChartListener

SimpleChartListener

Simple implementation of the ChartListener interface that can be used to automatically adjust the axis of a Chart to center the lines on the Chart.
In case of an X overflow the X axis limits will shift by half of their total length meaning that the next point falls in the middle of the visible area so that the shifting is not continuous for each new value of X.
In case of an Y overflow the Y axis limits are stretched in such a way that the new point falls on the visible part of the Y axis.
Note that in case of an Y overflow all of the ChartLine instances of the listened Chart will be stretched with the same values to keep the view consistent.

new SimpleChartListener(xSpan, yPerc)

Creates an object that will handle the positioning of the X axis and Y axis of a Chart based on a few simple configuration parameters.
Note that this listener expects to listen to only one Chart but can correctly handle different lines as long as they can be represented on the same scale.
Methods from the ChartListener interface should not be called directly on instances of this class.
Parameters:
Name Type Description
xSpan Number [optional] The size of the X axis. The units of the value depends on the model of the Chart instance and possibly on the parser configured on the Chart#setXAxis method. If not specified, then 60 will be used.
yPerc Number [optional] A percentage that is used for the first positioning of the Y axis: the Y axis will have as initial maximum position a value that is yPerc% greater than the first Y position and as initial minimum position a value that is yPerc% smaller than it. If not specified, then 20 (meaning 20%) will be used.

Extends