AtCoderHeuristicContestBarChart

横軸を順位、縦軸を総スコアとする棒グラフを、順位表上部に出力

Stan na 13-10-2023. Zobacz najnowsza wersja.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

You will need to install an extension such as Tampermonkey to install this script.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name         AtCoderHeuristicContestBarChart
// @namespace    http://tampermonkey.net/
// @version      0.1.1
// @description  横軸を順位、縦軸を総スコアとする棒グラフを、順位表上部に出力
// @author       pitP
// @license      MIT
// @match        https://atcoder.jp/contests/ahc*/standings*
// @require      https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.9.4/Chart.min.js
// ==/UserScript==

(function () {
    'use strict';
    $('#vue-standings').prepend(`
    <div>
    <canvas id='BarChart'></canvas>
    </div>
    `);

    vueStandings.$watch('standings', function (newVal, oldVal) {
        if (!newVal) {
            return;
        }
        var data;
        var task = newVal.TaskInfo;
        if (vueStandings.filtered) {
            data = vueStandings.filteredStandings;
        }
        else {
            data = newVal.StandingsData;
        }


        const target_user = data.filter(item => item.TotalResult.Count > 0);
        const rank = Array.from({ length: target_user.length }, (_, i) => i + 1);
        const score = target_user.map(item => item.TotalResult.Score / 100);

        var ctx = document.getElementById("BarChart");
        var BarChart = new Chart(ctx, {
            type: 'bar',
            data: {
                labels: rank,
                datasets: [
                    {
                        label: 'TotalScore',
                        data: score,
                        backgroundColor: "rgba(0, 255, 0, 1)",
                    }
                ]
            },
        });
    }, { deep: true, immediate: true })
})();