Linechart: NaN values are not skipped when type: 'logarithmic' is used
See original GitHub issueExpected Behavior
NaN
datapoint should be skipped (there should be gap).
Current Behavior
NaN
datapoint is displayed as a zero value.
Steps to Reproduce (for bugs)
<html>
<body>
<div class="myChartDiv">
<canvas id="myChart" width="600" height="400"></canvas>
</div>
</body>
</html>
var ctx = document.getElementById("myChart");
var myChart = new Chart(ctx, {
type: 'line',
data: {
labels: ["Red", "Blue", "Yellow", "Green", "Purple", "Orange"],
datasets: [{
label: '# of Votes',
data: [12, 19, NaN, 5, 2, 3]
}]
},
options: {
scales: {
yAxes: [{
type: 'logarithmic',
ticks: {
beginAtZero:true
}
}]
}
}
});
Using spanGaps
has no effect. There is no bug when type: 'logarithmic',
is removed:
Environment
- Chart.js version: v2.9.3
- Browser name and version: Google Chrome 79.0.3945.88 (Official Build) (64-bit)
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (2 by maintainers)
Top Results From Across the Web
Chart js logarithmic line chart showing NaN values instead of ...
I've made a simple line chart to test the empty values. But in my test, the values are not shown in the graph....
Read more >It's not possible to add data points with no value ('null') to a ...
[Charts] Support "missing value": It's not possible to add data points ... However it is not possible to use a LineChart for that...
Read more >A Line chart may plot gaps in lines when the data range ...
Describes an issue where the lines of a Line chart may plot with gaps when the data ... Use the NA function in...
Read more >Broken Y Axis in an Excel Chart - Peltier Tech
A better suggestion than either a log scale or a broken axis is to plot ... In this chart, the gradient at the...
Read more >Line Chart - Google Developers
It is not supported by the Annotation Chart . Type: object. Default: null. axisTitlesPosition. Where to place the axis titles, compared to the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Samples are here: https://www.chartjs.org/samples/master/
I am still experiencing this behavior in my code. I am setting blank values to NaN. Any ideas?