Chandeliers japonais (OHLC)
Règle low→high pour les mèches et barre open→close pour les corps, couleur selon le sens de la bougie — un graphique de prix complet en deux couches.
Cas d'usage
Visualiser l'historique de prix d'un actif dans un rapport de backtest.
Prérequis
Vega-Lite v5
Vega-Lite
{
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"data": {
"values": [
{ "date": "2026-05-26", "open": 1.0820, "high": 1.0865, "low": 1.0795, "close": 1.0851 },
{ "date": "2026-05-27", "open": 1.0851, "high": 1.0890, "low": 1.0832, "close": 1.0878 },
{ "date": "2026-05-28", "open": 1.0878, "high": 1.0902, "low": 1.0815, "close": 1.0829 },
{ "date": "2026-05-29", "open": 1.0829, "high": 1.0845, "low": 1.0760, "close": 1.0772 },
{ "date": "2026-06-01", "open": 1.0772, "high": 1.0810, "low": 1.0741, "close": 1.0798 },
{ "date": "2026-06-02", "open": 1.0798, "high": 1.0856, "low": 1.0790, "close": 1.0843 },
{ "date": "2026-06-03", "open": 1.0843, "high": 1.0871, "low": 1.0808, "close": 1.0816 },
{ "date": "2026-06-04", "open": 1.0816, "high": 1.0902, "low": 1.0811, "close": 1.0889 },
{ "date": "2026-06-05", "open": 1.0889, "high": 1.0934, "low": 1.0867, "close": 1.0921 },
{ "date": "2026-06-08", "open": 1.0921, "high": 1.0958, "low": 1.0884, "close": 1.0902 },
{ "date": "2026-06-09", "open": 1.0902, "high": 1.0925, "low": 1.0848, "close": 1.0861 },
{ "date": "2026-06-10", "open": 1.0861, "high": 1.0913, "low": 1.0852, "close": 1.0897 }
]
},
"encoding": {
"x": { "field": "date", "type": "temporal", "title": null },
"color": {
"condition": { "test": "datum.close >= datum.open", "value": "#27c93f" },
"value": "#ff5f56"
}
},
"layer": [
{
"mark": "rule",
"encoding": {
"y": { "field": "low", "type": "quantitative", "scale": { "zero": false }, "title": "Prix" },
"y2": { "field": "high" }
}
},
{
"mark": { "type": "bar", "width": 6 },
"encoding": {
"y": { "field": "open", "type": "quantitative" },
"y2": { "field": "close" }
}
}
]
}Vega-LiteCandlestickOHLCTrading