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

Noticably slower render/transformation time for str columns casted as temporal encoding types #403

Open joelostblom opened 9 months ago

joelostblom commented 9 months ago

Vegafusion seems to transform/render str columns slower than base altair, when these columns are encoded as temporal data types in the altair spec. See example in the video; not shown is that if astype(str) is changed to astype('category') there is no speed difference.

https://github.com/hex-inc/vegafusion/assets/4560057/17aeb9fd-0f98-4e95-9677-1f1ed26e888f

import altair as alt
from vega_datasets import data
import pandas as pd

alt.data_transformers.enable('default')
alt.data_transformers.disable_max_rows()

source = pd.concat([data.wheat()]*800)
source.year = source.year.astype('category')

chart = alt.Chart(source, height=200).mark_point().encode(
    x='year:T',
    y='wheat',
)