ManaDash logo ManaDash logo ManaDash
  • Home
  • Archetypes
  • Decktypes
  • Players
  • Elo
  • Deck Viewer
  • Cards Stats
  • Card Groups
  • Card Impact
  • Standings
Archetypes
  • Main Content
viewof season = Inputs.select(seasons, {
  label: "Season",
  value: seasons[0]
})
archetypeCountsData = transpose(archetype_counts_by_season)
decktypeCountsData = transpose(decktype_counts_by_season)
archetypeGameWinData = transpose(archetype_game_winrate_by_season)
decktypeGameWinData = transpose(decktype_game_winrate_by_season)
archetypeMatchWinData = transpose(archetype_match_winrate_by_season)
decktypeMatchWinData = transpose(decktype_match_winrate_by_season)
archetypeStrengthData = transpose(archetype_strength)
// Filters to the selected season, sorts descending by `y`, optionally keeps the
// top `top` rows, and draws a bar chart. `rule` adds a reference line: pass
// `true` for the 50% line, or any number (0 included) for a custom baseline.
// Note the `null` default -- `rule: 0` is falsy, so a boolean default would
// silently drop the zero line on diverging charts.
function barChart(data, {x, y, yLabel, colors, top, rule = null, yMin,
                        height = 700, fontSize = 28, wrap = true} = {}) {
  const rows = data
    .filter(d => d.season_id === season)
    .sort((a, b) => d3.descending(a[y], b[y]))
    .slice(0, top ?? Infinity);

  const label = s => String(s).replace(/[_\s]+/g, "\n");
  const lines = wrap ? d3.max(rows, d => label(d[x]).split("\n").length) : 1;
  const rotate = wrap ? 0 : (rows.length > 12 ? -45 : 0);

  return Plot.plot({
    width,
    height,
    marginBottom: rotate ? height * 0.31
                : wrap ? fontSize * 1.2 * lines + 24
                : height * 0.16,
    marginLeft: fontSize * 2.5,
    style: {fontSize: `${fontSize}px`},
    x: {
      label: null,
      domain: rows.map(d => d[x]),
      ticks: rows.map(d => d[x]),
      tickFormat: wrap ? label : undefined,
      tickRotate: rotate,
      tickPadding: 8
    },
    y: {
      label: yLabel,
      labelArrow: "none",
      labelAnchor: "center",
      labelOffset: fontSize * 2.5,
      ticks: 5,
      grid: true,
      domain: yMin === undefined ? undefined : [yMin, d3.max(rows, d => d[y])]
    },
    color: {domain: Object.keys(colors), range: Object.values(colors)},
    marks: [
      Plot.barY(rows, {x, y, fill: x, tip: true}),
      rule != null ? Plot.ruleY([rule === true ? 0.5 : rule], {
        stroke: "gray", strokeDasharray: "4,4", strokeOpacity: 0.5
      }) : null
    ]
  });
}
Archetypes
barChart(archetypeCountsData, {
  x: "archetype",
  y: "arche_types_count",
  yLabel: "Count",
  colors: archetype_color_map,

})
Win Rate Lift vs. Field Average
barChart(archetypeStrengthData, {
  x: "archetype",
  y: "archetype_win_rate_lift_pct",
  yLabel: "Lift (% points)",
  colors: archetype_color_map,
  rule: 0,

})
Winning Archetypes (20+ Games)
barChart(archetypeGameWinData, {
  x: "archetype",
  y: "game_winrate",
  yLabel: "Game Win Rate",
  colors: archetype_color_map,
  rule: true
})
Winning Archetypes by Match (5+ Matches)
barChart(archetypeMatchWinData, {
  x: "archetype",
  y: "match_win_rate",
  yLabel: "Match Win Rate",
  colors: archetype_color_map,
  rule: true
})
 

ManaDash — Vintage Cube Analysis