v5.x -> v6.x
When upgrading, please reference each of the below LCJS entries in your application (for example, using Search functionality in your code base).
For each code block found this way, refer to the corresponding migration guide.
Cursors
v6.0.0 introduces many new built-in cursor features such as:
- Multi-series cursors
- 3D cursors
To make this possible, the API has been greatly changed. For migration, please check every method listed below one at a time throughout your codebase.
When migrating from old cursor API, we strongly recommend completely removing (or commenting out) all usage of old Cursor API first and see how the new cursors behave out of the box at first.
With the new cursors we have invested a lot of effort into default behavior - the cursors consider aspects like axis types and attached series to function logically without user explicitly configuring them.
Rather than using the migration guide, we recommend to start with the default behavior and then apply any desired tweaks by referring to the new Cursor documentation.
setCursorResultTableFormatter
This method is used in almost every LCJS application currently.
Before, it existed usually on "per series" basis, except with some chart types (such as MapChart, BarChart, ...).
Starting with v6.0.0, cursor formatting is ALWAYS defined "per chart", using setCursorFormatting method.
Additionally, the syntax of the method is slightly simplified, by removing the concept of "table content builder".
// -Before-
lineSeries.setCursorResultTableFormatter((builder, series, x, y, dataPoint) => builder
.addRow(series.getName())
.addRow(series.axisX.formatValue(x))
.addRow('Price', '', series.axisY.formatValue(y))
)
// -After-
chartXY.setCursorFormatting((chart, hit) => [
hit.series, // Passing series object displays its name and color
hit.axisX.formatValue(hit.x),
['Price', '', hit.axisY.formatValue(hit.y)]
])
While slightly streamlined, the difference is functionally quite minimal.
setAutoCursor
Simply renamed to setCursor, functionality is the same.
AutoCursorModes
AutoCursorModes is removed. It's indirect replacement is SolveNearestMode.
| Before | After |
|---|---|
AutoCursorModes.disabled | undefined |
AutoCursorModes.snapToClosest | "show-nearest" |
AutoCursorModes.onHover | "show-pointed" |
In addition to this, SolveNearestMode can also control interpolation behavior, multi-series cursor behavior and it is shared by both Cursor API and Solve nearest API.
setAutoCursorMode
Renamed to setCursorMode.
Parameter changed from AutoCursorModes to SolveNearestMode.
setCursorInterpolationEnabled
Cursor interpolation can no longer be controlled on a "per series" basis.
It has been moved up to "per chart" basis, and is controlled using setCursorMode.
// -Before-
series.setCursorInterpolationEnabled(true) // enable interpolation
series.setCursorInterpolationEnabled(false) // disable interpolation
// -After-
chart.setCursorMode('show-nearest-interpolated') // enable interpolation
chart.setCursorMode('show-nearest') // disable interpolation
setCursorSolveBasis
Manual configurations for cursor solve basis have been removed. This is now detected automatically by the library, depending on the series type and configuration.
- For series with no data pattern,
"nearest"basis is used. - For series with progressive X pattern,
"nearest-x"basis is used. - For series with progressive Y pattern,
"nearest-y"basis is used.
setResultTableAutoTextStyle, setTickMarkerXAutoTextStyle, setTickMarkerYAutoTextStyle
For time being, "auto text style" functionalities are removed.
As an indirect replacement, you can display the series color as an automatically colored circle in cursor result tables using setCursorFormatting method. This can be seen with default formatting.
Furthermore, it is possibly to specify color of any text part within a result table using the setCursorFormatting API.
If you would like to see the "auto text style" functionality reintroduced in future LCJS versions, please let us know.
AutoCursor, AutoCursor2DBuilder, AutoCursorBuilders, AutoCursorXY, AutoCursorXYBuilder, setAutoCursorEnabledDuringAxisAnimation, autoCursorBuilder
These have simply been renamed:
AutoCursor->CursorAutoCursor2DBuilder->CursorBuilder2DAutoCursorBuilders->CursorBuildersAutoCursorXY->CursorXYAutoCursorXYBuilder->CursorBuilderXYsetAutoCursorEnabledDuringAxisAnimation->setCursorEnabledDuringAxisAnimationautoCursorBuilder->cursorBuilder
All Cursor formatter types
e.g. BoxSeriesFormatter, BarChartResultTableFormatter, PolarSeriesFormatter. All these types are removed and replaced with "per chart" variants, such as:
PieChartCursorFormatterBarChartCursorFormatter- etc...
solveNearestFromScreen
Method renamed to solveNearest.
Previously two method signatures existed, one of which was deprecated since v4.2, which accepted so called "engine coords" as parameter.
This deprecated signature is now removed, and the method now always excepts client coordinates! ({ clientX: number, clientY: number })
Some implementations of solveNearestFromScreen also previously accepted a second, optional parameter interpolate?: boolean.
This has been replaced with solveMode?: SolveNearestMode:
// -Before-
lineSeries.solveNearestFromScreen(event, false) // interpolate disabled
lineSeries.solveNearestFromScreen(event, true) // interpolate enabled
// -After-
lineSeries.solveNearest(event, 'show-nearest') // interpolate disabled
lineSeries.solveNearest(event, 'show-nearest-interpolated') // interpolate enabled
addChartMarkerXY
The feature of "Chart markers" has been removed with no direct replacement. They were widely unused and even in cases where they were confirmed to have been used, there were better replacements available.
Their usage should be replaced with one or combinations of:
- UI text boxes
- Custom ticks
- Point series
- Manual cursors (new)
Manual cursors are a new API that is very close to that of previous "chart markers".
They are functionally equal to normal cursors, but are managed manually by user rather than automatically by interacting with charts.
Manual cursors are created with chart.addCursor() method.
addMarker
The feature of "Series markers" has been removed with no direct replacement. They were widely unused and even in cases where they were confirmed to have been used, there were better replacements available.
Their usage should be replaced with one or combinations of:
- UI text boxes
- Custom ticks
- Point series
- Manual cursors (new)
Manual cursors are a new API that is very close to that of previous "series markers".
They are functionally equal to normal cursors, but are managed manually by user rather than automatically by interacting with charts.
Manual cursors are created with chart.addCursor() method.
Gauge Chart
The Gauge Chart module has undergone a comprehensive rework for improved visual look, new built-in functionality and better adaptivity to different user interfaces. To allow this, the end user API has been reworked:
// Before
const gauge = lightningChart().Gauge()
.setAngleInterval(225, -45)
const slice = gauge
.getDefaultSlice()
.setInterval(0, 100)
.setValue(50)
// After
const gauge = lightningChart().Gauge()
.setAngleInterval(225, -45)
.setInterval(0, 100)
.setValue(50)
Changes overview:
- Removed
GaugeChartTypes,RadialGauge,SolidGauge- As before, there is only one Gauge type available, which can be created with
lightningChart().Gauge()
- As before, there is only one Gauge type available, which can be created with
- Removed
GaugeSlice,SolidGaugeSlice- The concept of gauge slice no longer exists, the equivalent methods are now available directly on the
GaugeChartobject.
- The concept of gauge slice no longer exists, the equivalent methods are now available directly on the
- Data label has been renamed to value label
- For example,
setDataLabelFontis nowsetValueLabelFont
- For example,
- Interval labels have been renamed to ticks
- For example,
setIntervalLabelFormatteris nowsetTickFormatter
- For example,
To migrate your previous gauge applications, we recommend to check out the Gauge feature section on how to use the new API.
Changes to Theme interface
The following new properties have been added to Theme interface. If you are not using built-in themes or latest version of lcjs-themes, then you need to define these new properties in your custom theme(s):
gaugeChartBarThickness- thickness of gauge chart bargaugeChartValueIndicatorThickness- thickness of gauge chart value indicator barsgaugeChartRoundedEdges- whether gauge chart bars have rounded edges or notgaugeChartNeedleLength- length of gauge chart needle as pixelsgaugeChartNeedleAlignment- alignment of gauge chart needlegaugeChartNeedleFillStyle- fill style of gauge chart needlegaugeChartNeedleThickness- thickness of gauge chart needlegaugeChartNeedleStrokeStyle- stroke style of gauge chart needlegaugeChartStartAngle- start angle of gauge chartgaugeChartEndAngle- end angle of gauge chartgaugeChartGapBetweenBarAndValueIndicatorsgap between gauge chart bar and value indicator barsgaugeChartBarColor- default color of gauge chart bargaugeChartGlowColor- glow configuration for gauge chart bargaugeChartValueLabelFont- font for gauge chart value labelsgaugeChartUnitLabelFont- font for gauge chart unit labelgaugeChartTickFont- font for gauge chart tick labelsgaugeChartTickFillStyle- fill style for gauge chart tick labelsgaugeChartBarGradient- gauge chart gradients enabled or notgaugeChartBarStrokeStyle- stroke style for gauge chart bargaugeChartUnitLabelFillStyle- fill style for gauge chart unit labelcursor3DGridStrokeStyleXcursor3DGridStrokeStyleYcursor3DGridStrokeStyleZcursor3DTickStrokeStyleXcursor3DTickStrokeStyleYcursor3DTickStrokeStyleZcursor3DTickLabelFillStyleXcursor3DTickLabelFillStyleYcursor3DTickLabelFillStyleZcursor3DTickLabelFontXcursor3DTickLabelFontYcursor3DTickLabelFontZcursor3DTickLabelBackgroundFillStyleXcursor3DTickLabelBackgroundFillStyleYcursor3DTickLabelBackgroundFillStyleZcursor3DTickLabelBackgroundStrokeStyleXcursor3DTickLabelBackgroundStrokeStyleYcursor3DTickLabelBackgroundStrokeStyleZcursor3DTickLabelPaddingXcursor3DTickLabelPaddingYcursor3DTickLabelPaddingZ
Removed Theme properties:
gaugeChartEmptyGaugeFillStylegaugeChartEmptyGaugeStrokeStylegaugeChartGaugeFillStylegaugeChartIntervalLabelsFillStylegaugeChartIntervalLabelsFontgaugeChartValueLabelFontchartMarkerPointMarkerFillStylechartMarkerPointMarkerSizechartMarkerPointMarkerShapeseriesMarkerPointMarkerFillStyleseriesMarkerPointMarkerSizeseriesMarkerPointMarkerShape