Help

Upcoming database upgrades. Airtable functionality will be reduced for ~15 minutes at 06:00 UTC on Feb. 4 / 10:00 pm PT on Feb. 3. Learn more here

Trying to fix a bar chart using Vega-Lite app

Topic Labels: Extensions
494 1
cancel
Showing results for 
Search instead for 
Did you mean: 

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.

Schermata 2021-09-08 alle 10.02.21

This is the base we’re using with the data to create the chart.

Schermata 2021-09-08 alle 10.03.32

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.

1 Reply 1

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).