--- date: 2023-06-10 category: Release author: Jon Mease --- # VegaFusion 1.3 **Transformed data for compound charts, Java library** By: Jon Mease --- The VegaFusion team is happy to announce the release of version 1.3. Along with usual bug fixes and updates to the core Arrow and DataFusion dependencies, this release includes an enhancement to the `transformed_data` function to make it compatible with compound charts, adds DuckDB 0.8 support, and adds a new Java API. ## Extract transformed data from compound Altair charts The VegaFusion `transformed_data` function can be used to extract the transformed data from an Altair chart object as a pandas DataFrame. Prior to 1.3.0, `transformed_data` was only supported on simple charts that involve only a single mark. Now, compound layered and concatenated charts are supported as well. In the case of a compound chart, `transformed_data` will return a list of pandas DataFrame's rather than single DataFrame. ### Example: Histogram with a Global Mean Overlay Here is an example based on the [Histogram with a Global Mean Overlay](https://altair-viz.github.io/gallery/histogram_with_a_global_mean_overlay.html) example from the Altair gallery. ```python import altair as alt import vegafusion as vf from vega_datasets import data vf.enable() source = data.movies.url base = alt.Chart(source) bar = base.mark_bar().encode( alt.X('IMDB_Rating:Q').bin().axis(None), y='count()' ) rule = base.mark_rule(color='red').encode( x='mean(IMDB_Rating):Q', size=alt.value(5) ) chart = bar + rule chart ``` ![Rule on Histogram](https://github.com/vegafusion/vegafusion.github.io/assets/15064365/645a52a1-0b37-4b0a-9da1-1f7d348c1527) Because `chart` is composed of two subcharts, the result of `vf.transformed_data` will be a list of two DataFrames. ```python [hist_df, rule_df] = vf.transformed_data(chart) hist_df ``` ``` | | bin_maxbins_10_IMDB_Rating | bin_maxbins_10_IMDB_Rating_end | __count | |---:|-----------------------------:|---------------------------------:|----------:| | 0 | 6 | 7 | 985 | | 1 | 3 | 4 | 100 | | 2 | 7 | 8 | 741 | | 3 | 5 | 6 | 633 | | 4 | 8 | 9 | 204 | | 5 | 2 | 3 | 43 | | 6 | 4 | 5 | 273 | | 7 | 9 | 10 | 4 | | 8 | 1 | 2 | 5 | ``` ```python rule_df ``` ``` | | mean_IMDB_Rating | |---:|-------------------:| | 0 | 6.28347 | ``` ## DuckDB 0.8 Support VegaFusion's DuckDB integration has been updated to support DuckDB 0.8.0 ## Java API VegaFusion 1.3 may now be embedded in Java applications using the new `io.vegafusion.vegafusion` jar, which is published to [Maven Central](https://central.sonatype.com/artifact/io.vegafusion/vegafusion). This was accomplished by wrapping the VegaFusion Rust API with a JNI interface using the [`jni-rs` crate](https://github.com/jni-rs/jni-rs). ## Updates to Arrow and DataFusion dependencies VegaFusion 1.3 updates the dependency on arrow-rs to [version 39.0](https://github.com/apache/arrow-rs/blob/master/CHANGELOG-old.md#3900-2023-05-05) and DataFusion to [version 25.0](https://github.com/apache/arrow-datafusion/blob/main/dev/changelog/25.0.0.md). ## Learn more Check out these resources to learn more: - [1.3.0 Changelog](https://github.com/hex-inc/vegafusion/releases/tag/v1.3.0) - [VegaFusion Documentation](https://vegafusion.io/) - [VegaFusion GitHub](https://github.com/hex-inc/vegafusion) - [Report and Issue](https://github.com/hex-inc/vegafusion/issues) - [Start a Discussions](https://github.com/hex-inc/vegafusion/discussions)