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

x2 title ignored when titles of both x and x2 are specified #3742

Closed
iliatimofeev opened this issue May 14, 2018 · 3 comments
Closed

x2 title ignored when titles of both x and x2 are specified #3742

iliatimofeev opened this issue May 14, 2018 · 3 comments

Comments

@iliatimofeev
Copy link

iliatimofeev commented May 14, 2018

x2 axis title in stacked bar is hidden when x has title

{
  "mark": "bar",
  "encoding": {
    "y": {
      "field": "question",
      "type": "nominal"
    },
    "x": {
      "field": "percentage_start",
      "type": "quantitative",
      "title": "percentage_start" //<----  change chart view (intentionally)

    },
    "color": {
      "field": "type",
      "type": "nominal"
    },
    "x2": {
      "field": "percentage_end",
      "type": "quantitative",
       "title": "percentage_end" //<----  do not change chart view (expected that both titles would show)


    }
  },
  "data": {
    "values": [
      {
        "question": "Question 3",
        "percentage_start": 10,
        "percentage_end": 50,
        "type": "Agree"
      },
      {
        "question": "Question 3",
        "percentage_start": 50,
        "percentage_end": 70,
        "type": "Strongly agree"
      }
    ]
  },
  "$schema": "https://vega.github.io/schema/vega-lite/v2.4.1.json"
}

export 1
without title
export

live demo https://iliatimofeev.github.io/sharer/testreport/#diverging_stacked_bar_chart

@domoritz
Copy link
Member

I think this is actually intended behavior. You are manually setting the title for X and that overrides implicit titles. X2 belongs to X so we don't treat them separately.

@iliatimofeev
Copy link
Author

Sound logical but in case of titles on both x scales that behavior seems unexpected.

@kanitw
Copy link
Member

kanitw commented May 16, 2018

in case of titles on both x scales that behavior seems unexpected.

Good point.

@kanitw kanitw reopened this May 16, 2018
@kanitw kanitw changed the title minor issue: x2 axis title is hidden in stacked bar when x has title x2 title ignored when titles of both x and x2 are specified May 16, 2018
@kanitw kanitw self-assigned this May 16, 2018
@kanitw kanitw added this to the 2.x Visual Encoding Patches milestone May 16, 2018
kanitw added a commit that referenced this issue May 18, 2018
kanitw added a commit that referenced this issue May 18, 2018
kanitw added a commit that referenced this issue May 19, 2018
domoritz pushed a commit that referenced this issue May 19, 2018
* Do not ignore x2's title

Fix #3742

* Refactor to use common mergeTitle codebase
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants