我正在使用LightningChartJS创建有条形的图表。我有正负两方面的数据。是否有任何可用的属性可用于根据我想看到的内容隐藏负条或正条?
注意:我显然可以编写一些基本的逻辑来实现这个功能,但是我正在寻找一些内置的功能。
const rectangles = chart.addRectangleSeries()
const addValues = (entries) => {
for (const entry of entries) {
bars.push(add(entry))
}
}
const add = (entry) => {
// Create rect dimentions.
const rectDimensions = {
x: x - figureThickness,
y: 0,
width: figureThickness,
height: entry.value
}
// Add rect to the series.
x += figureThickness + figureGap
// Return data-structure with both original 'entry' and the rectangle figure that represents it.
return {
entry,
rect
}
}
chart.addValues([
{ category: '', value: 20 },
{ category: '', value: 40 },
{ category: '', value: -23 },
{ category: '', value: -29 },
{ category: '', value: 15 }
])发布于 2019-11-05 13:28:28
要隐藏基于值的系列/数字,您必须在应用程序端实现此逻辑。
为此,您有两个选择:
的矩形时,将收到对图形的引用。
在这两种情况下,您将不得不隐藏不希望看到的系列/数字,并恢复您想要看到的内容。RectangleSeries和图都有dispose()和restore()方法。
https://stackoverflow.com/questions/58693872
复制相似问题