// サイトごとの比較
var ctx = document.getElementById('myChartkakusa').getContext('2d');
var chart = new Chart(ctx, {
    type: "bar",
    data: {
        labels:  ["2015", "2016", "2017", "2018", "2019", "2020"],  // Ｘ軸のラベル
        datasets: [
            {   // 男性
                label: "年収200万以下",
                data: [11, 12,  16, 23, 25, 33],      
                backgroundColor: "#1e90ff",
            },
            {   // 女性                                           
                label: "年収1000万以上",                             
                data: [11,11,11,12,15,22],                 
                backgroundColor: "#ff1493"                     
            }                                               
        ]
    },
    options: {
        responsive: true, 
        maintainAspectRatio: false,
        title: { 
            display: true,
            fontSize: 20,
            text: "格差推移"
        },
        legend: { 
            position: 'bottom'
        },                
        scales: {
            yAxes: [{
                ticks: {
                    callback: function(value, index, values) {
                        return value + '%';
                    } 
                }
                    
            }]
        },
        plugins: {
        datalabels: {
            font: {
                size: 14 
            },
            color: '#484848',
            align: 'end',
            anchor: 'end',
            formatter: function (value, context) {
                return value + '%';   // 単位
            }
        }
        }
    }
});

