如何修改OHLC图表中条形图的默认颜色?

时间:2019-10-24 11:29:48

标签: javascript charts trading candlestick-chart lightningchart

我正在使用LightningChartJS创建OHLC图表。条形图默认为红色和绿色。如何更改这些条形图的颜色? 如何将填充样式添加到

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

1 个答案:

答案 0 :(得分:0)

您可以使用 setBodyFillStyle 方法更改OHLC图形的主体。

const series = chart.addOHLCSeries()
// Style a positive OHLC figure
series.setPositiveStyle( (figure) => figure
    // Style the body of a Positive Figure
    .setBodyFillStyle( new SolidFill({ color: ColorHEX('#E69965')})
)
// Style a negative OHLC figure
series.setNegativeStyle( (figure) => figure
    // Style the body of a Negative Figure
    .setBodyFillStyle( new SolidFill({color: ColorHEX('#E659A5')})
)