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: prefer user-defined tickMinStep to defaultTickMinStep #9461

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

datananda
Copy link

PR Description

Fixes #9034 by only using defaultTickMinStep if the user hasn't explicitly provided a tickMinStep.

example 1

{
  "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
  "description": "A simple bar chart with embedded data.",
  "data": {
    "values": [
      {"a": "A", "b": 2}, {"a": "B", "b": 1}, {"a": "C", "b": 1},
      {"a": "D", "b": 1}, {"a": "E", "b": 2}, {"a": "F", "b": 2},
      {"a": "G", "b": 3}, {"a": "H", "b": 3}, {"a": "I", "b": 1}
    ]
  },
  "mark": "bar",
  "encoding": {
    "x": {"field": "a", "type": "nominal", "axis": {"labelAngle": 0}},
    "y": {"field": "b", "type": "quantitative", "axis": {"tickMinStep": 1}}
  }
}
Before After
visualization visualization (1)

example 2

{
  "config": {"view": {"continuousWidth": 300, "continuousHeight": 300}},
  "data": {"name": "data-4a0cb25b0716723cd309daa74d88bb73"},
  "mark": {"type": "point"},
  "encoding": {
    "x": {"axis": {"tickMinStep": 1}, "field": "x", "type": "quantitative"},
    "y": {"field": "y", "type": "quantitative"}
  },
  "$schema": "https://vega.github.io/schema/vega-lite/v5.8.0.json",
  "datasets": {
    "data-4a0cb25b0716723cd309daa74d88bb73": [
      {"x": 0, "y": 0},
      {"x": 1, "y": 1},
      {"x": 2, "y": 2},
      {"x": 3, "y": 3},
      {"x": 4, "y": 4}
    ]
  }
}
Before After
visualization (2) visualization (3)

example 3

{
  "$schema": "https://vega.github.io/schema/vega-lite/v5.json",
  "data": {"url": "data/movies.json"},
  "mark": "bar",
  "encoding": {
    "x": {
      "bin": true,
      "field": "IMDB Rating",
      "axis": {
        "grid": true,
        "tickMinStep": 2
      }
    },
    "y": {"aggregate": "count"}
  }
}

Before After
visualization (5) visualization (6)

@datananda datananda force-pushed the mef/9034-tickminstep branch from 562668d to d4efcc8 Compare December 6, 2024 01:48
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.

tickMinStep ignored for small domain values
1 participant