Giter Club home page Giter Club logo

Comments (6)

dswitzer avatar dswitzer commented on May 18, 2024

Also, the documentation for the legend.disabled property states:

Controls if element is disabled.

A disabled element is hidden, and is removed from any processing, layout calculations, and generally treated like if it does not existed.

The element itself is not destroyed, though. Setting this back to false, will "resurrect" the element.

I read this as that setting disabled=true should be like setting the CSS display:none on an HTML element, in that the element should be treated as it does not exist.

However, I'm not finding this behavior is true. None of the items that I've tried setting disabled=true to that inherit from a Sprite actually cause the canvas to re-layout the element. It's acting more like CSS visibility: hidden and visibility: visible.

from amcharts4.

martynasma avatar martynasma commented on May 18, 2024

Solved in 4.0.0-beta.28 (changelog).

from amcharts4.

dswitzer avatar dswitzer commented on May 18, 2024

Should hiding and showing a legend cause the chart to reposition to occupy the space the legend was using?

If so, it's not working properly.

It does work if I use chart.legend.disabled to toggle the legend, but using show() or hide() just toggle visibility without the chart reclaiming the space.

from amcharts4.

martynasma avatar martynasma commented on May 18, 2024

Hm, that's a functional question. Should toggling item visibility also remove it from the layout tree? I tend to think it should not. Sort of like visibility: hidden equivalent.

While, disabled = true is display: none.

from amcharts4.

dswitzer avatar dswitzer commented on May 18, 2024

For me, I would expect show() and hide() to work like display: none, but that might just be because that's the behavior of the common JS frameworks (e.g. jQuery). That doesn't mean I'm right, it was just my expectation. Usually showing or hiding an object removes it from the layout.

I certainly would expect setVisibility() to just be the equivalent of the CSS visibility property.

I would recommend that the documentation makes it very clear that the show() and hide() methods don't effect layout and point the user to using disabled if they require it be removed from layout.

Anyway, based on expectation, things seem to be working correctly now.

from amcharts4.

martynasma avatar martynasma commented on May 18, 2024

Gotcha. Makes sense.

However, in SVG CSS works a lot differently than in HTML. And we - being SVG charts - are operating under SVG defaults.

In any case, we will discuss if this one more time.

Thanks!

from amcharts4.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.