javascript - แผนภูมิแท่ง Highcharts หายไปเมื่ออัปเกรดจาก 10.2.1 เป็น 10.3.1
ฉันกำลังพยายามอัปเกรด Highcharts เป็นเวอร์ชันล่าสุด แต่ประสบปัญหา
ฉันมีแผนภูมิแท่งพร้อมการตั้งค่าดังต่อไปนี้:
{
chart: {
type: 'bar',
height: 70,
pointPadding: 0,
},
title: {
text: null,
},
credits: {
enabled: false,
},
xAxis: {
type: 'datetime',
visible: false,
},
yAxis: {
type: 'datetime',
min: startTime,
max: endTime,
visible: true,
opposite: false,
endOnTick: true,
ordinal: false,
minPadding: 0,
maxPadding: 0,
tickInterval: tickIntervalMs,
minTickInterval: tickIntervalMs,
reversedStacks: false,
title: {
text: null,
},
labels: {
style: {
color: mfTheme.colorPalette.n500,
},
// This makes sure that the times are displayed in the correct timezone
formatter() {
return moment((this as any).value)
.tz(institutionTimezone)
.format('LT');
},
},
},
time: {
timezone: institutionTimezone,
moment,
},
legend: {
enabled: false,
},
tooltip: {
borderWidth: 0,
borderRadius: 24,
backgroundColor: '#FFFFFF',
},
plotOptions: {
series: {
stacking: 'normal',
pointWidth: 50,
groupPadding: 0,
pointPadding: 0,
borderWidth: 0,
},
},
series,
}
}
และมันแสดงผลได้สมบูรณ์แบบจนถึงเวอร์ชัน 10.2.1
อย่างไรก็ตาม เมื่ออัปเดตเป็น Highcharts 10.3.1 แท่งกราฟก็หายไป แสดงอะไรเลย (ไม่ต้องการสกรีนช็อต มันเป็นสีขาวทั้งหมด)
เมื่อทำการตรวจสอบกราฟ พบว่า องค์ประกอบทั้งหมดมีความสูงและความกว้างเป็น 0
ฉันกำลังรันสิ่งนี้ด้วย highcharts-react-official
ฉันไปไกลถึงขั้นตรวจสอบการเปลี่ยนแปลง PR ในบันทึกการอัปเดต แต่ก็ไม่พบ PR เดียวที่สามารถให้เบาะแสกับฉันได้ว่าสิ่งใดจริงๆ ที่ผิดพลาดในเวอร์ชันใหม่
ฉันจะทำให้กราฟปรากฏขึ้นมาอีกครั้งได้อย่างไร?
codesandbox ที่สามารถทำซ้ำได้:
https://codesandbox.io/p/sandbox/highcharts-react-demo-forked-s82pdf?file=%2Fdemo.jsx
คำตอบ #1
yAxis.min ควรเป็นตัวเลขตาม API ผมไม่แน่ใจว่าทำไมถึงใช้งานได้ในเวอร์ชันก่อนหน้า อาจจะเป็นช่องว่างในการกำหนดชนิดข้อมูลที่ได้รับการแก้ไขไปแล้ว วิธีที่ถูกต้องในการระบุค่าต่ำสุดของ yAxis คือ ตัวอย่างเช่น ค่าตัวเวลา (timestamp) เหมือนกับที่คุณมีในกรณีของ yAxis.max
สาธิต: https://codesandbox.io/p/sandbox/highcharts-react-demo-forked-5623sy?file=%2Fdemo.jsx%3A31%2C1
เอกสารอ้างอิง API: https://api.highcharts.com/highcharts/yAxis.min
