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

Question regarding population.json / grouped bar chart #3383

Closed
vikpe opened this issue Feb 14, 2018 · 5 comments
Closed

Question regarding population.json / grouped bar chart #3383

vikpe opened this issue Feb 14, 2018 · 5 comments

Comments

@vikpe
Copy link

vikpe commented Feb 14, 2018

Is repetition of data required in order to create a grouped bar chart?

In the data file population.json from the example, data is repeated for each sex.

[  
   {  
      "year": 1850,
      "age": 0,
      "sex": 1,
      "people": 1483789
   },
   {  
      "year": 1850,
      "age": 0,
      "sex": 2,
      "people": 1450376
   }
]

The data could be defined as (and reduce file by 50%):

[  
   {  
      "year": 1850,
      "age": 0,
      "men": 1483789,
      "women": 1450376
   }
]
@domoritz
Copy link
Member

Yes, for now that is the case. The size of the spec has very little effect on the performance so I wouldn't worry about it.

@vikpe
Copy link
Author

vikpe commented Feb 14, 2018

@domoritz Ok, thank you!

@kanitw
Copy link
Member

kanitw commented Feb 14, 2018

Note that the data in this "long" format

[  
   {  
      "year": 1850,
      "age": 0,
      "sex": 1,
      "people": 1483789
   },
   {  
      "year": 1850,
      "age": 0,
      "sex": 2,
      "people": 1450376
   }
]

is considered cleaner/tidier as all keys are variable names and all values are the actual values.

That said, in the future, you will be able to create a grouped bar chart for the short form using facet of a concatenated bar. But we currently don't support it yet (#2760).

@vikpe
Copy link
Author

vikpe commented Feb 15, 2018

@kanitw "Tidy data" is a very interesting article. It might be a good idea to reference it in the data docs.

@kanitw
Copy link
Member

kanitw commented Feb 16, 2018

Sure, feel free to submit a PR to suggest edits.

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

No branches or pull requests

3 participants