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

[10pt, 10pt]Restructure layout computations to make rendered output more consistent #579

Closed
wirew0rm opened this issue Apr 6, 2023 · 3 comments · Fixed by #592
Closed
Assignees

Comments

@wirew0rm
Copy link
Member

wirew0rm commented Apr 6, 2023

Goals:

Items to be investigated implemented:

  • Separate range computations, layout calculations and actual graphics context rendering in the layout phase by
    • either calling different functions in the layoutChildren implementation of Chart
    • or using the pre-/post-render hooks of javafx
  • Reimplement Chart as a layout container which explicitly implements a custom layout Children
  • implement global locking of datasets per render pass
    • currently range computation and rendering separately lock the dataset which is not safe and requires multiple checks
  • have a dataset node type to hold things like dirty bit, bindable properties, etc
    • datasets can update stylable properties of the wrapper via their style (or add style classes)
    • investigate relationship of this new wrapper to DataSetManagement (base class of renderer)
    • chart (and renderers?) store List, helper functions to get or remove raw DataSet
    • DataSetNode can be in scenegraph once, but Multiple DataSetNodes can refer to the same DataSet
    • DataSetNode is only handled in FxThread, DataSet is thread safe by default
  • have a simple way to disable multithreading in the DataSet
    • should default to safe/locked implementation
@wirew0rm wirew0rm changed the title Restructure layout computations to make rendered output more consistent [10pt]Restructure layout computations to make rendered output more consistent Jun 20, 2023
@ennerf
Copy link
Collaborator

ennerf commented Jun 22, 2023

As per discussion on June 21 with Alex and updated July 21.

Deterministic layout and hierarchy changes

  • Split layout and rendering
  • Perform layout based on properties in the children nodes
  • Report consistent axes size and do the axis layout in a deterministic way
  • Simplify chart hierarchy levels

Smaller changes that would be better in a separate PR.

  • Remove XYChart class and use Chart directly
  • Remove dataset list from main chart and keep datasets within the renderer. The global color index should be maintained.
  • Deprecate delegating methods, e.g., chart delegating to the grid renderer
  • Change renderer to always have one X and one Y axis. If one is not defined it defaults to the first one.

@ennerf
Copy link
Collaborator

ennerf commented Jul 28, 2023

I think the goals have all been achieved and are ready for review. The style nodes ended up not being necessary.

@ennerf
Copy link
Collaborator

ennerf commented Aug 1, 2023

Below are some before and after pictures

Before After Comment
image image The chart anatomy parts can still be fully accessed, but without the need for StackPane wrappers
image image All of the extra layout panes were removed and have been replaced with a small hierarchy of custom panes. Axis layouts are now deterministic and can be done without recursion.
image image labels don't disapper when resizing
image image tick label spacing is now computed correctly
image image disabled ranges now correctly remove the invalid tick labels (bottom left)
image image enabling an axis does not break the label positioning anymore
image image all rotations and overlap strategies get correctly rendered

Most importantly, the data rendered on the chart is now always consistent with the value shown on the axes.

Here is a video of one of our applications that used to have significant rendering issues: Deterministic Layout PR

@wirew0rm wirew0rm changed the title [10pt]Restructure layout computations to make rendered output more consistent [10pt, 10pt]Restructure layout computations to make rendered output more consistent Aug 7, 2023
@wirew0rm wirew0rm linked a pull request Aug 7, 2023 that will close this issue
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

Successfully merging a pull request may close this issue.

2 participants