Code Monkey home page Code Monkey logo

Comments (4)

jheer avatar jheer commented on May 7, 2024

Agreed. It turns out you can do this already (kind of) by "hacking" tick mark properties. For example, try adding the following to the Y-axis definition in the Vega bar chart example:

"properties": {
  "ticks": {
    "x": {"value": -5},
    "x2": {"value": 400},
    "stroke": {"value": "#888"},
    "strokeOpacity": {"value": "0.5"}
  }
}

In any case, we'll take more explicit gridline support into consideration for our roadmap.

from vega.

hadley avatar hadley commented on May 7, 2024

This is slightly off-topic, but it'd be useful if scales recognised constants -Inf and Inf, so you could run a line the complete length of a scale without magic constants.

from vega.

malecki avatar malecki commented on May 7, 2024

Tried this hack of extending the ticks into the graph area — they draw on top of other marks! Would it make sense to render axes first/underneath anyway?
image

from vega.

jheer avatar jheer commented on May 7, 2024

These issues have been addressed in commit 456746a, and will be part of the 1.3.0 release. New features include:

  • Axes now support grid lines, though they are disabled by default. To enable grid lines, include the parameter grid: true in your axis definition. To further style the gridlines, include a "grid": {...} entry within the axis properties parameter.
  • Axes can now be positioned either above or below data marks. The default behavior is to place an axis above the marks. To place the axes below, add the "layer": "back" parameter to the axis definition ("layer": "front" is also legal, but assumed by default).
  • Mark properties, including those of axis elements, can now be set to the full width or height of the current group through a new "group" option for value references (this is similar to @hadley's suggestion of Inf, -Inf extents). Here are some examples: "x2": {"group":"width"} and "y2": {"group":"height"}. Axis gridlines use this feature internally.

Thanks @malecki and @hadley for the suggestions!

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.