Hi,
I've got a general question concerning ways to extend JFreeChart functionality to suit my own needs.
For example, I'd like to add and remove annotations interactively to my XYPlot.
XYPlot already has the methods addAnntoations() and clearAnntoations(),
but there is no removeAnntotation() or getAnnotationCount() or what else I could need.
Unfortunately, the List "annotations" in XYPlot has private access - so I just can't simply subclass XYPlot and add the required methods which manipulate "annotations".
Generally spoken, how would you best face problems of this kind - do I have to touch the original code and set private members to protected (the same with private methods that would be necessary) - or is there another solution which leaves the original code unchanged?
Thanks,
Martin
Best way to extend JFreeChart functionality
Re: Best way to extend JFreeChart functionality
Hi Martin,
The ideal case would be that you could extend JFreeChart without modifying the code. There are things missing from the API to make this possible, but I'd like to get those things fixed before JFreeChart 1.0.0 is released.
So it would be a great help if you could subclass XYPlot the way you think it should work, but add methods to XYPlot that you consider "missing". Then let me know what changes you have made to XYPlot and I'll integrate them into JFreeChart.
My preference is to leave all attributes 'private', but where there is a strong argument for using 'protected' I will make the change.
Regards,
Dave Gilbert
The ideal case would be that you could extend JFreeChart without modifying the code. There are things missing from the API to make this possible, but I'd like to get those things fixed before JFreeChart 1.0.0 is released.
So it would be a great help if you could subclass XYPlot the way you think it should work, but add methods to XYPlot that you consider "missing". Then let me know what changes you have made to XYPlot and I'll integrate them into JFreeChart.
My preference is to leave all attributes 'private', but where there is a strong argument for using 'protected' I will make the change.
Regards,
Dave Gilbert
Re: Best way to extend JFreeChart functionality
Hi Dave,
>The ideal case would be that you could extend JFreeChart without
>modifying the code.
ACK!
>So it would be a great help if you could subclass XYPlot the way you think
>it should work, but add methods to XYPlot that you consider "missing".
>Then let me know what changes you have made to XYPlot and I'll >integrate them into JFreeChart.
>My preference is to leave all attributes 'private', but where there is a
>strong argument for using 'protected' I will make the change.
Okay, then I'll add getter/setter methods in the original classes and add additional methods in my subclasses. I'll write you the changes I've made as soon as I'm content with the extensions - then you can decide what and how to incorporate changes in the 1.0.0 release.
Best regards,
Martin
>The ideal case would be that you could extend JFreeChart without
>modifying the code.
ACK!
>So it would be a great help if you could subclass XYPlot the way you think
>it should work, but add methods to XYPlot that you consider "missing".
>Then let me know what changes you have made to XYPlot and I'll >integrate them into JFreeChart.
>My preference is to leave all attributes 'private', but where there is a
>strong argument for using 'protected' I will make the change.
Okay, then I'll add getter/setter methods in the original classes and add additional methods in my subclasses. I'll write you the changes I've made as soon as I'm content with the extensions - then you can decide what and how to incorporate changes in the 1.0.0 release.
Best regards,
Martin