Choosing wich XYDataItem to print

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
sonnenhohl
Posts: 2
Joined: Tue Apr 24, 2018 8:13 pm
antibot: No, of course not.

Choosing wich XYDataItem to print

Post by sonnenhohl » Fri Apr 27, 2018 6:13 pm

I have a series with many points wich i collect each 250microseconds, its not possible to get a good performance printing a 10 seconds range with so many points(10 * 1000 / 0.250 = 40000 points) and also not good for visibility, i monitor the zoom to change the series to a series with less data according to the time range limiting by example to 2000 points, but with this kind of implementation i need to create multiple series and set it to visibile according to the current visible range.

Im looking for a way to use only one series and control wich points to draw, i tried override the method:

class CustomRenderer extends XYLineAndShapeRenderer {

@Override
public void drawItem(Graphics2D g2, XYItemRendererState state, Rectangle2D dataArea, PlotRenderingInfo info, XYPlot plot, ValueAxis domainAxis, ValueAxis rangeAxis, XYDataset dataset, int series, int item, CrosshairState crosshairState, int pass) {
if (item % 160 == 0) {
super.drawItem(g2, state, dataArea, info, plot, domainAxis, rangeAxis, dataset, series, item, crosshairState, pass);
} else {
//none
}
}

With this code a line between the points is not drawed, how can i fix this? Which kind of approach i should use?

paradoxoff
Posts: 1634
Joined: Sat Feb 17, 2007 1:51 pm

Re: Choosing wich XYDataItem to print

Post by paradoxoff » Sun Apr 29, 2018 5:54 pm

If you want to quickly plot a large number of data points as a line chart, look at the SmaplingXYLineRenderer.

Locked