簡體   English   中英

如何編輯 laravel/chart.js 箱線圖的 label 和 x 軸?

[英]How do I edit the label and x-axis of a laravel/chart.js boxplot?

Chart.js Laravel 中前端繪圖的翻譯。有 3 個月的日期及其數據的產量。 我應該如何適應重疊的 charjs 而不是所有日期都寫在 x 的末尾? (文本重疊,我不想要它,我希望所有日期都在 x 軸上,我認為 chartjs 跳過它是因為放不下它。)重要的是你能聯系我嗎

在此處輸入圖像描述

 var myChart1 = new Chart(ctx1, {
        type: 'bar',
        data: {
                labels: dates,
                datasets: [{
        label: 'BACKLOG ON HOLD INCIDENTS AVG PERFORMANCE- BURSA',
        data: results,
        backgroundColor: [
            'rgba(76, 196, 23, 0.6)'

        ],
        borderColor: [
            'rgba(219, 249, 219, 1)',

        ],
        borderWidth: 1,
                }]
        },
        plugins: [ChartDataLabels],
        options: {

                plugins:{
                legend:{
                        display:true
                },
        datalabels:{
                color:'blue',
                anchor:'end',
        font:{
                weight:'bold',
                size:8
             }
                  }
        },
        scales: {
        y: {
            beginAtZero: true
           },
        x: {
            ticks: {
                maxRotation: 90,
                minRotation: 90,
                font: {
                size: 8,
            }
            }
           }
        },
        animation: {
            duration: 0
        }
        }
    });

要垂直顯示標簽,請將ticks.maxRotationticks.minRotation選項設置為 90 度。

options: {
  scales: {
    x: {
      ticks: {
        maxRotation: 90,
        minRotation: 90
      }
    }
  }
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM