-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Description
Description
Zooming on a line chart with a category x-axis throws a parsing error when the series
data contains specific floating-point values. The issue appears to be an edge case related to the library's internal y-axis calculation during a zoom operation, as slightly different numbers with similar magnitude and precision do not trigger the bug.
The chart renders correctly initially, but any attempt to zoom results in the chart breaking.
Steps to Reproduce
- Use a dataset where the
y
values are high-precision floating-point numbers. - Render the chart.
- Using the mouse, click and drag to select a zoom area on the chart.
Expected Behavior
The chart should zoom in on the selected area, displaying a smaller portion of the x-axis and automatically adjusting the y-axis scale to fit the new data range.
Actual Behavior
The chart does not zoom. The chart area goes blank, and a parsing error is thrown in the browser's developer console. The chart becomes unresponsive.
// ---- CHART: This chart breaks when you try to zoom ----
var options = {
chart: {
height: 380,
width: "100%",
type: "line"
},
series: [
{
name: "Series 1",
data: [{
x: '01',
y: 64988490.28799998
}, {
x: '02',
y: 56735215.25399999
},{
x: '03',
y: 58393662.376999974
},{
x: '04',
y: 50861725.758
},{
x: '05',
y: 53127694.96699999
}],
}
]
};
var chart = new ApexCharts(document.querySelector("#chart"), options);
chart.render();
CodePen link: https://codepen.io/mamcgc/pen/JoGdOrZ