I am working with AMChart version3. I need to hide the bullets based on value. But somehow nothing work. Please help me to hide the bullets. Below is my code.
Basically i want to hide if percentage value is zero. But it show all.
function drawChart(chartData) {
chartData.forEach(obj => {
obj.height = parseFloat(obj.height);
});
const highestError = Math.max(...chartData.map(obj => obj.percentage));
const lowestError = Math.min(...chartData.map(obj => obj.percentage));
const maxAbsoluteError = Math.max(Math.abs(highestError), Math.abs(lowestError));
const buffer = 4; // Adjust the buffer value as needed
const yAxisMinimum = -Math.ceil((maxAbsoluteError + buffer) / 5) * 5;
const yAxisMaximum = Math.ceil((maxAbsoluteError + buffer) / 5) * 5;
AmCharts.makeChart("atg-calibration-report-chart", {
"theme": "none",
"type": "serial",
"dataProvider": chartData,
"valueAxes": [{
"position": "left",
"title": "",
"minimum": yAxisMinimum,
"maximum": yAxisMaximum,
"integersOnly": true,
"axisAlpha": 0,
"labelFunction": function(value) {
return value.toString() + '%';
}
}],
"graphs": [{
"type": "line",
"valueField": "percentage",
"bullet": "round",
"bulletSize": 8, // Adjust bullet size as needed
"balloonText": "[[category]] meter: <b>[[value]]%</b>",
"lineAlpha": 0, // Set lineAlpha to 0 to hide the line
"lineThickness": 0, // Set lineThickness to 0 to hide the line between the dots
"listeners": [{
"event": "drawn",
"method": function(event) {
console.log('sdksdjskjkjk')
if (event.dataItem.dataContext.percentage === 0 || event.dataItem.dataContext.percentage === null) {
event.event.target.hideBullet();
}
}
}]
}],
"categoryField": "height",
"categoryAxis": {
"autoGridCount": false, // Disable automatic grid count calculation
"gridCount": 11, // Set the desired number of grid lines
"gridPosition": "start", // Position the grid lines at the beginning of each category
"labelFunction": function(valueText, serialDataItem, categoryAxis) {
// Custom label function to format decimal values as integers
return Math.round(parseFloat(valueText)).toString();
},
"maximum": 10 // Set the maximum value for the category axis
},
"export": {
"enabled": true
}
});
}
Any solution appeciated