-
Notifications
You must be signed in to change notification settings - Fork 11.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Setting xAxes type to linear causes line chart to not be drawn #4687
Comments
@mscheker linear x axes only work with scatter data. An example of this is http://www.chartjs.org/samples/latest/charts/scatter/basic.html If you want to use |
@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. |
@mscheker that's not possible based on the labels. I think this will convert the data to a format that works for a scatter chart function convertData(data) {
var newData = {};
newData.datasets = data.datasets.map((dataset) => {
return {
label: dataset.label,
data: dataset.data.map((d, i) => {
return {
x: data.labels[i],
y: d
}
})
};
});
return newData;
} |
Got it. Thanks for your help @etimberg! |
If I want to use it for line chart then what type i need to give |
if i use solution etimberg , i have probleme type |
I have the following simple line chart:
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.
The text was updated successfully, but these errors were encountered: