Closed sharlagelfand closed 2 years ago
@sharlagelfand please provide a raw spec. This spec has giant data.values
.
P.S let's define some terms:
raw spec
- the one that needs to be processed by grid gen func.
product spec
- the spec that grid gen func outputs.
here is the raw spec @giorgi-ghviniashvili:
{
"$schema": "https://vega.github.io/schema/vega-lite/v4.json",
"meta": {
"parse": "grid",
"description": "Group by age, vaccination_status",
"splitField": "vaccination_status",
"axes": true
},
"data": {
"values": [
{
"age": "<18",
"vaccination_status": "not_fully_vaccinated",
"n": 4
},
{
"age": "18-29",
"vaccination_status": "not_fully_vaccinated",
"n": 8
},
{
"age": "30-39",
"vaccination_status": "not_fully_vaccinated",
"n": 16
},
{
"age": "30-39",
"vaccination_status": "fully_vaccinted",
"n": 2
},
{
"age": "40-49",
"vaccination_status": "not_fully_vaccinated",
"n": 22
},
{
"age": "40-49",
"vaccination_status": "fully_vaccinted",
"n": 5
},
{
"age": "50-59",
"vaccination_status": "not_fully_vaccinated",
"n": 37
},
{
"age": "50-59",
"vaccination_status": "fully_vaccinted",
"n": 6
},
{
"age": "60-69",
"vaccination_status": "not_fully_vaccinated",
"n": 49
},
{
"age": "60-69",
"vaccination_status": "fully_vaccinted",
"n": 13
},
{
"age": "70-79",
"vaccination_status": "not_fully_vaccinated",
"n": 70
},
{
"age": "70-79",
"vaccination_status": "fully_vaccinted",
"n": 22
},
{
"age": "80+",
"vaccination_status": "not_fully_vaccinated",
"n": 100
},
{
"age": "80+",
"vaccination_status": "fully_vaccinted",
"n": 49
}
]
},
"facet": {
"column": {
"field": "age",
"type": "ordinal",
"title": "age"
}
},
"spec": {
"height": 300,
"width": 37.5,
"mark": {
"type": "point",
"filled": true,
"strokeWidth": 1
},
"encoding": {
"x": {
"field": "datamations_x",
"type": "quantitative",
"axis": null
},
"y": {
"field": "datamations_y",
"type": "quantitative",
"axis": null
},
"color": {
"field": "vaccination_status",
"type": "nominal",
"legend": {
"values": ["not_fully_vaccinated", "fully_vaccinted"]
}
},
"tooltip": [
{
"field": "age",
"type": "nominal"
},
{
"field": "vaccination_status",
"type": "nominal"
}
]
}
}
}
hi @sharlagelfand , encoding.x.scale.domain
was missing in faked axis spec. Making sure that it is set always.
Also set titleOpacity to 0, to hide overlapping axis titles.
@giorgi-ghviniashvili what have you set for encoding.x.scale.domain
there - just ["not_fully_vaccinated", "fully_vaccinated"]? I have only set the domain in the summarize step before, so not sure how it needs to be translated to an info grid spec
Hi @sharlagelfand, scale.domain
is numeric, it will be for example, [0.5, 3.5] if we have three columns: [1, 2, 3].
Ah right, so in this case the real x that the domain applies to is what looks like column facets, right? so in the example above there are 8 column facets, so would go from 0.5 to 8.5?
we agreed that @giorgi-ghviniashvili will handle the domain on the javascript side so that this is transparent to the base language.
This looks good in the dev
branch now, so will close this issue once #118 is merged
May be related to #114 but I noticed while trying to make some visualizations for #97 that there is some issues with the hacked facet alignment, particularly with these specs:
looking like this: