OHLC 图表以红色(如果开盘价大于收盘价)或绿色显示烛台。使用 LightningChartJS 是否可以为具有相同开盘价和收盘价的柱形图提供不同的颜色(如灰色)?目前它显示为绿色。
.setPositiveStyle( (figure) => figure
.setStrokeStyle( (stroke) => stroke.setThickness(2) )
)
.setNegativeStyle( (figure) => figure
.setStrokeStyle( (stroke) => stroke.setThickness(2) )
)
最佳答案
OHLCSeries.setStyle() 可用于指定正数和负数通用的样式器。您应该能够检查样式器内的相等打开值和关闭值并采取相应的操作。
OHLCSeries.setStyle(( candlestick ) => {
if ( candlestick.getClose() === candlestick.getOpen() ) {
// Apply special style to candlestick.
}
})
关于javascript - 如果 OHLC 中的开盘价和收盘价相同,我可以在烛台上使用不同的颜色吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58589506/