MYMEMORY WARNING: YOU USED ALL AVAILABLE FREE TRANSLATIONS FOR TODAY. NEXT AVAILABLE IN 23 HOURS 56 MINUTES 52 SECONDS VISIT HTTPS://MYMEMORY.TRANSLATED.NET/DOC/USAGELIMITS.PHP TO TRANSLATE MORE
MYMEMORY WARNING: YOU USED ALL AVAILABLE FREE TRANSLATIONS FOR TODAY. NEXT AVAILABLE IN 23 HOURS 56 MINUTES 51 SECONDS VISIT HTTPS://MYMEMORY.TRANSLATED.NET/DOC/USAGELIMITS.PHP TO TRANSLATE MORE
ticks: {
stepSize: 5,
callback: function(value, index, values) {
return getCategoryLabel(value);
}
}
MYMEMORY WARNING: YOU USED ALL AVAILABLE FREE TRANSLATIONS FOR TODAY. NEXT AVAILABLE IN 23 HOURS 56 MINUTES 49 SECONDS VISIT HTTPS://MYMEMORY.TRANSLATED.NET/DOC/USAGELIMITS.PHP TO TRANSLATE MORE
function getCategoryLabel(value) {
if ( value %5 ==0 && value %10 !=0 ) {
return ;
} else {
return value;
}
}
MYMEMORY WARNING: YOU USED ALL AVAILABLE FREE TRANSLATIONS FOR TODAY. NEXT AVAILABLE IN 23 HOURS 56 MINUTES 48 SECONDS VISIT HTTPS://MYMEMORY.TRANSLATED.NET/DOC/USAGELIMITS.PHP TO TRANSLATE MORE
<div>
<canvas id="myChart"></canvas>
</div>
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<script>
const canvas = document.getElementById( myChart );
const ctx = canvas.getContext( 2d );
var chartData = {};
var myChart = new Chart(ctx, {
type: bar ,
data: {
datasets: [{
label: Test Bar Chart ,
data: [],
backgroundColor: [ skyblue ],
borderWidth: 1
}],
labels: [ Jan , Feb , Mar , Apr , May , Jun , Jul , Aug , Sep , Oct , Nov , Dec ]
},
options: {
scales: {
y: {
beginAtZero: true,
ticks: {
stepSize: 5,
callback: function(value, index, values) {
return getCategoryLabel(value);
}
}
}
},
responsive: true,
maintainAspectRatio: true
}
});
function getCategoryLabel(value) {
if ( value %5 ==0 && value %10 !=0 ) {
return ;
} else {
return value;
}
}
function updateChart(newData) {
myChart.data.datasets[0].data = newData.allData;
myChart.update();
}
function onDataChanged() {
var newData = {
allData: [3, 2, 5, 15, 20, 10, 22, 27, 3, 2, 5, 15]
};
var addedCategories = {};
newData.allData.forEach(function(value) {
var categoryLabel = getCategoryLabel(value);
if (!addedCategories[categoryLabel]) {
addedCategories[categoryLabel] = true;
myChart.data.datasets[0].data.push(value);
}
});
updateChart(newData);
}
onDataChanged();
</script>
MYMEMORY WARNING: YOU USED ALL AVAILABLE FREE TRANSLATIONS FOR TODAY. NEXT AVAILABLE IN 23 HOURS 56 MINUTES 46 SECONDS VISIT HTTPS://MYMEMORY.TRANSLATED.NET/DOC/USAGELIMITS.PHP TO TRANSLATE MORE
MYMEMORY WARNING: YOU USED ALL AVAILABLE FREE TRANSLATIONS FOR TODAY. NEXT AVAILABLE IN 23 HOURS 56 MINUTES 44 SECONDS VISIT HTTPS://MYMEMORY.TRANSLATED.NET/DOC/USAGELIMITS.PHP TO TRANSLATE MORE