Setting xAxes type to linear causes line chart to not be drawn
See original GitHub issueI have the following simple line chart:
<canvas id="myChart"></canvas>
var ctx = document.getElementById('myChart').getContext('2d');
var chart = new Chart(ctx, {
type: 'line',
data: {
datasets: [{
label: "My First dataset",
data: [1, 2, 3, 20],
}],
labels: [1, 2, 10, 20],
},
options: {
scales: {
xAxes: [{
display: true,
type: 'linear',
position: 'bottom',
ticks: {
min: 0,
stepSize: 1
}
}],
}
}
});
Whenever the xAxes type is set to linear
, the line chart is no longer drawn within the chart. Here is a fiddle showing the issue. I am using the latest version, 2.6.0.
I have looked on SO and through the issues reported but haven’t found a way to get this to work.
Thanks in advance for your assistance.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:4
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Chart.js xAxis linear scale : strange behavior - Stack Overflow
This just draws a vertical line for me... and the linked page shows completely different code, without {x,y} objects in data. – riv....
Read more >Linear Axis - Chart.js
The linear scale is used to chart numerical data. It can be placed on either the x or y-axis. The scatter chart type...
Read more >Change the scale of the horizontal (category) axis in a chart
How to change the scale of the horizontal or X) axis of a chart. ... based on data determines the axis type that...
Read more >Creating chart in Excel where data for X-axis (horizontal) is ...
What I'd like to do with MS-Excel is to plot 2 curves, one that treats values in col. 'X' as horizontal axis data,...
Read more >Line chart options | Looker - Google Cloud
Overview of visualization menu options for line charts. ... charts with various measure types so long as they are not combined (such as...
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
@etimberg Thank you for your response. If I have data as follows:
Is there a way to set the axis’ stepSize so it displays the ticks from min to max (0-20 - based on the labels), for example? If not, I’ll try to change the dataset if need be.
Thanks again.
if i use solution etimberg , i have probleme type