I'm curious about why my chart is not aligned to the left and how I can fix this issue. Here is the code snippet I am working with:
var data = {
labels: ["ID"]
, datasets: [
{
label: "Sensor 1"
, data: [{
x: 0
, y: 2
}, {
x: 12
, y: 5
}]
, backgroundColor: [
'rgba(255, 99, 132, 0.2)'
, ]
, borderColor: [
'rgba(255,99,132,1)'
]
, borderWidth: 1
}
]
};
var options = {
title: {
display: true
, text: 'Custom Chart Title'
}
, scales: {
yAxes: [{
ticks: {
beginAtZero: true
}
}]
, xAxes: [{
type: "linear"
, position: "bottom"
}]
}
};
var myLineChart = Chart.Line(ctx, {
data: data
, options: options
});
The line seems to be starting in the center of the graph instead of aligning to the left on the x-axis. This is a visual representation of the issue:
In addition, there appears to be a discrepancy between the y-axis and the dataset values that I have entered.
Edit: After some adjustments, I was able to resolve the alignment problem by updating the code.