waffle با ابعاد 5×8: توزیع نتایج معاملات
چهل مربع، یکی برای هر معامله: ترنسفورمهای calculate (باقیمانده و تقسیم صحیح) شبکه رو میسازن و رنگ معنایی، برندهها، بازندهها و معاملات break-even رو میشمره.
کاربرد
نشوندادن win rate به شکلی گویاتر از یک درصد خشک، توی جلسهٔ مرور کارایی.
پیشنیازها
Vega-Lite v5
Vega-Lite
{
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"data": {
"values": [
{ "i": 0, "s": "Gagnant" }, { "i": 1, "s": "Gagnant" }, { "i": 2, "s": "Gagnant" }, { "i": 3, "s": "Gagnant" },
{ "i": 4, "s": "Gagnant" }, { "i": 5, "s": "Gagnant" }, { "i": 6, "s": "Gagnant" }, { "i": 7, "s": "Gagnant" },
{ "i": 8, "s": "Gagnant" }, { "i": 9, "s": "Gagnant" }, { "i": 10, "s": "Gagnant" }, { "i": 11, "s": "Gagnant" },
{ "i": 12, "s": "Gagnant" }, { "i": 13, "s": "Gagnant" }, { "i": 14, "s": "Gagnant" }, { "i": 15, "s": "Gagnant" },
{ "i": 16, "s": "Gagnant" }, { "i": 17, "s": "Gagnant" }, { "i": 18, "s": "Gagnant" }, { "i": 19, "s": "Gagnant" },
{ "i": 20, "s": "Gagnant" }, { "i": 21, "s": "Gagnant" }, { "i": 22, "s": "Gagnant" }, { "i": 23, "s": "Gagnant" },
{ "i": 24, "s": "Gagnant" }, { "i": 25, "s": "Perdant" }, { "i": 26, "s": "Perdant" }, { "i": 27, "s": "Perdant" },
{ "i": 28, "s": "Perdant" }, { "i": 29, "s": "Perdant" }, { "i": 30, "s": "Perdant" }, { "i": 31, "s": "Perdant" },
{ "i": 32, "s": "Perdant" }, { "i": 33, "s": "Perdant" }, { "i": 34, "s": "Perdant" }, { "i": 35, "s": "Perdant" },
{ "i": 36, "s": "Perdant" }, { "i": 37, "s": "Break-even" }, { "i": 38, "s": "Break-even" }, { "i": 39, "s": "Break-even" }
]
},
"transform": [
{ "calculate": "datum.i % 8", "as": "col" },
{ "calculate": "floor(datum.i / 8)", "as": "lig" }
],
"height": 240,
"mark": { "type": "rect", "stroke": "#0b0e14", "strokeWidth": 3, "tooltip": true },
"encoding": {
"x": { "field": "col", "type": "ordinal", "axis": null },
"y": { "field": "lig", "type": "ordinal", "axis": null },
"color": {
"field": "s", "type": "nominal", "title": null,
"scale": { "domain": ["Gagnant", "Perdant", "Break-even"], "range": ["#27c93f", "#ff5f56", "#ffbd2e"] },
"legend": { "orient": "top" }
},
"tooltip": [
{ "field": "i", "title": "Trade #" },
{ "field": "s", "title": "Résultat" }
]
}
}TradingWafflecalculateGrille