import { elements } from "chart.js";
import dayjs from "dayjs"

export function MEMORY_CHART_CONFIG() {
    return {
        type: 'line',
        options: {
            plugins: {
                title: {
                text: 'Chart.js Time Scale',
                display: true
                }
            },
            aspectRatio: 2.75,
            scales: {
                x: {
                    type: 'time',
                    time: {
                        // Luxon format string
                        tooltipFormat: 'DD.MM'
                    },
                    ticks: {
                        autoSkip: true,
                        maxTicksLimit: 6,
                        align: 'center',
                        color: '#cacacaff',
                        callback: function (value: Date) {
                            return dayjs(value).format("HH:mm");
                        }
                    },
                    grid: {
                        color: '#cacacaff',
                        borderColor: '#cacacaff',
                        lineWidth: 1
                    },
                },
                y: {
                    beginAtZero: true,
                    ticks: {
                        maxTicksLimit: 6,
                        color: '#cacacaff'
                    },
                    grid: {
                        color: '#cacacaff',
                        borderColor: '#cacacaff',
                        lineWidth: 1
                    }
                }
            }
        }
    }
};