With the amcharts4 I do something like this for the change tooltip and label text for the x axis with the CategoryAxis...
// change tooltip
this.xAxis.adapter.add("getTooltipText", (text, target) => {
const value = text ? parseInt(text) : -1;
return this.getAxisToolTipText(value);
});
// change label
this.xAxis.renderer.labels.template.adapter.add("text", (text, target) => {
const value = target.dataItem && target.dataItem.category ? parseInt(target.dataItem.category) : -1;
return this.getAxisText(value, text);
});
But now, how to do the same for the Amcharts5 with DateAxis?
I will appreciate any suggestions.
Use adapters to dynamically modify setting value of its target element.
xAxis.get("renderer").labels.template.adapters.add("html", function(html, target) {
return "<div style=\"text-align: center; font-weight: bold;\">{value.formatDate('d MMM')}</div><div style=\"text-align: center;\">{value.formatDate('EEE')}</div>";
});
xAxis.get("tooltip").adapters.add("labelText", function(text, target) {
return "Custom text";
});