我正在使用 lightingChartJS 在仪表板对象中创建热图。我的要求是有一个对数x轴,而正常的x轴不应该是可见的。此设置在 4.2.1 版本中完美运行,但更新到 5.2.0 版本后,它会抛出错误并且不显示热图。
注意:刚刚检查过,它也不适用于没有仪表板的常规 ChartXY 初始化。
这是我正在使用的 React 代码片段:
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;
更新到5.2.0版本后,遇到以下错误并且图表不渲染:
Uncaught Error: HeatmapGridSeries can only be attached to a pair of Linear Axes.
还有其他人遇到过这个问题吗?在最新版本中是否有解决方法可以使用对数轴和热图,或者这是一个错误?
热图系列不支持对数轴。即使在以前的版本中,它们也不会崩溃,但行为不正确,如果有问题的热图有任何数据,这将是可见的。