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

[VisCanvas] Extract axes/grid rendering logic #1276

Closed
axelboc opened this issue Nov 10, 2022 · 4 comments
Closed

[VisCanvas] Extract axes/grid rendering logic #1276

axelboc opened this issue Nov 10, 2022 · 4 comments
Labels
wontfix This will not be worked on

Comments

@axelboc
Copy link
Contributor

axelboc commented Nov 10, 2022

I'd like to investigate the feasibility of switching to an API like this:

<VisCanvas>
  <Title>My Plot</Title>
  <Axes abscissaLabel="X" />
  <Grid vertical={false} />
</VisCanvas>

The idea is to make some of VisCanvas's props such as showAxes and AxisConfig.showGrid obsolete. The goal is to make the API simpler, but also to remove a lot of internal rendering logic from VisCanvas. Toggling the axes, the grid, the plot title or the axis labels becomes a matter of rendering the corresponding components conditionally (or adding ternaries to some of the props), and those components can have their own dedicated documentation sections on the Storybook site.

The main challenge is of course dealing with axis offsets.

@axelboc axelboc added this to the v8 milestone Mar 30, 2023
@axelboc
Copy link
Contributor Author

axelboc commented May 2, 2023

Decoupling grids from axes might not be a good idea: #1429 (comment) – it seems simpler to have one component for each axis (x/y) and to keep rendering the corresponding grid inside:

<XAxis />
<YAxis /> // each with prop `showGrid` defaulting to `true`, and `showAxisLine` defaulting to `!showGrid`

<DefaultAxes /> // defaults to both `XAxis` and `YAxis` with grids visible and axis lines hidden, but configurable like `DefaultInteractions`

@axelboc axelboc modified the milestones: v8, v9 Jun 7, 2023
@axelboc
Copy link
Contributor Author

axelboc commented Aug 9, 2023

Got a prototype working, but it uncovered an issue: with a declarative API, there's no easy way to "pre-allocate" space next to the canvas for the axes, and since the axes are rendered after the canvas (because of Html), the canvas renders first and fills the space then shrinks when the axes are added to the DOM. The effect is pretty awful.

@axelboc axelboc removed this from the v9 milestone Aug 10, 2023
@axelboc
Copy link
Contributor Author

axelboc commented Aug 10, 2023

Closed in favour of #1276

@axelboc axelboc closed this as completed Aug 10, 2023
@axelboc axelboc closed this as not planned Won't fix, can't repro, duplicate, stale Aug 10, 2023
@axelboc axelboc added the wontfix This will not be worked on label Aug 10, 2023
@loichuder
Copy link
Member

Closed in favour of #1276

I guess you meant #1469 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants