Skip to content

Stacked areaY charts break when using optimization #981

@kgoodrick-uu

Description

@kgoodrick-uu

When using the m4 optimization for stacked area charts with more than a cetain number of data points the stack breaks with gaps between segements. Take this minimum example:

import * as vg from "@uwdata/vgplot";

const coord = vg.coordinator();
coord.databaseConnector(vg.wasmConnector());


const parquetUrl = "https://raw.githubusercontent.com/kgoodrick-uu/mosaic-test/main/fake_data.parquet";

await vg.coordinator().exec(vg.loadParquet(
    "profile", parquetUrl,
));

const zoom = vg.Selection.crossfilter();

const baseEncoding = {
    x: "time_stamp",
    y: "power",
    fill: "charger_id",
}

const optimize = true;

const mainPlot = vg.plot(
    vg.areaY(vg.from("profile", {filterBy: zoom, optimize: optimize}), baseEncoding),
    vg.yTickFormat("~s"),
);

const zoomPlot = vg.plot(
    vg.areaY(vg.from("profile", {optimize: optimize}), baseEncoding),
    vg.intervalX({as: zoom}),
    vg.yTickFormat("~s"),
    vg.height(100)
);

vg.vconcat(
    mainPlot,
    zoomPlot,
);

Broken stacking is clearly visible when zoomed into a few hours of data.

Image

If optimize is changed to false stacking behaves as expected

Image

I was not able to recreate this without the zoom (I think it is still there, but once the data is large enough I can no longer see if the stacking is broken). I think there needs to be a certain amount of data before the error is triggered.

My guess is that the optimization is not getting data for each of the groups at each timestamp it is sampling and that causes the strange behavior as some timesteps do not have data for each group.

Expected Behaivor: Stacked areas should remain contiguous and correctly layered when optimize: true is enabled.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions