Close Editor Run Reset Auto Update CJS const lcjsTrader = require('@lightningchart/lcjs-trader')
const lcjs = require('@lightningchart/lcjs')
const { emptyFill, emptyLine, PalettedFill, LUT, regularColorSteps } = lcjs
Promise.all([
lcjsTrader.trader(TRADER_LICENSE),
fetch(`${document.head.baseURI}examples/assets/1201/tradingHeatmap-data.json`).then((r) => r.json()),
]).then(([trader, data]) => {
const { keyX, keyY, keyIntensity, startX, stepX, startY, stepY, valueRanges, heatmapResolution, heatmapData, dataPoints } = data
const lc = trader.lightningChart()
const chart = lc
.ChartXY()
.setTitle('Trading heatmap chart')
chart.getDefaultAxisX().setTitle(keyX)
chart.getDefaultAxisY().setTitle(keyY)
const heatmap = chart
.addHeatmapGridSeries({
dataOrder: 'columns',
columns: heatmapResolution,
rows: heatmapResolution,
})
.setName('Heatmap')
.setStart({ x: startX, y: startY })
.setStep({ x: stepX, y: stepY })
.invalidateIntensityValues(heatmapData)
.setFillStyle(
new PalettedFill({
lookUpProperty: 'value',
lut: new LUT({
interpolate: true,
steps: regularColorSteps(
valueRanges[keyIntensity].min,
valueRanges[keyIntensity].max,
chart.getTheme().examples.badGoodColorPalette,
),
units: keyIntensity,
}),
}),
)
const pointSeries = chart
.addPointLineAreaSeries({ schema: { x: { pattern: null }, y: { pattern: null } } })
.setName('Points')
.setPointSize(5)
.setAreaFillStyle(emptyFill)
.setStrokeStyle(emptyLine)
.appendJSON(dataPoints)
chart.setCursorFormatting((_, hit) => [
hit.series,
[keyX, '', hit.axisX.formatValue(hit.x)],
[keyY, '', hit.axisY.formatValue(hit.y)],
[keyIntensity, '', hit.intensity.toFixed(3)]
])
chart.forEachAxis((axis) => axis.fit(false))
})
Trading Heatmap Chart - Editor
Example showing use of Heatmap charts with dynamic coloring in trading use cases.
Heatmap chart allows visualization of relations between 3 different data properties at once.
This example loads in a prepared data set of different Fintech indicators (standard deviation, dmi, standard error) and displays the relations of them all simultaneously using an interpolated Heatmap.