關於使用tradingview插件的一些心得


1、禁用自帶的一些功能

disabled_features: [ // 開啟圖表功能的字符串文字 允許將用戶設置保存到本地存儲
'header_symbol_search', // 頭部搜索
"header_widget_dom_node", // 隱藏頭部組件
'source_selection_markers', // 禁用系列和指示器的選擇標記
"header_indicators", //圖標指標
'adaptive_logo', // 移動端可以隱藏logo
'constraint_dialogs_movement',
'header_interval_dialog_button',
'show_interval_dialog_on_key_press',
'symbol_search_hot_key',
'study_dialog_search_control',
'display_market_status',
'header_chart_type',// k線樣式
'header_compare',// 圖表對比
'header_undo_redo', // 撤銷返回
'header_screenshot', // 截圖
'volume_force_overlay', // 防止他們重疊
'header_settings',// 設置
'property_pages',// 禁用所有屬性頁
'header_fullscreen_button',// 全屏
"header_saveload",
'edit_buttons_in_legend',
'timeframes_toolbar', // 下面的時間
'symbol_info',
'border_around_the_chart',
'main_series_scale_menu',
'star_some_intervals_by_default',
'datasource_copypaste',
'right_bar_stays_on_scroll',
'context_menus',
'go_to_date',
'compare_symbol',
'border_around_the_chart',
'timezone_menu',
'header_resolutions',// todo: przetestowac// 頭部的時間
'control_bar',//todo: przetestowac
'edit_buttons_in_legend',// todo: przetestowac
'remove_library_container_border',
]
eslint 使用單引號
 
2、創建 按鈕
this.widget.createButton()
.attr('title', '分時')
.on('click', (e) => {
this.widget.chart().setChartType(3); //3 代表類型 分時, 普通分鍾按鈕 1 
this.widget.chart().setResolution('1', () => { // 1代表1分鍾  
// console.log("set resolution callback");
});
}).append(() => {
});
3、更改蠟燭圖顯示
overrides:{
'paneProperties.background': '#162431', // 蠟燭樣式
'mainSeriesProperties.candleStyle.upColor': '#64ae74',
'mainSeriesProperties.candleStyle.downColor': '#df5f61',
// 燭心
'mainSeriesProperties.candleStyle.drawWick': true,
// 燭心顏色
'mainSeriesProperties.candleStyle.wickUpColor': '#64ae74',
'mainSeriesProperties.candleStyle.wickDownColor': '#df5f61',
// 邊框
'mainSeriesProperties.candleStyle.drawBorder': true,
'mainSeriesProperties.candleStyle.borderUpColor': '#64ae74',
'mainSeriesProperties.candleStyle.borderDownColor': '#df5f61',
// 網格
'paneProperties.vertGridProperties.style': 0,
'paneProperties.horzGridProperties.color':'#262727',
'paneProperties.vertGridProperties.color': '#262727',
// 坐標軸和刻度標簽顏色
'scalesProperties.lineColor': '#252525',
'scalesProperties.textColor': '#8a8a8a',
'paneProperties.legendProperties.showLegend': false,
'paneProperties.topMargin': 20,
// 'paneProperties.bottomMargin": 5
},
具體顏色自己決定
 
custom_css_url:'chart.css', // 引入外部css
toolbar_bg:'#222831', // 工具欄背景顏色
loading_screen: { backgroundColor: '#162431',foregroundColor:'#162431' }, // 加載背景 加載圖標背景顏色  沒找到隱藏方式,這樣隱藏


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM