$(function() {
    "use strict";

    // progress bars
    $('.progress .progress-bar').progressbar({
            display_text: 'none'
    });

    $('.sparkbar').sparkline('html', { type: 'bar' });

    $('.sparkline-pie').sparkline('html', {
        type: 'pie',
        offset: 90,
        width: '100px',
        height: '100px',
        sliceColors: ['#29bd73', '#182973', '#ffcd55']
    })


    // top products
    var dataStackedBar = {
            labels: ['D1','D2','D3','D4','D5'],
            series: [
                [10,5,6,12,15],
            ]
    };
    new Chartist.Bar('#chart-top-products', dataStackedBar, {
            height: "255px",
            stackBars: true,
            axisX: {
                showGrid: false
            },
            axisY: {
                labelInterpolationFnc: function(value) {
                    return (value) + 'P';
                }
            },
            plugins: [
                Chartist.plugins.tooltip({
                    appendToBody: true
                }),
                Chartist.plugins.legend({
                    legendNames: ['completé',]
                })
            ]
    }).on('draw', function(data) {
            if (data.type === 'bar') {
                data.element.attr({
                    style: 'stroke-width: 35px'
                });
            }
    });


    // notification popup
    toastr.options.closeButton = true;
    toastr.options.positionClass = 'toast-bottom-right';
    toastr.options.showDuration = 1000;
    toastr['info']('Hello, welcome to HexaBit, a unique admin Template.');

    var chart = c3.generate({    

        bindto: '#User_Statistics', // id of chart wrapper
        data: {
            columns: [
                // each columns data
                ['data1', 7, 7, 10, 14, 18, 22, 25, 26, 23, 18],
                ['data2', 4, 4, 6, 9, 12, 15, 17, 17, 14, 10],
                ['data3', 14, 10, 12, 15, 17, 17, 7, 5, 4, 4]
            ],
    
            labels: true,
            type: 'line', // default type of chart
            colors: {
                'data1': hexabit.colors["orange"],
                'data2': hexabit.colors["green"],
                'data3': hexabit.colors["gray-light"]
            },
            names: {
                // name of each serie
                'data1': 'Complet',
                'data2': 'En cours',
                'data3': 'Annulé'
            }
        },
    
        axis: {
            x: {
                type: 'category',
                // name of each category
                categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'July', 'Aug','Sept','Oct']
            },
        },
    
        legend: {
            show: true, //hide legend
        },
    
        padding: {
            bottom: 10,
            top: 0
        },
    });
});