Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve layout and interactions of categorical histograms #127

Open
domoritz opened this issue Jan 28, 2025 · 3 comments
Open

Improve layout and interactions of categorical histograms #127

domoritz opened this issue Jan 28, 2025 · 3 comments

Comments

@domoritz
Copy link
Member

There is a lot of whitespace that could be used.

Also it's odd that I can't click on the words on the left but only the bars.

Image
@willeppy
Copy link
Member

Yes agreed. I struggled with the vgplot chart to find a way to allow selections on the label and not just the bar. It gets really annoying if the bar is very small because very hard to click

@willeppy
Copy link
Member

The current categorical chart spec looks like

vg.plot(
vg.barX(vg.from(table, { filterBy: $mosaicSelection }), {
        x: vg.count(),
        y: col,
        fill: colorColName ?? "steelblue",
        sort: { y: "-x", limit },
      }),
      vg.highlight({ by: selection }),
      vg.toggleY({ as: selection }),
      vg.toggleY({ as: $mosaicSelection }),
      vg.text(vg.from(table, { filterBy: $mosaicSelection }), {
        x: 0,
        y: col,
        sort: { y: "-x", limit },
        text: vg.count(),
        dx: -3,
        textAnchor: "end",
        textOverflow: "ellipsis",
        fill: "black",
      }),
      vg.margins({ left: 250, bottom: 0, top: 0, right: 0 }),
      vg.width(400),
      vg.axis(null),
      vg.axisY({
        textOverflow: "ellipsis",
        lineWidth: 15,
        label: null,
        textAnchor: "start",
        dx: -220,
        fontSize: 14,
        tickSize: 0,
      }),
)

Maybe I could encode the text rather than use the axis to make it clickable?

@domoritz
Copy link
Member Author

Yeah, try that. Alternatively, it might be worth coding this specific chart by hand rather than relying to vgplot to have more control over the layout and interactions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants