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

Charts 11.7 - Customization #74

Closed
todayifeeltired opened this issue Mar 31, 2022 · 6 comments
Closed

Charts 11.7 - Customization #74

todayifeeltired opened this issue Mar 31, 2022 · 6 comments
Assignees

Comments

@todayifeeltired
Copy link

todayifeeltired commented Mar 31, 2022

Hello :)
I rellay like the CoxCombChart, but i see no way of customizing it (or am i wrong?!).

Basically i´d like to change the MouseEvent from MOUSE_PRESSED to MOUSE_ENTERED.
I´d also like to add something to the "...%" text on the ChartItems and change the size and text
on the canvas showing after the MOUSE_PRESSED-Event.

@HanSolo HanSolo self-assigned this Apr 1, 2022
@HanSolo
Copy link
Owner

HanSolo commented Apr 1, 2022

Ok just to get it right, you would like to define your own mouse event handler? So I could add something like onMousePressed(), onMouseReleased(), onMouseMoved() to the chart. For the text on the chartitems I could add a method to define a formatString e.g. "%.0f%%" for percentage or whatever you like but it will only format the value. Would that help? The text size might be more problematic but I will take a look at it.

HanSolo added a commit that referenced this issue Apr 1, 2022
- showPopup(true/false)
- setFormatString(String)
- setSelectedItemFill(Color)
- Added individual handlers for MousePressed, MouseReleased and MouseMoved
- Added method to getSelectedItem by MouseEvent
@HanSolo
Copy link
Owner

HanSolo commented Apr 1, 2022

I've implemented parts of your request with commit 05c0052 in the jdk17 branch. Mouse entered is not that easy because the Canvas is just one node. Instead I've added MouseMoved and a method that returns the selected item for a given MouseEvent. Please check the CoxcombChartTest in the jdk17 branch, there I've added the new features with an example.

@todayifeeltired
Copy link
Author

Hello, thanks for the quick response and already done work.
I´ll try to have a look on it today.

But yeah, to clarify
I´d like to have the canvas-showing event as an on Mouse_Entered-Event, but Mouse_Moved is just fine.
On the ChartItem i´d like to also display the name of the item.
And on the canvas i´d like to show 3 rows of information and the opportunity to name them "as i want" and display the information "i want". And maybe to resize it a bit (or to set a custom canvas).

I dont know whether als this is possible /just too much work and i was wondering if you just tested in on the jdk17 branch or if you´d copy it on the jdk11 branch if everything is set and done.
Thank you very much for the work you put in!

HanSolo added a commit that referenced this issue Apr 1, 2022
@HanSolo
Copy link
Owner

HanSolo commented Apr 1, 2022

Hi there, so I've added more stuff related to your request.

  • You now can show the item name if you like by using showItemName(true/false).
  • You can decide whether you would like to use the ChartItem.textFill which enables you to use different text fills for each item by using setUseChartItemTextFill(true/false)

I've started to add the text thing you mentioned to the canvas but removed it again because it does not make sense. it is too specific. I suggest you add another layout container e.g. a VBox with 3 Labels, make it mouseTransparent(true) and add it on top of the chart using a StackPane. I've added this also to the CoxcombChartTest in the jdk17 branch so you can see how that works. This gives you the ability to overlay whatever you want without making the CoxcombChart getting features that are useful to you but maybe not for everyone :)
I could of course add the stuff also to the jdk11 branch once it works for you in the jdk17 branch.

@todayifeeltired
Copy link
Author

Hi there :)
You are right, maybe this feature is not useful for everyone.

I´ve looked at your commits and i love it, its exactly what i want/need!

Would appreciate it, if you release it on jdk11.

Btw, for all the work i was causing: is there any way to paypal a beer/coffee to you?

HanSolo added a commit that referenced this issue Apr 2, 2022
@HanSolo
Copy link
Owner

HanSolo commented Apr 2, 2022

Ok so I've backported the code to the main branch and released v11.11, might take some time to show up on Maven central. And there is also 17.1.7 which contains the same changes in the jdk17 branch. Both jars are also available via the github releases. Glad it works for you :)

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

No branches or pull requests

2 participants