Menu

setMaxDataPointsPerGraph

Anonymous
2017-07-26
2017-07-26
  • Anonymous

    Anonymous - 2017-07-26

    The deletion of old points is random, it is better that the inserted X corredinate defines what Y data is deleted.
    jsoya£@fiaskosoftware.com

     
  • Stefan Zieker

    Stefan Zieker - 2017-07-26

    Hi,

    you mean the automatically deletion of points if the max. number of points are reached?
    I can implement a function which can delete all points which have a smaller x value then the specified. Do you mean this?

    Best regards,
    Stefan

     
  • Anonymous

    Anonymous - 2017-07-26

    I have a repeating stream of 200 Points, each at their own index - for building an XY Graph.
    What i need is one of :

    when i "update" the Y value at a certain X, all the "old" Y value for that X point is discarged.
    Or -
    The point deleted is always the "oldest" point in the list. (having more than on y value per X is actually good for showing noise).

    Another thing, id would be nice if the X Axis did not move around at the start - but this is a "fixed" setup and not the "time graph" setup that is the basic function of the graph tool used.

    You can se a kind of "scope" here http://fiaskosoftware.com/projekter/3027/3027%20intro.html
    I have done many "scope" displays for embedded systems (and win) and the "deletion" of old points is always a challenge.

    But anyhow the ScriptCommunicator is very usefull and will certainly be used - I have been looking into the Sourcecode but i could not find the graph module.

    Kind regards, and keep up the good work.
    Joakim

     
  • Stefan Zieker

    Stefan Zieker - 2017-07-26

    Hi Joakim,

    I think it is no problem to extend the PlotWidget for your use case. I will have a look on it next week and implement the new functionality.

    The ScriptPlotWindow class can be found in scriptClasses\plotwindow.h and the ScriptPlotWidget can be found in scriptClasses\scriptUiClasses\scriptPlotwidget.h (ScriptPlotWindow uses the ScriptPlotWidget).

    Example addDataToGraph:
    If you call ScriptPlotWidget::addDataToGraph (scriptClasses\scriptUiClasses\scriptPlotwidget.h line 59) from script (which runs in its own thread) the addDataToGraphSignal signal is emitted. This signal is connected to ScriptPlotWidget::addDataToGraphSlot. This slot function is executed in the main thread (all GUI functions must be executed here) and calls the QCustomPlot functionality.

    I think it should be no problem for you to create a branch on Github and implement your functionality by yourself (I would support you and integrate your changes in the main branch).

    But as I said I willl have a look on it next week and implement this new functionality if you don't implement it by yourself.

    Best regards,
    Stefan

     
  • Anonymous

    Anonymous - 2017-07-27

    Hi Stefan Thanks.
    I had a look into qcqustomplot homepage, and it seemd they have been working on a new "data container" for version 2.0.0

    I think that the issue is, that the current (1.3.2) version of QCustomplot do not know in what sequence the points arrived in or how to reassign a specific X coredinates Y values (it is probably only kept as graphical positions, and all the intermediate points on a "line" also needs to be "moved") .

    If you can make a function/parameter that fixes the X-Axis, i just can delete the graph data and then refill like at each 10 points - giving pseudo live image. ( the scan frequency is around 1-2 seconds)

    Many Regards, Joakim.

     
  • Stefan Zieker

    Stefan Zieker - 2017-07-27

    Hi Joakim,

    'If you can make a function/parameter that fixes the X-Axi'.

    So I shall add a function which removes all points between 2 x-axis values? Or do you man I shall switch to QCustumPlot 2.0?

    Best regards,
    Stefan

     
  • Anonymous

    Anonymous - 2017-07-27

    Hi Stefan
    a function which removes all points between 2 x-axis values will do the job.
    If i write the Xaxis reversed (high to low) the "rescaling" is not active.
    Joakim

     
  • Stefan Zieker

    Stefan Zieker - 2017-07-27

    Hi Joakim,

    I have uploaded a new prelease (Files/Test) which contains:
    - QCustomPlot 2.0
    - removeDataRangeFromGraph (you can find an example in exampleScripts\WorkerScripts\PlotWindow)

    Best regards,
    Stefan

     
  • Anonymous

    Anonymous - 2017-07-27

    Hi Stefan.
    Thank you. now i get what i want.
    I use two graphs for each curve, and do some "double buffering" using the removeDataRange.. function.

    function readyReadSlot() {
    var data;
    var nydata;
    if (serialPort.canReadLine())
    {
    data = serialPort.readLine()
    nydata = data.split(",");
    scriptThread.appendTextToConsole("data VV received: " + nydata[0] +" " +nydata[1] +" " +nydata[2] +" " +nydata[2]);
    if (data[0] == "0")
    {
    start = "1";
    lastx = 0;
    if (flip == 1) {flip = 0; } else { flip = 1; }
    }
    if ((start == "1") & (nydata[0] == lastx))
    {
    x = nydata[0] ;
    y1= nydata[2];
    y2 = nydata[3];
    if (flip == 1)
    {
    // Erase Old Points
    plotWindow.removeDataRangeFromGraph( plotWindowGraph1AIndex,x, x+1);
    plotWindow.removeDataRangeFromGraph(plotWindowGraph2AIndex,x, x+1);
    // Set New
    plotWindow.addDataToGraph(plotWindowGraph1AIndex,x, y1);
    plotWindow.addDataToGraph(plotWindowGraph2AIndex,x,y2);
    }
    else
    {
    // Erase Old Points
    plotWindow.removeDataRangeFromGraph( plotWindowGraph1BIndex,x, x+1);
    plotWindow.removeDataRangeFromGraph(plotWindowGraph2BIndex,x, x+1);
    // Set New
    plotWindow.addDataToGraph(plotWindowGraph1BIndex,x, y1);
    plotWindow.addDataToGraph(plotWindowGraph2BIndex,x, y2);
    }
    lastx = lastx+1;
    }
    }
    }

    Regards Joakim
    
     

Anonymous
Anonymous

Add attachments
Cancel





Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.