amcharts / amcharts3

JavaScript Charts V3
Other
395 stars 129 forks source link

Guide label disappears if guide is set at top of serial graph #177

Open Terekness opened 6 years ago

Terekness commented 6 years ago

So this is how my graph currently looks:

Image

The top guide is supposed to have a label, but it doesn't actually create the actual label when the guide is placed at the top of the graph. It's not that it's just being rendered at the top of the graph and is being cut off, no. It's not there at all.

As you can see on the 2 other guides, their labels are moved down with this code:

"listeners": [{
    "event": "drawn",
    "method": function() {
        var guide1Text = document.querySelector('.amcharts-guide-guide-1 tspan')
        if (guide1Text) {
            guide1Text.setAttribute('y', 25)
        }
        var guide2Text = document.querySelector('.amcharts-guide-guide-2 tspan')
        if (guide2Text) {
            guide2Text.setAttribute('y', 25)
        }
        var guide3Text = document.querySelector('.amcharts-guide-guide-3 tspan')
        if (guide3Text) {
            guide3Text.setAttribute('y', 25)
        }
    }
}]

So supposedly, if the topmost guide actually had a label, it should be moved down with the 2 others as well. I checked the html source, the tspan is not being created.

I moved the guide down one notch, and the label showed up just fine, as shown here:

Image

So it's an issue with guides that have labels, that are placed at the top of the graph.

amcharts commented 6 years ago

New comment from Zendesk by Anthony Piris on ticket 33630. (replying here will automatically notify amCharts support agent)

Hi there,

Unfortunately this is currently by design as the chart restricts axis labels to the plot area and axis limits. This limitation also applies to guides, hence why the tspan isn't even created for your top-most label.

Your best bet for now is to pad out your value axis maximum slightly so that the label will fit and get its associated tspan created, for example: https://codepen.io/team/amcharts/pen/9bcedf830a3407de78b55871c8ec6ead?editors=0010. If your maximums are generated dynamically, consider using minMaxMultiplier to automatically pad your axis' min/max.

We'll keep this issue in mind for a future release.

Best,

Anthony Piris amCharts

Terekness commented 6 years ago

Perfect, thanks a lot Anthony! 👍

amcharts commented 6 years ago

New comment from Zendesk by Anthony Piris on ticket 33630. (replying here will automatically notify amCharts support agent)

You're welcome! Happy to help. We're tracking this internally so if we release a fix, we'll follow up here as well.

Best,

Anthony Piris amCharts