Skip to content

Latest commit

 

History

History
364 lines (321 loc) · 13.5 KB

README.md

File metadata and controls

364 lines (321 loc) · 13.5 KB

Crowdchess Dataviz

Win/Draw/Loss evaluation

Show evolution of win/draw/loss evaluation over time (white point of view), can be filtered in between turns to show a single chessgame.

DevFest 2024 - Day 1

devfest-2024-10-17-partie

DevFest 2024 - Day 2

devfest-2024-10-18-partie

Source code

Link

{
  "$schema": "https://vega.github.io/schema/vega-lite/v5.json",
  "data": {
    "url": "https://raw.githubusercontent.com/CGI-FR/crowd-chess-data/refs/heads/main/20240927-turns.csv"
  },
  "width": 800,
  "height": 600,
  "transform": [
    {"filter": {"field": "id", "lt": 6210}},
    {"filter": {"field": "id", "gt": 6152}},
    {"fold": ["win", "draw", "loss"], "as": ["Résultat", "Probabilité"]},
    {"calculate": "indexof(['win', 'draw', 'loss'], datum.Résultat)", "as": "order"}
  ],
  "mark": "area",
  "encoding": {
    "x": {"field": "end_of_turn", "type": "temporal", "title": "Heure"},
    "y": {
      "field": "Probabilité",
      "type": "quantitative",
      "stack": "normalize",
      "title": "Probabilité cumulée (%)",
      "axis": {"format": "%"}
    },
    "color": {
      "field": "Résultat",
      "type": "nominal",
      "title": "Résultat",
      "scale": {
        "domain": ["win", "draw", "loss"],
        "range": ["#f5f5dc", "#808080", "#000000"]
      }
    },
    "order": {"field": "order", "type": "ordinal"}
  }
}

Active players over time

DevFest 2024 - Day 1

devfest-2024-10-17-joueurs

DevFest 2024 - Day 2

devfest-2024-10-18-joueurs

Source code

Full month

Single day

{
  "$schema": "https://vega.github.io/schema/vega-lite/v5.json",
  "data": {
    "url": "https://raw.githubusercontent.com/CGI-FR/crowd-chess-data/refs/heads/main/202409-votes.csv"
  },
  "vconcat": [
  {
    "width": 800,
    "height": 600,
    "params": [{"name": "jour", "select": {"type": "point", "encodings": ["x"]}}],
    "mark": "bar",
    "encoding": {
      "x": {
        "timeUnit": "date",
        "field": "instant",
        "type": "temporal",
        "title": "Jour",
        "bandPosition": 0
      },
      "y": {
        "aggregate": "distinct",
        "field": "player_pseudo",
        "type": "quantitative",
        "title": "Nombre de joueurs"
      },
      "color": {
        "aggregate": "distinct",
        "field": "player_pseudo",
        "legend": {
          "title": "Nombre de joueurs"
        }
      }
    }
  },
  {
    "width": 800,
    "height": 600,
    "transform": [{"filter": {"param": "jour"}}],
    "mark": "bar",
    "encoding": {
      "x": {
        "timeUnit": "hours",
        "field": "instant",
        "type": "temporal",
        "title": "Heure",
        "bandPosition": 0,
        "axis": {
          "values": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23]
        }
      },
      "y": {
        "aggregate": "distinct",
        "field": "player_pseudo",
        "type": "quantitative",
        "title": "Nombre de joueurs"
      },
      "color": {
        "aggregate": "distinct",
        "field": "player_pseudo",
        "legend": {
          "title": "Nombre de joueurs"
        },
        "scale": {
          "scheme": "reds"
        }
      }
    }
  }]
}

Average player accuracy by turns

Compute average accuracy of players with at least 5 active votes (an active vote is the last vote submitted on each turn).

DevFest 2024 - Day 1

devfest-2024-10-17-accuracy-filtered

DevFest 2024 - Day 2

devfest-2024-10-18-accuracy-filtered

Source code

Link

{
  "$schema": "https://vega.github.io/schema/vega-lite/v5.json",
  "data": {
    "url": "https://raw.githubusercontent.com/CGI-FR/crowd-chess-data/refs/heads/main/20241017-votes.csv"
  },
  "width": 800,
  "height": 600,
  "transform": [
    {
      "window": [{"op": "row_number", "as": "row_number"}],
      "groupby": ["turn_id", "player_pseudo"],
      "sort": [{"field": "instant", "order": "descending"}]
    },
    {"filter": "datum.row_number == 1"},
    {"filter": "datum.turn_id <= 10349"},
    {
      "groupby": ["player_pseudo"],
      "aggregate": [
        {"op": "count", "as": "nb_moves"},
        {"op": "mean", "field": "accuracy", "as": "avg_accuracy"},
        {"op": "mean", "field": "points", "as": "avg_points"}
      ]
    },
    {"filter": "datum.nb_moves >= 5"}
  ],
  "mark": {"type": "bar", "color": "#b41f1f"},
  "encoding": {
    "x": {
      "field": "avg_accuracy",
      "type": "quantitative",
      "title": "Précision moyenne par tours"
    },
    "y": {
      "field": "player_pseudo",
      "type": "nominal",
      "sort": "-x",
      "title": "Joueur"
    },
    "color": {
      "field": "nb_moves",
      "type": "quantitative",
      "scale": {"scheme": "blues"},
      "title": "Nombre de tours joués"
    }
  },
  "config": {"axis": {"labelFontSize": 10, "titleFontSize": 14}}
}

