Изменение вертикальной линии и цветовой гистограммы на гистограмме. js - PullRequest
0 голосов
/ 19 июня 2020

enter image description here

помогите мне! как удалить данные numeri c на гистограмме в гистограмме js

    let datas_1 = [97,70,87,43,35,18];
    let colorHex_1 = ['#ebeef3','#ebeef3','#ebeef3','#ebeef3','#ebeef3','#ebeef3'];
    let labels_1 = ['10대','12대','30대','40대','50대','60대이상'];
    var myBarChart = new Chart(ctx_1, {
        type: 'horizontalBar',
        data: {
            datasets: [{
                data: datas_1 ,
                backgroundColor: colorHex_1,
                borderWidth: 0,
                barPercentage: 1,
            }],
            labels: labels_1,
        },
        options: {
            responsive: true,
            legend: {
                display:false,
            },
            scales: {
                xAxes: [{
                    display:false,
                }],
                yAxes: [{
                    gridLines:{
                        display:false,
                        color: "black"
                    },
                    maxBarThickness: 20,
                }]
            }
        }
    });


как удалить данные numeri c на гистограмме в гистограмме. js

1 Ответ

0 голосов
/ 19 июня 2020

Рабочая демонстрация: https://jsfiddle.net/usmanmunir/hz3gLj19/3/

Попробуйте этот код:

let datas_1 = [97,70,87,43,35,18];
let colorHex_1 = ['#ebeef3', '#ebeef3', '#ebeef3', '#ebeef3', '#ebeef3', '#ebeef3'];
let labels_1 = ['10대', '12대', '30대', '40대', '50대', '60대이상'];

var ctx = document.getElementById("myChart");

var myBarChart = new Chart(ctx, {
  type: 'horizontalBar',
  data: {
    datasets: [{
      data: datas_1,
      backgroundColor: colorHex_1,
      borderWidth: 0,
      barPercentage: 1,
    }],
    labels: labels_1,
  },
  options: {
    responsive: true,
    legend: {
      display: false,
    },
    scales: {
      xAxes: [{
        display: false,
      }],
      yAxes: [{
        gridLines: {
          display: false,
        },
        maxBarThickness: 20,
      }]
    }
  }
});

Надеюсь, это поможет.

...