我有一個數(shù)據(jù)集值未顯示在double-yAxes圖表中。我有使用雙重?cái)?shù)據(jù)集和雙重yAxes的通用Chart.js代碼。但是,一個數(shù)據(jù)集未在圖表上正確顯示。“溫度”值的范圍在66到78之間,盡管我使用的是最小/最大范圍值,但似乎“不在圖表之列”。在JSFiddle上查看我的代碼<div style="width:75%"> <canvas class=".content" id="myChart" ></canvas></div><Script>var canvas = document.getElementById('myChart').getContext('2d');// @ts-ignorevar myChart = new Chart(canvas, { options: { scales: { yAxes: [ { id: 'SG', //type: 'linear', position: 'left', ticks: { min: 1, max: 1.1 } }, { id: 'Temp', //type: 'linear', position: 'right', ticks: { min: 32, max: 100 } } ] } }, type: 'bar', //not really needed, over-ridden below data: { labels: ['Mon', 'Tues', 'Wed', 'Thurs', 'Fri'], datasets: [{ label: 'Gravity', yAxesID: 'SG', data: [1.07, 1.045, 1.030, 1.014, 1.012], backgroundColor: '#ff6384' //red }, { //type: 'line', label: 'Temp F', yAxesID: 'Temp', data: [78, 66, 78, 66, 76], backgroundColor: '#36a2eb' //blue }] }});</Script>也許我缺少特定于雙yAxes圖表的東西...
第二個yAxes值無法使用Chart.js正確繪制圖表
有只小跳蛙
2021-03-29 16:14:00