简体   繁体   English

JChart2D性能

[英]JChart2D performance

I am plotting up to 16 traces, each one with 300 datapoints, I am updating continuously 100 datapoints every 100 ms. 我正在绘制多达16条迹线,每条迹线具有300个数据点,我每100毫秒不断更新100个数据点。 So on average I am updating in total 1600 datapoints every 100 ms and that is reaching the limit of points I can plot real time. 因此,平均而言,我每100毫秒总共更新1600个数据点,这已经达到我可以实时绘制的点数的极限。 Is there any way to improve even more the plotting speed or that amount of points is really reaching the limit of what can be achieved with JChart2D. 有什么方法可以提高绘制速度,或者点数确实达到了JChart2D可以达到的极限。

As a note, JChart2D is way better than other libraries as JFreeChart for real time applications. 需要注意的是,对于实时应用程序,JChart2D比其他库(如JFreeChart)要好得多。 JFreeChart has a great functionality but is pretty heavy for real time. JFreeChart具有强大的功能,但实时性却很沉重。

The loop I am actually using whenever the swing worker is notified that data has been added is the following: 每当通知Swing工人已添加数据时,我实际上使用的循环如下:

            for (int l = 0; l < readcycles; l++){   
                sixteenBitNumber = data[l];      
                for (int k = 0; k < (SampledSignalPerPacket); k+=ScreenPointJump){
                    for (int o = 0; o < root.getChildCount(); o++){
                        for (int p = 0; p < graphnodes[o].getChildCount(); p++){
                            if (seriesindex[o][p] > ScreenSize){
                                seriesindex[o][p] = 0;
                            }
                            datapoint = (float)(sixteenBitNumber[signalnodes[o][p].signalIndex + NbOfSampledSignal*k])*10/32767;                               
                            trace[o][p].addPoint(seriesindex[o][p], datapoint);
                            seriesindex[o][p] = seriesindex[o][p] + ScreenPointJump;//seriesindex[o][p]++;
                        }                               
                    }
                }   

            }

where trace has been initialized as 跟踪已初始化为

public Trace2DLtd[][] trace =  new Trace2DLtd[4][4];

Instead of the addPoint line, could you do this? 您可以代替addPoint行吗? I may be wrong though.. 我可能是错的。

                    datapoint = (float)(sixteenBitNumber[signalnodes[o][p].signalIndex + NbOfSampledSignal*k])*10/32767;                               
                    //trace[o][p].addPoint(seriesindex[o][p], datapoint);
                    avgX[o][p]+=seriesindex[o][p];  //Accumulate
                    avgY[o][p]+=datapoint;          //Accumulate
                    avgCounter[o][p]++;             //Keep track
                    if(avgCounter[o][p]==10){             //Done accumulating... plot average
                        trace[o][p].addPoint(avgX[o][p]/10, avgY[o][p]/10);   //Add average point
                        avgCounter[o][p]=0;  //Clear data
                        avgX[o][p]=0;        //Clear data
                        avgY[o][p]=0;        //Clear data
                    }
                    seriesindex[o][p] = seriesindex[o][p] + ScreenPointJump;//seriesindex[o][p]++;
                }                               
            }
        }   

    }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM