Class: ChartLine

ChartLine

Object that describes a single line of a multi-line chart. Instances of this class are automatically generated by a Chart instance based on the Chart#setXAxis and Chart#addYAxis configurations and can be customized during the ChartListener#onNewLine event.

new ChartLine()

Used by Lightstreamer to provide a ChartLine object to each call of the ChartListener#onNewLine event. This constructor is not supposed to be used by custom code.

Method Summary

getYField
Inquiry method that retrieves the field in the Chart internal model representing the Y axis to which this ChartLine pertains.
positionYAxis
Operation method that sets or changes the limits for the visible part of the Y axis of the chart (that is, the minimum and maximum Y-coordinates shown in the chart for this line).
setStyle
Setter method that sets the style to be applied to the points drawn on the chart area.
setYLabels
Setter method that configures the legend for the Y axis.

Method Detail

getYField() → {Number}

Inquiry method that retrieves the field in the Chart internal model representing the Y axis to which this ChartLine pertains.
See:
Returns:
the field representing the Y axis.
Type
Number

positionYAxis(min, max)

Operation method that sets or changes the limits for the visible part of the Y axis of the chart (that is, the minimum and maximum Y-coordinates shown in the chart for this line). When these limits are changed a full repaint of the line is performed.

Lifecycle: The Y axis limits can be set at any time.

Parameters:
Name Type Description
min Number lower limit for the visible part of the Y axis.
max Number higher limit for the visible part of the Y axis.
Throws:
if the min parameter is greater than the max one.
Type
IllegalArgumentException

setStyle([pointColor=black]the, lineColor, pointSize, lineSize)

Setter method that sets the style to be applied to the points drawn on the chart area. Colors of the points, and lines can be customized using valid CSS colors while size is specified in pixels.
Parameters:
Name Type Argument Default Description
[pointColor=black]the String color use to draw the points on the chart. A point is drawn per each new value in the model. Any valid CSS color can be used. By default "black" is used.
lineColor String <optional>
black the color use to draw the lines on the chart. A line is to connect two consecutive points for the same line. Any valid CSS color can be used. By default "black" is used.
pointSize Number <optional>
1 the size in pixel of the drawn points. By default 1 is used.
lineSize Number <optional>
1 the size in pixel of the drawn lines. By default 1 is used.
Throws:
if pointSize or lineSize are not valid positive integer numbers.
Type
IllegalArgumentException

setYLabels(labelsNum, labelsClass, labelsFormatter)

Setter method that configures the legend for the Y axis. The legend consists of a specified number of labels for the values in the Y axis. The labels values are determined based on the axis limits; the labels appearance is controlled by supplying a stylesheet and a formatter function.
Note that the room for the Y axis labels on the page is not provided by the library; it should be provided by specifying a chart width smaller then the container element width and displaced on the right, through the Chart#configureArea setting. Moreover, as the upmost and lowest labels are centered on the chart area borders, a little space should be provided also over and under the chart area, through the same method.

Lifecycle: Labels can be configured at any time. If not set, no labels are displayed relative to the Y axis. If set for different ChartLine instances on the same Chart then more sets of labels will be printed.

Parameters:
Name Type Argument Description
labelsNum Number the number of labels to be spread on the Y axis; it should be 1 or greater.
labelsClass String <optional>
the name of an existing stylesheet, to be applied to the Y axis label HTML elements. The parameter is optional; if missing or null, then no specific stylesheet is applied.
labelsFormatter LabelsFormatter <optional>
a Function instance used to format the Y axis values designated for the labels.
The function will be invoked with a Number argument and should return a String. If the function is not supplied, then the value will be used with no further formatting.
Throws:
if labelsNum is not a valid positive integer number.
Type
IllegalArgumentException