Search code examples
javascriptlightningchart

Error when using logarithmic axis for HeatmapGridSeries in lightningChartJS 5.2.0


I am using lightningChartJS to create a heatmap within a dashboard object. My requirement is to have a logarithmic x-axis, while the normal x-axis should not be visible. This setup worked perfectly in version 4.2.1, but after updating to version 5.2.0, it throws an error and the heatmap is not displayed.

Note: just checked and it also does not work with regular ChartXY initialization without the dashboard.

Here's a snippet of the React code I am using:

import { useEffect } from "react";
import { lightningChart, Axis, ChartXY, emptyLine } from "@arction/lcjs";

function App() {
  useEffect(() => {
    const lc = lightningChart({license: "my-license"});
 const dashboard = lc.Dashboard({
    numberOfColumns: 1,
    numberOfRows: 1,
    container: "lc"
  });
    const chart = dashboard.createChartXY({   columnIndex: 0,
      rowIndex: 0 });
    chart.getDefaultAxisX().setVisible(false);
    const logXAxis = chart
      .addAxisX({
        type: "logarithmic",
        base: 10
      })
      .setInterval({
        start: 3,
        end: 500
      });

    const heatmapSeries = chart.addHeatmapGridSeries({
      columns: 901,
      rows: 2500,
      dataOrder: "rows",
      start: { x: 0, y: 0 },
      end: { x: 25, y: 25 }
    })
    .setWireframeStyle(emptyLine)
    .setIntensityInterpolation("bilinear");

    return () => {
      chart.dispose();
    };
  }, []);

  return <div id="lc" style={{ width: "500px", height: "500px" }}></div>;
}

export default App;

In version 4.2.1, the heatmap displays correctly, as shown in this screenshot: enter image description here

after updating to version 5.2.0, I encounter the following error and the chart does not render:

Uncaught Error: HeatmapGridSeries can only be attached to a pair of Linear Axes.

Here is a screenshot of the error: enter image description here

Has anyone else encountered this issue? Is there a workaround to use a logarithmic axis with a heatmap in the latest version, or is this a bug?


Solution

  • Heatmap series do not support logarithmic axes. Not even in previous versions, they simply didn't crash but behaved incorrectly which would be visible if the heatmap in question had any data.