Sep 08, 2021 01:06 AM
Hi all, we’re trying to create a bar chart using Vega-Lite app.
This is where we at right now:
{
“$schema”: “https://vega.github.io/schema/vega-lite/v4.json”,
“title”: “Test Corporate”,
“width”: “container”,
“height”: “container”,
“data”: {
“values”: [
{
“tratti”: “EXECUTIVE”,
“field”: “EXECUTIVE”,
“type”: “nominal”
},
{
“tratti”: “ORGANIZZAZIONE”,
“field”: “ORGANIZZAZIONE”,
“type”: “nominal”
},
{
“tratti”: “RIPETITIVITA VENDITE”,
“field”: “RIPETITIVITA VENDITE”,
“type”: “nominal”
},
{
“tratti”: “FINANZE”,
“field”: “FINANZE”,
“type”: “nominal”
},
{
“tratti”: “ATTIVITA”,
“field”: “ATTIVITA”,
“type”: “nominal”
},
{
“tratti”: “CERTEZZA QUALITA”,
“field”: “CERTEZZA QUALITA”,
“type”: “nominal”
},
{
“tratti”: “NUOVE VENDITE”,
“field”: “NUOVE VENDITE”,
“type”: “nominal”
},
{
“tratti”: “STRESS”,
“field”: “STRESS”,
“type”: “nominal”
},
{
“tratti”: “PRINCIPI BASE”,
“field”: “PRINCIPI BASE”,
“type”: “nominal”
},
{
“tratti”: “AIUTO”,
“field”: “AIUTO”,
“type”: “nominal”
}
]
},
“mark”: “bar”,
“encoding”: {
“x”: {
“field”: “tratti”,
“type”: “nominal”,
“axis”: {
“labelAngle”: 0
}
},
“y”: {
“aggregate”: “values”,
“type”: “quantitative”
}
}
}
But the result is not what we want since the chart shows every bar with the same value, as seen below.
This is the base we’re using with the data to create the chart.
Something in the instruction above has to be wrong, but we can’t figure out what and how. Can anybody help us?
We would also like to aggregate the chart at the “ID_Test” field, is it doable?
Thanks everybody.
Sep 10, 2021 08:53 AM
Could you please explain what are hoping to visualize here In prose, I mean?
If you’re certain your field selections are correct, then go ahead and replace the “cotnainer” height property with whatever number is required for you to start seeing some differences between the columns. Assuming any exist and you aren’t just comparing nominalities here (which, judging from that JSON you shared, is exactly what you seem to be doing).