मैं बार चार्ट के बार के केंद्र के साथ चार्ट.जेएस v2.2 का उपयोग करके जेनरेट किए गए समय स्केल लेबल को संरेखित करने का प्रयास कर रहा हूं। मैंने ऑफ़सेट ग्रिडलाइन विकल्प का प्रयास किया है लेकिन एक्सएक्सिस स्केल प्रकार के समय का उपयोग करते समय ऐसा कोई प्रभाव नहीं पड़ता है।chart.js v2: बार के केंद्र के साथ समय स्केल लेबल संरेखित करें
<div id="container" style="width: 75%;">
<canvas id="canvas"></canvas>
</div>
<script>
var barChartData = {
labels: ["2015-01-01", "2015-02-01", "2015-03-01", "2015-04-01", "2015-05-01", "2015-07-01"],
datasets: [{
label: 'Dataset 1',
backgroundColor: "rgba(220,220,220,0.5)",
data: [10, 4, 5, 7, 2, 3]
}]
};
window.onload = function() {
var ctx = document.getElementById("canvas").getContext("2d");
window.myBar = new Chart(ctx, {
type: 'bar',
data: barChartData,
options: {
elements: {
rectangle: {
borderWidth: 2,
borderColor: 'rgb(0, 255, 0)',
borderSkipped: 'bottom'
}
},
responsive: true,
legend: {
position: 'top',
},
title: {
display: true,
text: 'Chart.js Bar Chart'
}
,
scales: {
xAxes: [{
categoryPercentage: .5,
barPercentage: 1,
type: 'time',
scaleLabel: {
display: true,
labelString: 'Year-Month'
},
time: {
min: '2014-12-01' ,
max: '2015-12-01',
unit: 'month',
displayFormats: {
month: "MMM YY"
}
},
gridLines: {
offsetGridLines: false,
drawTicks: true,
display: true
},
stacked: true
}],
yAxes: [{
ticks: {
beginAtZero: true
},
stacked: true
}]
}
}
});
};
</script>
आप इसे वास्तव में क्या केंद्र के लिए यह संरेखित करने के लिए एक छोटे से को कम किया जा सका के केंद्र में डेटा लेबल जगह मदद मिल सकती है? – Undrium