//예측 차트 옵션 2020.05.**************** kgpark
$(function () {
    BWA.ChartOptions = BWA.ChartOptions || {};
    var C = BWA.ChartOptions.PlanConsumeRegressionDevelopment = BWA.ChartOptions.PlanConsumeRegressionDevelopment || {};

    var series = [{
        type: 'spline',
        pane: 'topPane',
        //axis: 'DayAhead',
        valueField: 'DayAheadValue',
        visible: true, // 시리즈만 안보이게 할수 있다. 대신 그렇게 할려면 시작은 false로 해야 한다 hcLee 2015 04 25
        point: { size: 8 },
        color: '#ff3399',
        name: '하루 전 예측',
        label: {
            visible: false,
            customizeText: function () {
                return this.valueText + ' kWh';
            }
        }
    }, {
        type: 'spline',
        pane: 'topPane',
        //axis: 'HourAhead',
        valueField: 'HourAheadValue',
        visible: true,
        color: '#000080',
        point: { size: 8 },
        name: '한시간 전 예측',
        label: {
            visible: false,
            customizeText: function () {
                return this.valueText + ' kWh';
            }
        }
    }];

    var ObservedSeries = [{
        type: 'bar',
        pane: 'topPane',

        valueField: 'ObservedValue',
        name: '실 데이터',
        label: {
            horizontalAlignment: 'left',
            visible: false,
            customizeText: function () {
                return this.valueText + 'kWh';
            }
        }
    }];

    C.getSeriesOptions = function () {

        return {
            palette: 'Harmony Light',
            valueAxis: {
                pane: 'topPane',
                title: {
                    text: $G('electricityConsumptionUsageWithUnit')
                },
                grid: {
                    visible: true,
                },
                showZero: true,
            },
            series: [ObservedSeries[0]].concat(series),            
            argumentAxis: BWA.Chart.getTimeLineArgumentAxis(moment(), $Code.TimeType.QUARTERMIN),
        };
    };

    C.getChartOptions = function () {
        return {

            legend: {
                visible: true,
                verticalAlignment: 'top',
                horizontalAlignment: 'center',
            },
            
            argumentAxis: BWA.Chart.getTimeLineArgumentAxis(moment(), $Code.TimeType.QUARTERMIN),
            commonSeriesSettings: {
                argumentField: "DateTime",
                selectionStyle: {
                    hatching: {
                        direction: "right"
                    }
                }
            },

            panes: [{
                name: 'topPane',
                border: {
                    visible: false,
                    left: false,
                    right: false,
                    top: false,
                    color: 'gray'
                }
            }, ],
            defaultPane: "topPane",
            customizePoint: function () {
            },

            tooltip: {
                enabled: true,
                format: 'fixedPoint',
                precision: 2,
                shared: true,
                argumentFormat: 'shortDate',
                customizeTooltip: function (point) {
                    return {
                        text: "[" + point.argument.format("yy-MM-dd HH:mm") + "]" + "<br/>" + "<br/>" + point.valueText
                    };
                }
            },
            crosshair: {
                enabled: true,
                width: 2,
                horizontalLine: {
                    dashStyle: 'dash',
                    visible: false
                },
                verticalLine: {
                    dashStyle: 'dash',
                    color: 'gray'
                },
                label: {
                    visible: false,
                    backgroundColor: "#949494",
                    font: {
                        color: "#fff",
                        size: 12,
                    }
                }
            }
        };
    };
});