【问题标题】:Can I have some different color on candle-stick if opening and closing values are same in OHLC?如果 OHLC 中的开盘价和收盘价相同,我可以在烛台上使用不同的颜色吗?
【发布时间】:2020-02-23 15:14:48
【问题描述】:

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

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

【问题讨论】:

    标签: javascript charts trading candlestick-chart lightningchart


    【解决方案1】:

    OHLCSeries.setStyle() 可用于指定正数和负数通用的样式器。您应该能够在样式器中检查相同的开始值和结束值并采取相应措施。

    OHLCSeries.setStyle(( candlestick ) => {
        if ( candlestick.getClose() === candlestick.getOpen() ) {
             // Apply special style to candlestick.
        }
    })
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-04-04
      • 2016-08-03
      • 1970-01-01
      • 2021-02-22
      • 2021-01-07
      • 1970-01-01
      相关资源
      最近更新 更多