Hi,
I need to display more than 6000 lines with the same x data points. The lines are divided into several groups. Depending on user interaction, selected groups of lines are displayed. I tried to use overlaid XYplot. Each group of lines is in one subplot. I encountered two problems.
1) I need to remove a subplot from the overlaid plot. I tried to simply remove the subplot from the list, but it is not working properly.
2) The performance is a big issue. When adding a group with more than 5000 lines, it is too slow. Is there a way just to render the added lines without rendering the lines already displayed? What can I do to improve performance?
Thanks,
Jenny
remove subplot and performance
Re: remove subplot and performance
Jenny Wei wrote:
> 1) I need to remove a subplot from the overlaid plot. I
> tried to simply remove the subplot from the list, but it is
> not working properly.
There isn't a method for removing subplots at present. I've added an item (687813) in the Feature Request database on the SourceForge project page.
> 2) The performance is a big issue. When adding a group with
> more than 5000 lines, it is too slow. Is there a way just to
> render the added lines without rendering the lines already
> displayed? What can I do to improve performance?
When the dataset changes, JFreeChart redraws everything, because the axis ranges might have changed, some data might have been removed etc. etc. In special cases, you don't need to redraw everything, but no code has been written to detect these special cases.
Regards,
Dave Gilbert
> 1) I need to remove a subplot from the overlaid plot. I
> tried to simply remove the subplot from the list, but it is
> not working properly.
There isn't a method for removing subplots at present. I've added an item (687813) in the Feature Request database on the SourceForge project page.
> 2) The performance is a big issue. When adding a group with
> more than 5000 lines, it is too slow. Is there a way just to
> render the added lines without rendering the lines already
> displayed? What can I do to improve performance?
When the dataset changes, JFreeChart redraws everything, because the axis ranges might have changed, some data might have been removed etc. etc. In special cases, you don't need to redraw everything, but no code has been written to detect these special cases.
Regards,
Dave Gilbert
Re: remove subplot and performance
Jenny, I recently had the same problem needing to remove a subplot from am Overlaid Plot (and a combined one also).
I achieved it by extending the OverlaidPlot class and adding the method "remove" which only removes the subplot from the list. The ugly part of this is that my extended OverlaidPlot contains almost all the code from the original one. I did this because the list was private and I couldn't inherit it, so every code that touched the list (and every other private variable) had to be copied in the extended class. (This is why I suggested David to use protected instead of private for his lists).
Here is my "remove" method.
public void remove(XYPlot plot) {
subplots.remove(plot);
ValueAxis domain = this.getDomainAxis();
if (domain != null) {
domain.configure();
}
ValueAxis range = this.getRangeAxis();
if (range != null) {
range.configure();
}
}
If you find a better way to overcome this problem, please let me know.
Regards,
Diego.
I achieved it by extending the OverlaidPlot class and adding the method "remove" which only removes the subplot from the list. The ugly part of this is that my extended OverlaidPlot contains almost all the code from the original one. I did this because the list was private and I couldn't inherit it, so every code that touched the list (and every other private variable) had to be copied in the extended class. (This is why I suggested David to use protected instead of private for his lists).
Here is my "remove" method.
public void remove(XYPlot plot) {
subplots.remove(plot);
ValueAxis domain = this.getDomainAxis();
if (domain != null) {
domain.configure();
}
ValueAxis range = this.getRangeAxis();
if (range != null) {
range.configure();
}
}
If you find a better way to overcome this problem, please let me know.
Regards,
Diego.