vega / vegafusion

Serverside scaling for Vega and Altair visualizations
https://vegafusion.io
BSD 3-Clause "New" or "Revised" License
303 stars 15 forks source link

No bars on colored, faceted chart, sorted by aggregate value #391

Closed emonson closed 9 months ago

emonson commented 9 months ago

(Thanks for all of the great work – I find VegaFusion super useful!!)

I get a blank mark_bar chart (in JupyterLab) if I do a combination of faceting and coloring by a category, plus sorting the shared axis by an aggregated numeric value. The chart looks good with the default Altair renderer, and it displays fine with VF if I take away the sorting, the coloring, or the faceting, or if I switch to mark_point, circle, line, or rect.

import pandas as pd
import altair as alt
import vegafusion as vf
vf.enable()

df = pd.DataFrame({'location':['US','US','US','UK','UK','UK'],
                    'category':['low','high','high','low','high','high'],
                    'value':[1,2,3,2,3,4]})

alt.Chart(df).mark_bar().encode(
    x = 'sum(value):Q',
    y = alt.Y('category:N').sort(alt.EncodingSortField(field='value',op='sum',order='descending')),
    color = 'location:N'
).facet(
    column = 'location:N'
)

visualization (2)

Versions:

jonmmease commented 9 months ago

Thanks for the report!

jonmmease commented 9 months ago

This will be fixed in the next release (vegafusion 1.5.0). Please keep the reports coming as you run into things, we want VegaFusion to be something you (and your students) can turn on without worrying about compatibility or caveats.

Your course looks great BTW!

emonson commented 9 months ago

Awesome! Thanks a lot!