alterzick commited on
Commit
cccdade
·
verified ·
1 Parent(s): 6d31845

Add 2 files

Browse files
Files changed (1) hide show
  1. index.html +30 -22
index.html CHANGED
@@ -3,48 +3,56 @@
3
  <head>
4
  <meta charset="UTF-8">
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>Aplikasi Chart Mirip TradingView (Lightweight Charts)</title>
7
  <script src="https://unpkg.com/lightweight-charts/dist/lightweight-charts.standalone.production.js"></script>
8
  <style>
9
- body { margin: 0; font-family: Arial, sans-serif; background: #f0f0f0; }
10
- h1 { text-align: center; padding: 20px; background: #1e222d; color: white; margin: 0; }
11
- #chart { width: 100%; height: calc(100vh - 60px); }
12
  </style>
13
  </head>
14
  <body>
15
- <h1>Chart Candlestick Mirip TradingView</h1>
16
  <div id="chart"></div>
17
 
18
  <script>
19
  const chart = LightweightCharts.createChart(document.getElementById('chart'), {
20
- layout: { background: { color: '#1e222d' }, textColor: '#d1d4dc' },
21
- grid: { vertLines: { color: '#2b2b2b' }, horzLines: { color: '#2b2b2b' } },
 
 
22
  crosshair: { mode: LightweightCharts.CrosshairMode.Normal },
23
- rightPriceScale: { borderColor: '#2b2b2b' },
24
- timeScale: { borderColor: '#2b2b2b' },
25
  });
26
 
27
  const candlestickSeries = chart.addCandlestickSeries({
28
- upColor: '#26a69a', downColor: '#ef5350',
29
- borderVisible: false, wickUpColor: '#26a69a', wickDownColor: '#ef5350',
 
 
 
30
  });
31
 
32
- // Data sampel (dapat diganti dengan fetch dari API seperti Alpha Vantage atau Polygon)
33
  const data = [
34
- { time: '2025-01-01', open: 100, high: 110, low: 95, close: 105 },
35
- { time: '2025-01-02', open: 105, high: 115, low: 100, close: 112 },
36
- { time: '2025-01-03', open: 112, high: 120, low: 108, close: 118 },
37
- { time: '2025-01-04', open: 118, high: 125, low: 115, close: 120 },
38
- { time: '2025-01-05', open: 120, high: 130, low: 118, close: 128 },
39
- { time: '2025-01-06', open: 128, high: 135, low: 125, close: 132 },
40
- { time: '2025-01-07', open: 132, high: 140, low: 130, close: 138 },
41
- // Tambahkan lebih banyak data untuk tampilan lengkap
 
42
  ];
43
 
44
  candlestickSeries.setData(data);
45
 
46
- // Responsif saat resize window
47
- window.addEventListener('resize', () => chart.applyOptions({ width: window.innerWidth, height: window.innerHeight - 60 }));
 
 
48
  </script>
49
  <p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-qwensite.hf.space/logo.svg" alt="qwensite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-qwensite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >QwenSite</a> - 🧬 <a href="https://enzostvs-qwensite.hf.space?remix=alterzick/tradingview-v1" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
50
  </html>
 
3
  <head>
4
  <meta charset="UTF-8">
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Chart Mirip TradingView</title>
7
  <script src="https://unpkg.com/lightweight-charts/dist/lightweight-charts.standalone.production.js"></script>
8
  <style>
9
+ body { margin: 0; padding: 20px; background: #f0f0f0; font-family: Arial, sans-serif; }
10
+ h1 { text-align: center; color: #333; }
11
+ #chart { width: 100%; height: 80vh; min-height: 600px; }
12
  </style>
13
  </head>
14
  <body>
15
+ <h1>Chart Candlestick Interaktif (Lightweight Charts)</h1>
16
  <div id="chart"></div>
17
 
18
  <script>
19
  const chart = LightweightCharts.createChart(document.getElementById('chart'), {
20
+ width: document.getElementById('chart').clientWidth,
21
+ height: 600,
22
+ layout: { background: { color: '#ffffff' }, textColor: '#333' },
23
+ grid: { vertLines: { color: '#e0e0e0' }, horzLines: { color: '#e0e0e0' } },
24
  crosshair: { mode: LightweightCharts.CrosshairMode.Normal },
25
+ rightPriceScale: { borderColor: '#cccccc' },
26
+ timeScale: { borderColor: '#cccccc' },
27
  });
28
 
29
  const candlestickSeries = chart.addCandlestickSeries({
30
+ upColor: '#26a69a',
31
+ downColor: '#ef5350',
32
+ borderVisible: false,
33
+ wickUpColor: '#26a69a',
34
+ wickDownColor: '#ef5350',
35
  });
36
 
37
+ // Data sampel (time dalam format 'YYYY-MM-DD', open/high/low/close)
38
  const data = [
39
+ { time: '2025-12-01', open: 175, high: 180, low: 170, close: 178 },
40
+ { time: '2025-12-02', open: 178, high: 185, low: 175, close: 182 },
41
+ { time: '2025-12-03', open: 182, high: 190, low: 180, close: 188 },
42
+ { time: '2025-12-04', open: 188, high: 195, low: 185, close: 192 },
43
+ { time: '2025-12-05', open: 192, high: 200, low: 190, close: 198 },
44
+ { time: '2025-12-06', open: 198, high: 205, low: 195, close: 202 },
45
+ { time: '2025-12-07', open: 202, high: 210, low: 200, close: 208 },
46
+ { time: '2025-12-08', open: 208, high: 215, low: 205, close: 212 },
47
+ // Tambahkan data lebih banyak sesuai kebutuhan
48
  ];
49
 
50
  candlestickSeries.setData(data);
51
 
52
+ // Responsif saat resize
53
+ window.addEventListener('resize', () => {
54
+ chart.applyOptions({ width: document.getElementById('chart').clientWidth });
55
+ });
56
  </script>
57
  <p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-qwensite.hf.space/logo.svg" alt="qwensite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-qwensite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >QwenSite</a> - 🧬 <a href="https://enzostvs-qwensite.hf.space?remix=alterzick/tradingview-v1" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
58
  </html>