public updateOptions()

in desktop/src/app/components/job/graphs/job-progress-graph/job-progress-graph.component.ts [55:118]


    public updateOptions() {
        const hitRadius = this.interactive ? 5 : 0;
        this.options = {
            responsive: true,
            maintainAspectRatio: false,
            animation: { duration: 0 },
            legend: {
                display: false,
            },
            elements: {
                point: {
                    radius: 0,
                    hitRadius: hitRadius,
                    hoverRadius: hitRadius,
                },
            },
            hover: {
                mode: "nearest",
                intersect: true,
            },
            tooltips: {
                enabled: true,
                mode: "nearest",
                callbacks: {
                    title: (tooltipItems, data) => {
                        return this._getToolTip(tooltipItems[0]);
                    },
                    label: () => null,
                },
            },
            scales: {
                xAxes: [{
                    type: "linear",
                    position: "bottom",
                    ticks: {
                        min: 0,
                        callback: (value: number) => {
                            const seconds = Math.floor(value / 1000);
                            if (seconds > 180) {
                                if (seconds % 60 === 0) {
                                    return seconds / 60 + "m";
                                }
                            } else {
                                if (seconds % 1 === 0) {
                                    return seconds + "s";
                                }
                            }
                        },
                    },
                    scaleLabel: {
                        display: true,
                        labelString: "Time since the job started.",
                    },
                }],
                yAxes: [{
                    type: "linear",
                    scaleLabel: {
                        display: true,
                        labelString: "Task count",
                    },
                }],
            },
        };
    }