Best practices on composing a visualization from multiple charts

90 views
Skip to first unread message

Tobia Conforto

unread,
Sep 24, 2021, 1:46:40 PM9/24/21
to vega-js
Hello

I'm trying to create a visualization that is composed of multiple charts (a so-called "dashboard") but I'm probably using the wrong primitives or the wrong approach in composing them, because I'm running into issues.

You can see an example at [1] where I've only kept a single "box" out of a visualization that contains several such ones.

One problem, as you can see, is that I cannot enable axis grids, otherwise they extend well beyond their respective chart. This makes me think that I'm missing some sort of clipping container (a group?)

But I don't have a group with the exact size of the charting area: I only have a group for each "white box", with many (IMHO too many) signal expressions that are used to compute paddings and scale ranges to position the chart inside the box.

Is there a better approach? Should I create a group that is sized to the inner "charting area" and then plot the axes *outside* of it, so that I can use the group to clip the grids? Should I create nested groups for the white boxes and for the actual charts? More generally, how can I simplify the size computations between white boxes, charts and scales/axes?

Another related issue is the prevalence of "item.mark.group." expressions in my code. I found that expression by chance and now I'm using it every time I need to refer to the containing group attributes, mainly its size: item.mark.group.width and item.mark.group.height. Is this the wrong way to go about it? I tried using shorthands like width and height, but they always refer to the entire visualization. Should I define "width" and "height" signals inside each group, so that they override the outer ones?

Is there a "dashboard" example somewhere that I can study and learn from?

Tobia

[1] https://vega.github.io/editor/#/url/vega/N4IgJAzgxgFgpgWwIYgFwhgF0wBwqgegIDc4BzJAOjIEtMYBXAI0poHsDp5kTykSArJQBWENgDsQAGhAB3GgBN6aAIwAGACwaZ8GmSxoATGpMykDTGwg0AXnDQhxE+zKZIoAazIAnNg3EKDgDEAGaGIRohAOzSIFASIXpooNZk4kgANhBoANqg6Qj26ExsAB4ACkgKCjTiZLHEmQxFKgIAvlL5SIUOyLUAKnQZcAAScHoGMo0ZzWgCah1dPeiWmJkQYxOYDU0tGgudjt1FcTBI3pib+ttTu2j7B0snsOeYg5jDV5Mg07Oohu0ALpmUo0bKoUAZJBMOAZABiEkwAGVbHsZDZago4KVVB0QBBMABPYbJU6vd4kiEgRIZDLBNQqQwADgEAE5YiFESi7EY1DJOeJMAB1cbXOYmPGyG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