GithubHelp home page GithubHelp logo

SVG of minimum size about d3-legend HOT 3 CLOSED

susielu avatar susielu commented on June 15, 2024
SVG of minimum size

from d3-legend.

Comments (3)

susielu avatar susielu commented on June 15, 2024

Maik,

Do you have a screenshot you can share? Is the problem that the svg is
getting cut off so you don't see all of the labels? There is no way that I
know of to automatically size your svg based on its contents. Typically you
determine the size of the svg with width/height properties, functions, or
css.

Thanks,
Susie

On Tue, Oct 6, 2015 at 4:59 AM, Maik Riechert [email protected]
wrote:

Currently I have to set a fixed size for the legend to look good on my
maps. But the problem is that I don't know the label lengths or number of
legend entries in advance, and doing computations for width/height myself
seems too complicated. Is this something which can be easily done here?
Ideally, the SVG size should actually adjust to its contents. I'm new to
D3, maybe this is a more general issue.


Reply to this email directly or view it on GitHub
#14.

from d3-legend.

letmaik avatar letmaik commented on June 15, 2024

from d3-legend.

susielu avatar susielu commented on June 15, 2024

Oh nice, glad you found a solution for your maps!

To clarify looking over the example the reason why they can make the legend
resize so nicely with css is because they aren't using SVG whereas this
legend package is for SVG legends. In SVG you need to provide the absolute
positioning of each of the items so auto-adjusting isn't as straightforward
as using css classes.

You brought a good point to my attention though that I should make it
clearer with the documentation that this is an SVG legend, and maybe think
about a non-SVG version.

Thanks!
Susie

On Wed, Oct 7, 2015 at 12:48 AM, Maik Riechert [email protected]
wrote:

It's like in your documentation page, you have to know width/height in
advance which doesn't work for me. I switched to using a simple
CSS-based legend from here:
http://leafletjs.com/examples/choropleth.html This nicely adjusts the
size by its content.


Reply to this email directly or view it on GitHub
#14 (comment).

from d3-legend.

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.