function Dashboard() {

    "use strict";

    var self = this;

    this.handleInteractiveChart = function() {
        "use strict";
    
        function e(e, t, n) {
            $('<div id="tooltip" class="flot-tooltip">' + n + "</div>").css({
                top: t - 45,
                left: e - 55
            }).appendTo("body").fadeIn(200)
        }
        if ($("#interactive-chart").length !== 0) {
            console.log("innn")
            console.log(chartdata)
             var obj = JSON.parse(chartdata);
             var t=obj[1];
             var n=obj[2];
             var r=obj[0];
            $.plot($("#interactive-chart"), [{
                data: t,
                label: "Users",
                color: "#348fe2",
                lines: {
                    show: true,
                    fill: false,
                    lineWidth: 2
                },
                points: {
                    show: true,
                    radius: 3,
                    fillColor: "#fff"
                },
                shadowSize: 0
            }, {
                data: n,
                label: "Subscriber",
                color: "#00acac",
                lines: {
                    show: true,
                    fill: false,
                    lineWidth: 2
                },
                points: {
                    show: true,
                    radius: 3,
                    fillColor: "#fff"
                },
                shadowSize: 0
            }], {
                xaxis: {
                    ticks: r,
                    tickDecimals: 0,
                    tickColor: "#ddd"
                },
                // yaxis: {
                    // ticks: 10,
                    // tickColor: "#ddd",
                    // min: 0,
                    // max: 10
                // },
                grid: {
                    hoverable: true,
                    clickable: true,
                    tickColor: "#ddd",
                    borderWidth: 1,
                    backgroundColor: "#fff",
                    borderColor: "#ddd"
                },
                legend: {
                    labelBoxBorderColor: "#ddd",
                    margin: 10,
                    noColumns: 1,
                    show: true
                }
            });
            var i = null;
            $("#interactive-chart").bind("plothover", function(t, n, r) {
                $("#x").text(n.x.toFixed(2));
                $("#y").text(n.y.toFixed(2));
                if (r) {
                    if (i !== r.dataIndex) {
                        i = r.dataIndex;
                        $("#tooltip").remove();
                        var s = r.datapoint[1];
                        var o = r.series.label + " " + s;
                        e(r.pageX, r.pageY, o)
                    }
                } else {
                    $("#tooltip").remove();
                    i = null
                }
                t.preventDefault()
            })
        }
    };
}

$(document).ready(function() {
    var dashboard = new Dashboard();
    dashboard.handleInteractiveChart();
});