vega / vega-lite

A concise grammar of interactive graphics, built on Vega.
https://vega.github.io/vega-lite/
BSD 3-Clause "New" or "Revised" License
4.68k stars 611 forks source link

x/yOffset within a continuous scale #7722

Open kanitw opened 3 years ago

kanitw commented 3 years ago

In https://github.com/vega/vega-lite/pull/7684, we can't add xOffset encoding inside quantitative x scale at all.

However, it might make sense to do something like this to draw error bar:

encoding: {
  x: {aggregate: 'mean', 'field': 'value'},
  y: {field: 'category'}
},
layer: [{
  mark: 'circle', 
}, {
  mark: 'rule', 
  encoding: {
    xOffset: {aggregate: 'stdev', field: 'value'},
    xOffset2: {aggregate: 'stdev', field: 'value', multiply: -1} // also need to add `multiply` like in Vega? 
  }
}]
PBI-David commented 2 years ago

Here is a stack overflow question that looks related.

https://stackoverflow.com/questions/74021286/showing-gaps-in-ordinal-time-based-data-in-vega-lite?noredirect=1#comment130713049_74021286

It seems that xOffset doesn't properly support temporal datatypes (which is continuous but also logically discrete at the same time as there are only 4 quarters).