76 công cụ vẽ
Code
Đọc docs →import { ChartWidget } from '@tradecanvas/chart/widget'
// feed: your DataAdapter (a WebSocketAdapter, or your own class)
const widget = new ChartWidget(document.getElementById('chart')!, {
symbol: 'NVDA',
timeframe: '1h',
theme: 'light',
adapter: feed,
// 76 drawing tools in the left toolbar; they are saved with the layout
persistLayouts: true,
})
const chart = widget.getChart()
chart.addDrawing({ type: 'fibRetracement', anchors: [low, high] })
chart.addDrawing({
type: 'trendLine', name: 'Rising support', anchors: [low, nextLow],
style: { text: 'Support', textAlign: 'center', textVAlign: 'bottom' },
})
chart.addDrawing({ type: 'signpost', anchors: [high], style: { text: 'Top' } })
// Kept to the screen: shares of the plot, not a time and a price
chart.addDrawing({ type: 'anchoredNote', anchors: [{ time: 0.06, price: 0.86 }],
style: { text: 'Double-click this note to type over it' } })
// On the RSI pane, at 70 on its scale
const rsi = chart.addIndicator('rsi', { period: 14 })
chart.addDrawing({ type: 'horizontalLine', paneId: rsi, anchors: [{ time, price: 70 }],
style: { text: 'Overbought' } })import { ChartWidget } from '@tradecanvas/chart/widget'
// feed: your DataAdapter (a WebSocketAdapter, or your own class)
const widget = new ChartWidget(document.getElementById('chart')!, {
symbol: 'NVDA',
timeframe: '1h',
theme: 'dark',
adapter: feed,
// 76 drawing tools in the left toolbar; they are saved with the layout
persistLayouts: true,
})
const chart = widget.getChart()
chart.addDrawing({ type: 'fibRetracement', anchors: [low, high] })
chart.addDrawing({
type: 'trendLine', name: 'Rising support', anchors: [low, nextLow],
style: { text: 'Support', textAlign: 'center', textVAlign: 'bottom' },
})
chart.addDrawing({ type: 'signpost', anchors: [high], style: { text: 'Top' } })
// Kept to the screen: shares of the plot, not a time and a price
chart.addDrawing({ type: 'anchoredNote', anchors: [{ time: 0.06, price: 0.86 }],
style: { text: 'Double-click this note to type over it' } })
// On the RSI pane, at 70 on its scale
const rsi = chart.addIndicator('rsi', { period: 14 })
chart.addDrawing({ type: 'horizontalLine', paneId: rsi, anchors: [{ time, price: 70 }],
style: { text: 'Overbought' } })● Dữ liệu thị trường giả lập, tạo trong trình duyệt của bạn
Một màn hình hoàn chỉnh có sẵn: order ticket, order và position trên biểu đồ, cắt lỗ và chốt lời kéo được, watchlist, cảnh báo và bar replay.
API: addDrawing







