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

Can't aggregate nested field in bar chart. #3744

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

Can't aggregate nested field in bar chart. #3744

iliatimofeev opened this issue May 14, 2018 · 3 comments

Comments

@iliatimofeev
Copy link

Can't aggregate nested field in bar chart. Possible the same as #3727

{
  "mark": "bar",
  "encoding": {
    "y": { "field": "properties.variety", "type": "nominal"},
    "x": {
      "aggregate": "sum",
      "field": "properties.yield",
      "type": "quantitative"
    },
    "color": {"title": "site", "field": "properties.site", "type": "nominal"}
  },
  "data": {
    "values": {
      "features": [
        {
          "properties": {
            "variety": "Manchuria",
            "yield": 27,
            "site": "University Farm",
            "year": 1931
          }
        },
       {
          "properties": {
            "variety": "Wisconsin No. 38",
            "yield": 29.33333,
            "site": "Duluth",
            "year": 1932
          }
        }
      ],
      "type": "FeatureCollection"
    },
    "format": {"type": "json", "property": "features"}
  },
  "$schema": "https://vega.github.io/schema/vega-lite/v2.4.1.json"
}

export 2
live demo https://iliatimofeev.github.io/sharer/testreport/#horizontal_stacked_bar_chart

@domoritz domoritz self-assigned this May 14, 2018
@iliatimofeev
Copy link
Author

I thing it's another version

{
       "encoding": {
        "y": {
          "aggregate": "count",
          "stack": null,
          "type": "quantitative"
        },
        "x": {
          "bin":true,
          "title": "sepalLength",
          "field": "properties.sepalLength",
          "stack": null,
          "type": "quantitative"
        },
        "color": {
          "title": "species",
          "field": "properties.species",
          "type": "nominal"
        }
      },
      "data": {
        "values": {
          "features": [
            {
              "properties": {
                "sepalLength": 5.1,
                "species": "setosa"
              }
            },
            {
              "properties": {
                "sepalLength": 6.5,
                "species": "virginica"
              }
            },
            {
              "properties": {
                "sepalLength": 6.2,
                "species": "virginica"
              }
            },
            {
              "properties": {
                "sepalLength": 5.9,
                "species": "setosa"
              }
            }
          ],
          "type": "FeatureCollection"
        },
        "format": {"type": "json", "property": "features"}
      },

      "mark": "area",
    
  "$schema": "https://vega.github.io/schema/vega-lite/v2.4.1.json"
}

export 3

@kanitw kanitw added this to the 2.x Data & Transforms Patches milestone May 19, 2018
domoritz added a commit that referenced this issue Jul 15, 2018
…not be nested so you have to provide a field name, not a field accessor. Fixes #3744.
@domoritz
Copy link
Member

Found the issue and fixed it in #4021.

@domoritz
Copy link
Member

image
image

@iliatimofeev Thank you so much for the perfect examples to reproduce the issue! This made it so much easier for me to fix this.

kanitw added a commit that referenced this issue Jul 15, 2018
…not be nested so you have to provide a field name, not a field accessor. Fixes #3744 (#4023)
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

4 participants