

var oilCanvas = document.getElementById("DmarcChart");
Chart.defaults.global.defaultFontFamily = "Lato";
Chart.defaults.global.defaultFontSize = 11;
var oilData = {
    labels: [
        "Verified",
        "No-DMARC",
        "Unverified"
        
        
    ],
    datasets: [
        {
            data: [33, 56, 11],
            backgroundColor: [
                "#4F935C",
                "#EBA41F",
                "#DC3912"
             
            ]
        }]
};

var pieChart = new Chart(oilCanvas, {
  type: 'pie',
  data: oilData
});







var ctx = document.getElementById("GooglePostmaster").getContext('2d');
var myChart = new Chart(ctx, {
	type: 'bar',
	data: {
		labels: ["02/11","02/15","02/15","02/15","02/15","02/15","02/15","02/15","02/15"],
		datasets: [{
			label: 'High',
			backgroundColor: "#4F935C",
			data: [0, 10, 5, 26, 58, 12, 59, 87, 45],
		}, {
			label: 'Medium',
			backgroundColor: "#EBA41F",
			data: [0, 12, 15, 11, 58,12, 59, 85, 23],
		}, {
			label: 'Low',
			backgroundColor: "#DC443B",
			data: [0, 6, 25, 30, 58,12, 59, 65, 51],
		}, {
			label: 'Bad',
			backgroundColor: "#800000",
			data: [54, 6, 25, 6, 58, 12, 59, 12, 74],
		},
        {
			label: 'No-Response ',
			backgroundColor: "#6C6C6C",
			data: [12, 2, 15, 26, 58, 12, 59, 12, 74],
		}],
	},
options: {
    tooltips: {
      displayColors: true,
      callbacks:{
        mode: 'y',
      },
    },
    scales: {
      xAxes: [{
        stacked: true,
        gridLines: {
          display: true,
        }
      }],
      yAxes: [{
        stacked: true,
        ticks: {
            min: 0,
            max: 100,
            callback: function(value){return value+ "%"}
        },
        type: 'linear',
      }]
    },
		responsive: true,
		maintainAspectRatio: true,
		legend: { position: 'bottom' },
	}
});



var ctx = document.getElementById("MicrosoftSNDS").getContext('2d');
var myChart = new Chart(ctx, {
	type: 'bar',
	data: {
		labels: ["02/11","02/15","02/15","02/15","02/15","02/15","02/15","02/15","02/15"],
		datasets: [{
			label: 'Green',
			backgroundColor: "#4F935C",
			data: [30, 55, 5, 30, 40, 12, 40, 15, 45],
		}, {
			label: 'Yellow',
			backgroundColor: "#EBA41F",
			data: [25, 15, 15, 35, 40,12, 10, 85, 23],
		}, {
			label: 'Red',
			backgroundColor: "#DC443B",
			data: [45, 30, 80, 35, 20,12, 50, 0, 32],
		}],
	},
options: {
    tooltips: {
      displayColors: true,
      callbacks:{
        mode: 'y',
      },
    },
    scales: {
      xAxes: [{
        stacked: true,
        gridLines: {
          display: true,
        }
      }],
      yAxes: [{
        stacked: true,
        ticks: {
            min: 0,
            max: 100,
            callback: function(value){return value+ "%"}
        },
        type: 'linear',
      }]
    },
		responsive: true,
		maintainAspectRatio: true,
		legend: { position: 'bottom' },
	}
});






var ctx = document.getElementById("SenderScore").getContext('2d');
var myChart = new Chart(ctx, {
	type: 'bar',
	data: {
		labels: ["02/11","02/15","02/15","02/15","02/15","02/15","02/15","02/15","02/15"],
		datasets: [{
			label: 'Good Score',
			backgroundColor: "#4F935C",
			data: [100, 55, 5, 30, 40, 12, 40, 15, 45],
		}, {
			label: 'Fair Score',
			backgroundColor: "#EBA41F",
			data: [0, 15, 15, 35, 40,12, 10, 85, 23],
		}, {
			label: 'Poor Score',
			backgroundColor: "#DC443B",
			data: [0, 30, 80, 35, 20,12, 50, 0, 32],
		}],
	},
options: {
    tooltips: {
      displayColors: true,
      callbacks:{
        mode: 'y',
      },
    },
    scales: {
      xAxes: [{
        stacked: true,
        gridLines: {
          display: true,
        }
      }],
      yAxes: [{
        stacked: true,
        ticks: {
            min: 0,
            max: 100,
            callback: function(value){return value+ "%"}
        },
        type: 'linear',
      }]
    },
		responsive: true,
		maintainAspectRatio: true,
		legend: { position: 'bottom' },
	}
});




    
            
function copy(text, target) {
    setTimeout(function() {
    $('#copied_tip').remove();
    }, 800);
    $(target).append("<div class='tip' id='copied_tip'>Copied!</div>");
    var input = document.createElement('input');
    input.setAttribute('value', text);
    document.body.appendChild(input);
    input.select();
    var result = document.execCommand('copy');
    document.body.removeChild(input)
    return result;
    }
     //exporte les données sélectionnées
     var $table = $('#table');
     $(function () {
         $('#toolbar').find('select').change(function () {
             $table.bootstrapTable('refreshOptions', {
                 exportDataType: $(this).val()
             });
         })
     })
     
         var trBoldBlue = $("table");
     
     $(trBoldBlue).on("click", "tr", function (){
             $(this).toggleClass("bold-blue");
     });


   

     function edit_row(no)
{
 document.getElementById("edit_button"+no).style.display="none";
 document.getElementById("save_button"+no).style.display="block";
	
 var name=document.getElementById("name_row"+no);
 var country=document.getElementById("country_row"+no);
 var age=document.getElementById("age_row"+no);
	
 var name_data=name.innerHTML;
 var country_data=country.innerHTML;
 var age_data=age.innerHTML;
	
 name.innerHTML="<input type='text' id='name_text"+no+"' value='"+name_data+"'>";
 country.innerHTML="<input type='text' id='country_text"+no+"' value='"+country_data+"'>";
 age.innerHTML="<input type='text' id='age_text"+no+"' value='"+age_data+"'>";
}

function save_row(no)
{
 var name_val=document.getElementById("name_text"+no).value;
 var country_val=document.getElementById("country_text"+no).value;
 var age_val=document.getElementById("age_text"+no).value;

 document.getElementById("name_row"+no).innerHTML=name_val;
 document.getElementById("country_row"+no).innerHTML=country_val;
 document.getElementById("age_row"+no).innerHTML=age_val;

 document.getElementById("edit_button"+no).style.display="block";
 document.getElementById("save_button"+no).style.display="none";
}

function delete_row(no)
{
 document.getElementById("row"+no+"").outerHTML="";
}

function add_row()
{
 var new_name=document.getElementById("new_name").value;
 var new_country=document.getElementById("new_country").value;
 var new_age=document.getElementById("new_age").value;
	
 var table=document.getElementById("data_table");
 var table_len=(table.rows.length)-1;
 var row = table.insertRow(table_len).outerHTML="<tr id='row"+table_len+"'><td id='name_row"+table_len+"'>"+new_name+"</td><td id='country_row"+table_len+"'>"+new_country+"</td><td id='age_row"+table_len+"'>"+new_age+"</td><td><input type='button' id='edit_button"+table_len+"' value='Edit' class='edit' onclick='edit_row("+table_len+")'> <input type='button' id='save_button"+table_len+"' value='Save' class='save' onclick='save_row("+table_len+")'> <input type='button' value='Delete' class='delete' onclick='delete_row("+table_len+")'></td></tr>";

 document.getElementById("new_name").value="";
 document.getElementById("new_country").value="";
 document.getElementById("new_age").value="";
}