import { Globals } from "../../app/app.globals";
export class Line {

    constructor() {
        this.height = null;
        this.title = null;
        this.series = [];
        this.size = null;
        this.width = null;
        this.yTitle = '%';
        this.xTitle = '';
        this.subtitle = null;
        this.categories = null;
        this.yMin = 0;
        this.yMax = 100;
        this.type = 'line';
        this.export = false;
        this.drilldown = false;
        this.legend = true;
        this.stacking = null;
        this.stackLabels = false;
        this.grouping = true;
        this.metrica = 'Hr.'
        this.pointWidth = undefined;
        this.enableYaxis = true;
        this.configStackLabels = ['white', 'normal'];
        this.headerTooltip = '<span style="font-size:15px">{point.key}</span><br>';
        this.bodyTooltip = '<span class= "uk-center" style="font-size:13px"><span  class=" uk-text-bold" style="color:{point.color};">■ </span><span>{series.name}: </span>{point.y:.' + Globals.CANTDECIMALES + 'f}' + this.metrica + '</span><br>';
        this.minRange = 1;
        this.axisType = 'datetime';
        this.visible = true;
        this.pointer = null;
        this.legendProp = [false, 'bottom', 0];
    }

    setMetrica(metrica) {
        this.metrica = metrica;
    }

    setSeries(series) {
        this.series = series;
    };

    setHeight(height) {
        this.height = height;
    };

    setWidth(width) {
        this.width = width;
    };

    setTitle(title) {
        this.title = title;
    };

    setYMin(yMin) {
        this.yMin = yMin;
    };

    setYMax(yMax) {
        this.yMax = yMax;
    };

    setCategories(categories) {
        this.categories = categories;
    };

    setYTitle(yTitle) {
        this.yTitle = yTitle;
    };

    setSubtitle(subtitle) {
        this.subtitle = subtitle;
    };

    setType(type) {
        this.type = type;
    };

    setExport(exporting) {
        this.export = exporting;
    };

    setDrilldownEvent(drilldown) {
        this.drilldown = drilldown;
    };

    setLegend(legend) {
        this.legend = legend;
    };

    setStacking(stacking) {
        this.stacking = stacking;
    };

    setStackLabels(labels) {
        this.stackLabels = labels;
    };

    setGrouping(grouping) {
        this.grouping = grouping;
    };

    setPointWidth(point) {
        this.pointWidth = point;
    };

    setEnabledYAxis(enabled) {
        this.enableYaxis = enabled;
    };

    setConfigStackLabels(enabled) {
        this.configStackLabels = enabled;
    };

    setMinRange(min) {
        this.minRange = min;
    };

    setAxisType(axisType) {
        this.axisType = axisType;
    };
    setAxisVisible(visible) {
        this.visible = visible;
    };
    setLegendProperties(float, vAlign, y) {
        this.legendProp = [float, vAlign, y];
    }

    Draw() {

        var columnDefaultChart = {
            chart: {
                type: this.type
            },
            title: {
                text: this.title
            },
            subtitle: {
                text: this.subtitle
            },
            xAxis: {
                categories: this.categories
            },
            yAxis: {
                title: {
                    text: this.yTitle
                }
            },
            legend: {
                enabled: false
            },
            plotOptions: {
                // line: {
                //     dataLabels: {
                //         enabled: true
                //     },
                //     enableMouseTracking: false
                // }
                series: {
                    label: {
                        connectorAllowed: false
                    },
                }
            },
            series: this.series
            
        };

        return columnDefaultChart;
     
    };

}