lightweight-charts - 如何将图表背景颜色设置为黑色?
我正在使用 [lightweight-charts] javascript 库来生成一些图表。在本示例中,我使用实时模拟图表。
在此示例中,背景颜色为白色。我想将背景颜色设置为黑色。我正在遵循文档,但无法实现目标。
以下是我正在使用的代码,但它不起作用:
var chart = LightweightCharts.createChart(document.getElementById('chart'), {
width: 1200,
height: 800,
background: '#000000',
textColor: '#ffffff'
});
var candleSeries = chart.addCandlestickSeries();
var data = [...]
我缺少什么?
I am using the [lightweight-charts] javascript library to generate some charts. For this example I am using the Realtime emulation chart.
In this example the background color is white. I would like to set the background color to black. I am following the documentation but I can't achieve the goal.
Following is the code I am using but it is not working:
var chart = LightweightCharts.createChart(document.getElementById('chart'), {
width: 1200,
height: 800,
background: '#000000',
textColor: '#ffffff'
});
var candleSeries = chart.addCandlestickSeries();
var data = [...]
What am I missing?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要将背景和背景都包裹起来。
layout
属性中的 textColor 如下所示 文档
You'll need to wrap both background & textColor within a
layout
property likeas seen in this doc