Note that there are some explanatory texts on larger screens.

plurals
  1. PODisplaying huge dataset in JFreeChart
    text
    copied!<p>I have an two-dimension array with the over of 100k records. When I'm trying to chart it - CPU is hard loading, and nothing else is going on. I've checked all the possible ways, including anti-alias, disabling event listeners etc. Nothing is working. And I assume a performance near 3-5 minutes (ok, that's relative thing, but I'd like to know how to reach it).</p> <p>Therefore, I'm asking if there is a way to display the data correctly? I'm having two functions, one for specifying the chart, and another for it's plotting:</p> <pre><code> public void plotXYChart(double dArray[][], String sPlotName, String sSeriesName, String sRangeName){ XYSeries series1 = new XYSeries(sSeriesName); series1.clear(); for (int i=0; i&lt; dArray.length; i++){ series1.add(dArray[i][0], dArray[i][1], false); } XYSeriesCollection dataset = new XYSeriesCollection(); dataset.removeAllSeries(); dataset.addSeries(series1); dataset.setAutoWidth(false); dataset.setIntervalWidth(2000); chart = ChartFactory.createXYLineChart(sPlotName, sSeriesName, sRangeName, dataset, PlotOrientation.VERTICAL, false, true, false); chart.setAntiAlias(false); XYPlot plot = (XYPlot) chart.getPlot(); plot.getDomainAxis().setStandardTickUnits(new StandardTickUnitSource()); plot.getRangeAxis().setStandardTickUnits(new StandardTickUnitSource()); SamplingXYLineRenderer renderer = new SamplingXYLineRenderer(); plot.setRenderer(renderer); plotChart(sPlotName, chart); } private void plotChart(String sPlotName, JFreeChart chart){ if (this.cPanel!=null) cPanel.setChart(chart); else cPanel = new ChartPanel(chart); cPanel.setAutoscrolls(false); cPanel.setDomainZoomable(false); cPanel.setRangeZoomable(false); cPanel.setRefreshBuffer(false); cPanel.setDoubleBuffered(rootPaneCheckingEnabled); this.chartFrame.add(cPanel); this.chartFrame.pack(); if (this.chartFrame.isVisible() == false) RefineryUtilities.centerFrameOnScreen(this.chartFrame); this.chartFrame.setVisible(true); } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload