Web Client 8.0.8

ChartListener

ChartListener

Interface to be implemented to listen to Chart events comprehending notifications of chart overflow and new line creations.
Events for this listeners are executed synchronously with respect to the code that generates them.
Note that it is not necessary to implement all of the interface methods for the listener to be successfully passed to the Chart#addListener method.
A ready made implementation of ChartListener providing basic functionalities is distributed with the library: SimpleChartListener.

Constructor

new ChartListener()

This is a dummy constructor not to be used in any case.

Methods

onNewLine(key, newChartLine, currentX, currentY)

Event handler that is called each time that, due to an update to the internal model of the Chart this instance is listening to, a new ChartLine is being generated and displayed. By implementing this method, it is possible to configure the appearance of the new line.
A new line can be generated only when a new row enters the model. Moreover, based on the configuration of Chart#addYAxis a new row in the model may generate more than one line resulting in this event being fired more than one time for a single update.

Parameters:
Name Type Description
key String

The key associated with the row that caused the line of this event to be generated (keys are described in AbstractWidget).

newChartLine ChartLine

The object representing the new line that has been generated.

currentX Number

The X-coordinate of the first point of the line of this event.

currentY Number

The Y-coordinate of the first point of the line of this event.

onRemovedLine(key, removedChartLine)

Event handler that is called each time that, due to an update to the internal model of the Chart this instance is listening to, one of the currently active ChartLine is being removed.

Parameters:
Name Type Description
key String

The key associated with the row that was removed causing this event to be fired (keys are described in AbstractWidget).

removedChartLine ChartLine

The object representing the line that has been removed.

See:

onXOverflow(key, lastX, xMin, xMax)

Event handler that is called when a new update has been received such that one or more points have to be added to the chart lines, but cannot be shown because their X-coordinate value is higher than the upper limit set for the X axis. By implementing this event handler, the chart axis can be repositioned through Chart#positionXAxis so that the new points can be shown on the chart.
Note that if a new update is received such that one or more points have to be added to the chart lines but cannot be shown because their X-coordinate value is lower than the lower limit set for the X axis, then this event handler is not called, but rather the new update is ignored. X axis limits should always be set in such a way as to avoid this case.

Parameters:
Name Type Description
key String

The key associated with the row that during its update made the overflow happen.

lastX Number

The X-coordinate value of the new points to be shown on the chart and that exceeds the current upper limit.

xMin Number

The current lower limit for the visible part of the X axis.

xMax Number

The current upper limit for the visible part of the X axis.

onYOverflow(key, toUpdateChartLine, lastY, yMin, yMax)

Event handler that is called when a new update has been received such that a new point for this line has to be added to the chart, but cannot be shown because its Y-coordinate value is higher than the upper limit set for the Y axis on this line, or lower than the lower limit. By implementing this event handler, the line can be repositioned through ChartLine#positionYAxis so that the new point can be shown on the chart.

Parameters:
Name Type Description
key String

The key associated with the row that during its update made the overflow happen.

toUpdateChartLine ChartLine

The object representing the line that made the overflow happen.

lastY Number

The Y-coordinate value of the new point to be shown on the chart and that exceeds the current upper or lower limit.

yMin Number

The current lower limit for the visible part of the Y axis.

yMax Number

The current upper limit for the visible part of the Y axis.