我想自定义我的TradingView图表小部件,这是在一个InAppWebView
小部件。我可以显示图表,但是,我想更改图表小部件的背景颜色、字体和价格滚动条的类型。我该怎么做呢?有什么文件吗?我在stackoverflow上搜索了很多,但任何推荐都不起作用。我想让图表类似于binance的图表。
感谢所有的回复!:)
String _testCode() {
return """
<!-- TradingView Widget BEGIN -->
<div class="tradingview-widget-container">
<script type="text/javascript" src="https://s3.tradingview.com/tv.js"></script>
<script type="text/javascript">
new TradingView.widget(
{
"autosize": true,
"symbol": "AAPL",
"interval": "D",
"timezone": "exchange",
"theme": "dark",
"style": "1",
"toolbar_bg": "#ff7518", <!-- Does Not Work-->
"hide_side_toolbar": false,
"allow_symbol_change": true,
"save_image": false,
"show_popup_button": true,
"popup_width": "1000",
"popup_height": "650",
"locale": "en",
"overrides": { <!-- Does Not Work-->
"paneProperties.background": "#ffffff",
},
}
);
</script>
</div>
<!-- TradingView Widget END -->
""";
}
@override
Widget build(BuildContext context) {
return InAppWebView(
initialOptions: InAppWebViewGroupOptions(
crossPlatform: InAppWebViewOptions(
transparentBackground: true,
javaScriptEnabled: true,
),
ios: IOSInAppWebViewOptions(
disallowOverScroll: true,
),
),
onWebViewCreated: (InAppWebViewController controller) async {
controller.loadUrl(
urlRequest: URLRequest(
url: Uri.dataFromString(
//_generateCode(binanceSymbol),
_testCode(),
mimeType: 'text/html',
encoding: Encoding.getByName('utf-8'),
),
),
);
},
);
}
try
String _testCode() {
return """
<!-- TradingView Widget BEGIN -->
<div class="tradingview-widget-container">
<script type="text/javascript" src="https://s3.tradingview.com/tv.js"></script>
<script type="text/javascript">
new TradingView.widget({
"autosize": true,
"symbol": "AAPL",
"interval": "D",
"timezone": "exchange",
"theme": "dark",
"style": "1",
"toolbar_bg": "#ff7518",
"hide_side_toolbar": false,
"allow_symbol_change": true,
"save_image": false,
"show_popup_button": true,
"popup_width": "1000",
"popup_height": "650",
"locale": "en",
"overrides": {
"paneProperties.background": "#ffffff",
}
});
</script>
</div>
<!-- TradingView Widget END -->
""";
}