Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: allow axis settings when ("bin":"binned"). #7192

Merged
merged 1 commit into from
Jan 31, 2021

Conversation

orbisvicis
Copy link
Contributor

@orbisvicis orbisvicis commented Jan 30, 2021

Before, any axis blocks would be dropped from the resulting Vega, including any
axis settings. After, mirror the behavior of ("bin":true) - axis settings cause
the axis block to be included.

This because I wanted grid lines to accompany my pre-binned data.

Test case:

{ "mark": "bar",
  "encoding": {
    "x": {
      "type": "temporal",
      "bin": "binned",
      "field": "start",
      "axis": {"grid": true}
    },
    "x2": {"field": "end"},
    "y": {"type": "quantitative", "field": "value"}
  },
  "transform": [
    {"calculate": "toDate(datum.day)", "as": "day"},
    {"calculate": "timeOffset('hours', datum.day, -12)", "as": "start"},
    {"calculate": "timeOffset('hours', datum.day, 12)", "as": "end"}
  ],
  "height": 250,
  "width": 800,
  "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
  "data": {
    "values": [
      {"day": "2021-01-01T00:00:00", "value": 5},
      {"day": "2021-01-02T00:00:00", "value": 4},
      {"day": "2021-01-04T00:00:00", "value": 5},
      {"day": "2021-01-05T00:00:00", "value": 4},
      {"day": "2021-01-09T00:00:00", "value": 1},
      {"day": "2021-01-10T00:00:00", "value": 3},
      {"day": "2021-01-11T00:00:00", "value": 2},
      {"day": "2021-01-12T00:00:00", "value": 3},
      {"day": "2021-01-13T00:00:00", "value": 5},
      {"day": "2021-01-15T00:00:00", "value": 3}
    ]
  }}

Please:

  • Make the pull requests (PRs) atomic (fix one issue at a time). Multiple relevant issues that must be fixed together? Make atomic commits so we can easily review each issue.
  • Provide a concise title as a semantic commit message (e.g. "fix: correctly handle undefined properties") so we can easily copy it to the release note.
    • Use imperative mood and present tense.
    • Mention relevant issues in the description (e.g., Fixes #1 / Fixes part of #1).
  • Lint and test (Run yarn test). N/A on Cygwin.
  • If you send a pull request from a fork, make sure that GitHub actions run successfully. Make sure to add a GH_PAT secret for a personal access token with public repository permissions.
  • Review your changes before sending the PR (to ensure code quality).
  • For new features:
    • Add new unit tests.
    • Update the documentation under site/docs/ + add examples.

Tips:

Before, any axis blocks would be dropped from the resulting Vega, including any
axis settings. After, mirror the behavior of ("bin":true) - axis settings cause
the axis block to be included.

This because I wanted grid lines to accompany my pre-binned data.
@domoritz domoritz changed the title Allow axis settings when ("bin":"binned"). fix: allow axis settings when ("bin":"binned"). Jan 30, 2021
@domoritz domoritz self-assigned this Jan 31, 2021
@domoritz
Copy link
Member

Thank you for the pull request. This looks great.

Some axis settings such as "axis": {"tickColor": "hotpink"} worked beforehand as well.

@domoritz domoritz merged commit 09a407a into vega:master Jan 31, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants