Closed sergiu-os closed 3 weeks ago
Yes, via adapters:
xAxis.get("renderer").labels.template.adapters.add("html", function(html, target) {
if (target.dataItem) {
return "<strong>" + new Date(target.dataItem.get("value")).toLocaleDateString() + "</strong>";
}
return html;
})
I've tried with that but the problem is that is not the same number of labels that I see at the bottom. It got additional dates in there.
https://codepen.io/sergiu-os/pen/xxoQRXR
Is there anyway to just copy the html in the DateAxis label ? thanks
I'm not entirely sure what you mean.
An adapter for html
will kick in whenever label needs to be drawn. Whatever it returns it will be displayed as HTML.
There's no guarantee that adapter will kick in exactly number of times there are labels, and that it will occur in exact order.
You need to base the content on the actual timestamp.
I meant that it's not exactly the same HTML. I can get the dates from the axis but when I move them anywhere else I lose the position on them relative to the chart.
Basically what I want is to move the axis label HTML outside of the canvas. I could do this in Amcharts 4 by just copying the html of the axis and move it somewhere else.
I'm afraid there's not way to display axis labels outside of the chart container.
Hello, I'm trying to move the DateAxis labels outside the chart.
I was wondering if there is any way to get the HTML of the dateAxis labels ?