fair-acc / chart-fx

A scientific charting library focused on performance optimised real-time data visualisation at 25 Hz update rates for data sets with a few 10 thousand up to 5 million data points.
GNU Lesser General Public License v3.0
508 stars 94 forks source link

changed label setting to match 11.2.7 behavior #624

Closed ennerf closed 1 year ago

ennerf commented 1 year ago

I double checked the automatic axis-label setting, and the 11.2.7 behavior was that each renderer tries to use the first dataset. Once the labels get set, a boolean state ensures that the labels do not get overwritten later.

This PR changes the behavior to match the 11.2.7 release.

sonarcloud[bot] commented 1 year ago

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

pr-explainer-bot[bot] commented 1 year ago

Pull Request Report

Hey there! I've analyzed the pull request and here's the report for you:

Changes

  1. Removed the import statement for io.fair_acc.chartfx.axes.spi.CategoryAxis in XYChart.java (line 5).
  2. Removed the code block that updates categories for CategoryAxis in XYChart.java (lines 15-34).
  3. Modified the condition in the updateCategories method of CategoryAxis.java (line 8).
  4. Removed the isUsingAxis method from Renderer.java (lines 18-23).
  5. Modified the updateAxes method in AbstractRendererXY.java to update categories for CategoryAxis (lines 14-19).
  6. Removed the isUsingAxis method from AbstractRendererXY.java (lines 24-29).
  7. Removed the isUsingAxis method from AbstractRendererXYZ.java (lines 6-10).

Suggestions

  1. Consider adding comments to explain the purpose of the removed code blocks and methods.

Bugs

  1. No bugs found.

Improvements

  1. The code in XYChart.java (lines 15-34) can be refactored for better readability. Here's an improved version:
if (axis instanceof CategoryAxis catAxis) {
    for (Renderer renderer : getRenderers()) {
        if (renderer.isUsingAxis(axis) && !renderer.getDatasets().isEmpty()) {
            catAxis.updateCategories(renderer.getDatasets().get(0));
            break;
        }
    }
}

Rating

I would rate the code a 7 out of 10. The code is generally readable and performs well. However, there are some areas that could be improved for better readability and maintainability.

That's it for the report! Let me know if you need any further assistance. Cheers!

codecov[bot] commented 1 year ago

Codecov Report

Attention: 4 lines in your changes are missing coverage. Please review.

Comparison is base (9508d3c) 48.09% compared to head (5db1a9b) 48.09%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #624 +/- ## ========================================= Coverage 48.09% 48.09% - Complexity 6213 6215 +2 ========================================= Files 374 374 Lines 38299 38288 -11 Branches 6110 6105 -5 ========================================= - Hits 18419 18416 -3 - Misses 18721 18725 +4 + Partials 1159 1147 -12 ``` | [Files](https://app.codecov.io/gh/fair-acc/chart-fx/pull/624?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=fair-acc) | Coverage Δ | | |---|---|---| | [...art/src/main/java/io/fair\_acc/chartfx/XYChart.java](https://app.codecov.io/gh/fair-acc/chart-fx/pull/624?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=fair-acc#diff-Y2hhcnRmeC1jaGFydC9zcmMvbWFpbi9qYXZhL2lvL2ZhaXJfYWNjL2NoYXJ0ZngvWFlDaGFydC5qYXZh) | `58.13% <ø> (+1.10%)` | :arrow_up: | | [...in/java/io/fair\_acc/chartfx/renderer/Renderer.java](https://app.codecov.io/gh/fair-acc/chart-fx/pull/624?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=fair-acc#diff-Y2hhcnRmeC1jaGFydC9zcmMvbWFpbi9qYXZhL2lvL2ZhaXJfYWNjL2NoYXJ0ZngvcmVuZGVyZXIvUmVuZGVyZXIuamF2YQ==) | `59.25% <ø> (+2.11%)` | :arrow_up: | | [...\_acc/chartfx/renderer/spi/AbstractRendererXYZ.java](https://app.codecov.io/gh/fair-acc/chart-fx/pull/624?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=fair-acc#diff-Y2hhcnRmeC1jaGFydC9zcmMvbWFpbi9qYXZhL2lvL2ZhaXJfYWNjL2NoYXJ0ZngvcmVuZGVyZXIvc3BpL0Fic3RyYWN0UmVuZGVyZXJYWVouamF2YQ==) | `70.96% <ø> (+2.21%)` | :arrow_up: | | [...ava/io/fair\_acc/chartfx/axes/spi/CategoryAxis.java](https://app.codecov.io/gh/fair-acc/chart-fx/pull/624?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=fair-acc#diff-Y2hhcnRmeC1jaGFydC9zcmMvbWFpbi9qYXZhL2lvL2ZhaXJfYWNjL2NoYXJ0ZngvYXhlcy9zcGkvQ2F0ZWdvcnlBeGlzLmphdmE=) | `23.45% <0.00%> (-7.41%)` | :arrow_down: | | [...r\_acc/chartfx/renderer/spi/AbstractRendererXY.java](https://app.codecov.io/gh/fair-acc/chart-fx/pull/624?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=fair-acc#diff-Y2hhcnRmeC1jaGFydC9zcmMvbWFpbi9qYXZhL2lvL2ZhaXJfYWNjL2NoYXJ0ZngvcmVuZGVyZXIvc3BpL0Fic3RyYWN0UmVuZGVyZXJYWS5qYXZh) | `83.60% <25.00%> (-0.77%)` | :arrow_down: | ... and [4 files with indirect coverage changes](https://app.codecov.io/gh/fair-acc/chart-fx/pull/624/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=fair-acc)

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.