Coder Social home page Coder Social logo

Comments (4)

marcprux avatar marcprux commented on May 5, 2024

I agree that the view sizing stuff could be clearer. If we could just specify sizes in terms of percentages (and even have listeners for window-size events automatically installed to re-update the view when the size changes), then I think it would make it a lot simpler to have automatically resizable views.

You can see how I do padding for resizability at: http://bl.ocks.org/mprudhom/raw/5461279/ (source: http://bl.ocks.org/mprudhom/5461279 ).

from vega.

rbishop-bah avatar rbishop-bah commented on May 5, 2024

Some additional problems I observed when I stepped through some code:

  • setting view.width and view.height change the canvas node width and height to the provided values plus any padding (as expected). However setting those values also results in the viewport node's (div class='vega', right?) width and height to be changed, to the view width and height minus the padding. What's going on here? I thought the size of the data window (plus its padding) is independent of the viewport? Is that wrong?
  • setting view.viewport seems to have no effect at all

from vega.

jheer avatar jheer commented on May 5, 2024

Thanks for the documentation suggestions! We'll add them to our list. We'll also consider adding getters for the sizing properties soon.

The width, height and padding values determine the size of the DOM node containing the visualization (either a canvas or svg element). The surrounding "viewport" div has no size settings by default. If the viewport parameter is specified, this determines the size of the surrounding div and sets up the component for auto-scrolling. The size of the visualization element should indeed be set independent of the size of the enclosing viewport div. A diagram will help explain this better, and will be included among future documentation.

from vega.

jheer avatar jheer commented on May 5, 2024

All size properties have getters. As of commit 75c47d6, each of width/height/padding/viewport are supported in both standard and headless View classes. Documentation will be updated once v1.3 is ready for release.

from vega.

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.