0

OHLC 图表以红色(如果开盘值大于收盘值)或绿色显示烛台。使用 LightningChartJS 是否可以为具有相同开盘值和收盘值的条形图设置不同的颜色(如灰色)?目前它以绿色显示。

.setPositiveStyle( (figure) => figure
                    .setStrokeStyle( (stroke) => stroke.setThickness(2) )
                   )
  .setNegativeStyle( (figure) => figure
                    .setStrokeStyle( (stroke) => stroke.setThickness(2) )
                   )
4

1 回答 1

2

OHLCSeries.setStyle()可用于指定正数和负数通用的样式器。您应该能够检查样式器内部的开盘值和收盘值是否相等并采取相应措施。

OHLCSeries.setStyle(( candlestick ) => {
    if ( candlestick.getClose() === candlestick.getOpen() ) {
         // Apply special style to candlestick.
    }
})
于 2019-11-05T13:33:06.177 回答