Average points by turns

DevFest 2024 - Day 1

devfest-2024-10-17-points-filtered

DevFest 2024 - Day 2

devfest-2024-10-18-points-filtered

Source code

Link

{
  "$schema": "https://vega.github.io/schema/vega-lite/v5.json",
  "data": {
    "url": "https://raw.githubusercontent.com/CGI-FR/crowd-chess-data/refs/heads/main/20241018-votes.csv"
  },
  "width": 800,
  "height": 600,
  "transform": [
    {
      "window": [
        {
          "op": "row_number",
          "as": "row_number"
        }
      ],
      "groupby": ["turn_id", "player_pseudo"],
      "sort": [
        {"field": "instant", "order": "descending"}
      ]
    },
    {
      "filter": "datum.row_number == 1"
    },
    {
      "filter": "datum.turn_id < 10552"
    },
    {
      "groupby": ["player_pseudo"],
      "aggregate": [
        {"op": "count", "as": "nb_moves"},
        {"op": "mean", "field": "accuracy", "as": "avg_accuracy"},
        {"op": "mean", "field": "points", "as": "avg_points"}
      ]
    },
    {
      "filter": "datum.nb_moves >= 5"
    }
  ],
  "mark": {
    "type": "bar",
    "color": "#b41f1f"
  },
  "encoding": {
    "x": {
      "field": "avg_points",
      "type": "quantitative",
      "title": "Quantité moyenne de points engrangés par tours"
    },
    "y": {
      "field": "player_pseudo",
      "type": "nominal",
      "sort": "-x",
      "title": "Joueur"
    },
    "color": {
      "field": "nb_moves", 
      "type": "quantitative",
      "scale": {"scheme": "reds"},
      "title": "Nombre de tours joués"
    }
  },
  "config": {
    "axis": {
      "labelFontSize": 10,
      "titleFontSize": 14
    }
  }
}

Average rank of effective vote

Show the average rank of the effective vote counted for each player (e.g. your rank if 5 if 4 players played the same move as you before you). Lower value for average rank is better since you get more points.

DevFest 2024 - Day 1

devfest-2024-10-17-rank-filtered

DevFest 2024 - Day 2

devfest-2024-10-18-rank-filtered

Source code

{
  "$schema": "https://vega.github.io/schema/vega-lite/v5.json",
  "data": {
    "url": "https://raw.githubusercontent.com/CGI-FR/crowd-chess-data/refs/heads/main/20241018-votes.csv"
  },
  "width": 800,
  "height": 600,
  "transform": [
    {
      "window": [{"op": "row_number", "as": "row_number"}],
      "groupby": ["turn_id", "player_pseudo"],
      "sort": [{"field": "instant", "order": "descending"}]
    },
    {"filter": "datum.row_number == 1"},
    {"filter": "datum.turn_id <= 10551"},
    {
      "window": [{"op": "rank", "as": "rank"}],
      "groupby": ["turn_id", "move"],
      "sort": [{"field": "instant", "order": "ascending"}]
    },
    {
      "groupby": ["player_pseudo"],
      "aggregate": [
        {"op": "count", "as": "nb_moves"},
        {"op": "mean", "field": "accuracy", "as": "avg_accuracy"},
        {"op": "mean", "field": "points", "as": "avg_points"},
        {"op": "mean", "field": "rank", "as": "med_rank"}
      ]
    },
    {"filter": "datum.nb_moves >= 5"}
  ],
  "mark": "bar",
  "encoding": {
    "x": {
      "field": "med_rank",
      "type": "quantitative",
      "title": "Rang médian"
    },
    "y": {
      "field": "player_pseudo",
      "type": "nominal",
      "sort": "x",
      "title": "Joueur"
    },
    "color": {
      "field": "nb_moves",
      "type": "quantitative",
      "scale": {"scheme": "greens"},
      "title": "Nombre de tours joués"
    }
  },
  "config": {"axis": {"labelFontSize": 10, "titleFontSize": 14}}
}