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

tickMinStep ignored for small domain values #9034

Open
4 of 5 tasks
parente opened this issue Jul 27, 2023 · 2 comments
Open
4 of 5 tasks

tickMinStep ignored for small domain values #9034

parente opened this issue Jul 27, 2023 · 2 comments
Labels

Comments

@parente
Copy link

parente commented Jul 27, 2023

Please:

  • Describe how to reproduce the bug.

tickMinStep=1 seems to be ignored in v5.8.0 of vega-lite when for domain values less than 5. Ticks appear with floating point values instead of integers only (e.g., as they were in this prior issue example: #7034)

  • Check for duplicate issues. Please file separate requests as separate issues.

I could not find an open bug searching for tickMinStep in the GitHub issues for this repository.

  • Use the latest versions of Vega and Vega-Lite.

I tested using vega-lite 5.8.0.

Example with v4 schema, repurposed from #7034 (Open the chart in the Vega Editor)

{
  "$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}}
  }
}

image

Example using v5 schema (Open the chart in the Vega Editor)

{
  "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}
    ]
  }
}

image

@jonmmease
Copy link
Contributor

jonmmease commented Sep 21, 2023

It looks to me, as of Vega-Lite 5.14.1, that tickMinStep is always ignored.

Here's an example of a histogram with an attempt to limit x-tick spacing to be no smaller than 2 domain units. But the result still includes tick spacing of 1 unit.

{
  "$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"}
  }
}

visualization (2)

Open the Chart in the Vega Editor

When changing the value of tickMinStep, the generated Vega spec doesn't change at all.

ping @kanitw as it looks like you did some work with tickMinStep earlier this year in #8872.

@jonmmease
Copy link
Contributor

Friendly ping @kanitw. Not certain this was related to your changes, but wondering if you could take a quick look

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants