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

Set limit range for zoom, scroll, and adjust operations #427

Merged
merged 3 commits into from
Dec 11, 2024

Conversation

QuocDoBV
Copy link
Contributor

@QuocDoBV QuocDoBV commented Dec 6, 2024

Set limit range for zoom, scroll, and adjust operations

  • Added a method setLimitRange to define minimum and maximum range boundaries for dynamic axis operations.
  • Enforced these limits in zoomIn, zoomOut, scrollUp, scrollDown, and adjustRange to ensure axis values stay within the specified range.
  • Updated logic in these methods to respect minRange and maxRange.
  • Added checks to prevent invalid configurations for minRange and maxRange.

This change does not affect manual range updates via setRange to provide flexibility for custom settings.

Set limit range for zoom, scroll, and adjust operations

- Added a method `setLimitRange` to define minimum and maximum range boundaries for dynamic axis operations.
- Enforced these limits in `zoomIn`, `zoomOut`, `scrollUp`, `scrollDown`, and `adjustRange` to ensure axis values stay within the specified range.
- Updated logic in these methods to respect `minRange` and `maxRange`.
- Added checks to prevent invalid configurations for `minRange` and `maxRange`.

This change does not affect manual range updates via `setRange` to provide flexibility for custom settings.
@eselmeister
Copy link
Contributor

@QuocDoBV Please adjust the year in the header. If it was 2023 before, then modify to 2023, 2024.

@eselmeister
Copy link
Contributor

Your approach allows to specify a range manually. That's also a way to select a range of display.
Did you try to use the RangeRestriction option?


IChartSettings chartSettings = chart.getChartSettings();
RangeRestriction rangeRestriction = chartSettings.getRangeRestriction();
rangeRestriction.setRestrictZoomX(true);
rangeRestriction.setRestrictZoomY(true);
chart.applySettings(chartSettings);

@QuocDoBV
Copy link
Contributor Author

QuocDoBV commented Dec 6, 2024

Your approach allows to specify a range manually. That's also a way to select a range of display. Did you try to use the RangeRestriction option?


IChartSettings chartSettings = chart.getChartSettings();
RangeRestriction rangeRestriction = chartSettings.getRangeRestriction();
rangeRestriction.setRestrictZoomX(true);
rangeRestriction.setRestrictZoomY(true);
chart.applySettings(chartSettings);

I am using InteractiveChart. Does it suport RangeRestriction? I checked and saw that InteractiveChart does not support RangeRestriction. Could you please confirm? Thank you.

@eselmeister
Copy link
Contributor

The RangeRestriction is available via the extensions.

@QuocDoBV
Copy link
Contributor Author

QuocDoBV commented Dec 6, 2024

The RangeRestriction is available via the extensions.

We are building a view that is using InteractiveChart for plot data. We would like to limit zoom, scroll, adjust in specified range. But InteractiveChart does not support a RangeRestriction. It is the reason why I want to make these changes. Our application is using InteractiveChart for plotting data. Because there are a set different between InteractiveChart and chart extensions(line chart is simiar to Interactive chart for plotting line series) such as context menu item, slider, etc,... Therefore I still want to use InteractiveChart instead of an extension.

@eselmeister
Copy link
Contributor

When using org.eclipse.swtchart.extensions.core.ScrollableChart or specific version of it, you can define the menu exactly as you want and replace the existing menu content by your specific entries.

@QuocDoBV
Copy link
Contributor Author

QuocDoBV commented Dec 6, 2024

When using org.eclipse.swtchart.extensions.core.ScrollableChart or specific version of it, you can define the menu exactly as you want and replace the existing menu content by your specific entries.

Thank you for your suggestion.
We need to plot a lot of data points, could be more than 1 million data therefore we concern about the performance of the library.
Could you please tell me that there any different about performance between InteractiveChart and ScrollableChart?

@eselmeister
Copy link
Contributor

@QuocDoBV Have a look at the demo chart I just have pushed.

image

@eselmeister
Copy link
Contributor

@QuocDoBV Did you try it with the above example?

@QuocDoBV
Copy link
Contributor Author

QuocDoBV commented Dec 8, 2024

@QuocDoBV Did you try it with the above example?

I have just run your example. It looks great. I will continue checking the compatibility of the ScrollableChart extension with my project tomorrow. Thank you so much for your suggestion.

@eselmeister
Copy link
Contributor

Lovely to hear. Additionally, your PR could be used in a case, where chart zooming shall be constrained to a defined range. If you'd like to, please update the header accordingly. I would then merge the change and adjust it slightly to the ChartSettings approach.

Updated the copyright headers in the modified files to include the year range 2023, 2024
@QuocDoBV
Copy link
Contributor Author

QuocDoBV commented Dec 9, 2024

Lovely to hear. Additionally, your PR could be used in a case, where chart zooming shall be constrained to a defined range. If you'd like to, please update the header accordingly. I would then merge the change and adjust it slightly to the ChartSettings approach.

I have just updated the header file as your request.

@QuocDoBV
Copy link
Contributor Author

Hi @eselmeister,
There is an issue with LineChart extension that I have just found when the chart display data had the same values. The slider will work wrongly as below image. The chart ranges do not update when moving slider in both X and Y axis.
The source to create a chart with points having the same Y values.
ChartView.zip

image

@eselmeister
Copy link
Contributor

@QuocDoBV Please move the above mentioned issue to a separate issue. I will do a review.

@QuocDoBV
Copy link
Contributor Author

@QuocDoBV Please move the above mentioned issue to a separate issue. I will do a review.

I have raised #429

@eselmeister
Copy link
Contributor

@QuocDoBV The PR looks good, but the copyright header was updated in a wrong way. You need to fix it. The first year marks the year the file has been created. The second year the year the file has been updated recently. In this case, you replaced 2008 by 2023. The correct header is:

Copyright (c) 2008, 2024 SWTChart project.

Please adjust the header.

@QuocDoBV
Copy link
Contributor Author

@QuocDoBV The PR looks good, but the copyright header was updated in a wrong way. You need to fix it. The first year marks the year the file has been created. The second year the year the file has been updated recently. In this case, you replaced 2008 by 2023. The correct header is:

Copyright (c) 2008, 2024 SWTChart project.

Please adjust the header.

Thank for your explanation!
I have updated the header.

@eselmeister eselmeister merged commit dd3ee5c into eclipse:develop Dec 11, 2024
3 checks passed
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 this pull request may close these issues.

2 participants