SciChart:使用 JavaScript 热图

SciChart: Working with JavaScript Heatmap Chart

我正在使用 SciChart 库来显示 JS 热图。

根据以下文档,zValues 变量是使用 iterate 函数生成的,但是当我尝试在我的 HTML & CSS 基于网站,它不工作。

https://demo.scichart.com/javascript-heatmap-chart

我得到的错误是:

Uncaught SyntaxError: Unexpected token ':'

我写了下面的代码:

代码:

var {sciChartSurface, wasmContext} = await SciChart.SciChartSurface.create("line_chart_3");
// Add XAxis and YAxis
sciChartSurface.xAxes.add(new SciChart.NumericAxis(wasmContext));
sciChartSurface.yAxes.add(new SciChart.NumericAxis(wasmContext));
// Create a Heatmap Data-series. Pass heatValues as a number[][] to the UniformHeatmapDataSeries
var initialZValues: number[][] = iterate(WIDTH, HEIGHT, 200, 0, MAX_SERIES);
var heatmapDataSeries = new SciChart.UniformHeatmapDataSeries(wasmContext,
{
    xStart: 100,
    xStep: 1,
    yStart: 100,
    yStep: 1,
    zValues: initialZValues
});
// Create a Heatmap RenderableSeries with the color map. ColorMap.minimum/maximum defines the values in
// HeatmapDataSeries which correspond to gradient stops at 0..1
var heatmapSeries = new SciChart.UniformHeatmapRenderableSeries(wasmContext,
{
    dataSeries: heatmapDataSeries,
    colorMap: new SciChart.HeatmapColorMap(
    {
        minimum: 0,
        maximum: 200,
        gradientStops:
        [
            { offset: 0, color: "#00008B" },
            { offset: 0.2, color: "#6495ED" },
            { offset: 0.4, color: "#006400" },
            { offset: 0.6, color: "#7FFF00" },
            { offset: 0.8, color: "#FFFF00" },
            { offset: 1.0, color: "#FF0000" }
        ]
    })
});

以上代码出现错误:var initialZValues: number[][] = iterate(WIDTH, HEIGHT, 200, 0, MAX_SERIES);

请帮忙。

下面一行代码是Typescript

 var initialZValues: number[][] = iterate(WIDTH, HEIGHT, 200, 0, MAX_SERIES);

删除 : number[][] 它应该 运行.