Spaces:
Running
Running
Add 2 files
Browse files- 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>
|
| 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;
|
| 10 |
-
h1 { text-align: center;
|
| 11 |
-
#chart { width: 100%; height:
|
| 12 |
</style>
|
| 13 |
</head>
|
| 14 |
<body>
|
| 15 |
-
<h1>Chart Candlestick
|
| 16 |
<div id="chart"></div>
|
| 17 |
|
| 18 |
<script>
|
| 19 |
const chart = LightweightCharts.createChart(document.getElementById('chart'), {
|
| 20 |
-
|
| 21 |
-
|
|
|
|
|
|
|
| 22 |
crosshair: { mode: LightweightCharts.CrosshairMode.Normal },
|
| 23 |
-
rightPriceScale: { borderColor: '#
|
| 24 |
-
timeScale: { borderColor: '#
|
| 25 |
});
|
| 26 |
|
| 27 |
const candlestickSeries = chart.addCandlestickSeries({
|
| 28 |
-
upColor: '#26a69a',
|
| 29 |
-
|
|
|
|
|
|
|
|
|
|
| 30 |
});
|
| 31 |
|
| 32 |
-
// Data sampel (
|
| 33 |
const data = [
|
| 34 |
-
{ time: '2025-
|
| 35 |
-
{ time: '2025-
|
| 36 |
-
{ time: '2025-
|
| 37 |
-
{ time: '2025-
|
| 38 |
-
{ time: '2025-
|
| 39 |
-
{ time: '2025-
|
| 40 |
-
{ time: '2025-
|
| 41 |
-
|
|
|
|
| 42 |
];
|
| 43 |
|
| 44 |
candlestickSeries.setData(data);
|
| 45 |
|
| 46 |
-
// Responsif saat resize
|
| 47 |
-
window.addEventListener('resize', () =>
|
|
|
|
|
|
|
| 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>
|