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

问题描述 投票:0回答:1

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

.setPositiveStyle( (figure) => figure
                    .setStrokeStyle( (stroke) => stroke.setThickness(2) )
                   )
  .setNegativeStyle( (figure) => figure
                    .setStrokeStyle( (stroke) => stroke.setThickness(2) )
                   )
javascript charts trading candlestick-chart lightningchart
1个回答
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')})
)
© www.soinside.com 2019 - 2024. All rights reserved.