Results 1 to 10 of 10

Thread: Regarding qt real time plot using qml wrapper for Qcustomplot

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Aug 2016
    Posts
    14
    Thanks
    1
    Qt products
    Qt5
    Platforms
    Unix/X11

    Default Regarding qt real time plot using qml wrapper for Qcustomplot

    I am using the following wrapper: https://github.com/ncp1402/ql-lineplot to plot the data in real-time, I could plot the data in a static manner (not real time) however, on trying the below code (relevant for realtime), my application crashes (no error message)

    Qt Code:
    1. import QtQuick 2.0
    2.  
    3. import 'src/qml'
    4. import QtQuick.Layouts 1.2
    5. QlLinePlot { id:plot; Layout.fillWidth:true; Layout.fillHeight:true;
    6.  
    7. // X/Y labels
    8. labelX: 'time'
    9. labelY: 'Values'
    10.  
    11. // show legend
    12. legend: true
    13.  
    14. // enable/disable autorange
    15. autoRange: true
    16.  
    17. // enable/disable X/Y mouse drag
    18. dragX: true
    19. dragY: true
    20.  
    21. // enable/disable X/Y mouse zoom (with Shift - only X, with Ctrl - only Y)
    22. zoomX: true
    23. zoomY: true
    24.  
    25. // enable/disable time/date format for X axis
    26. xDate: true
    27. // time/date format
    28. xDateFormat: 'hh.mm.ss'
    29. yPrev:[4,2,3]
    30.  
    31. property var colors: ['red']
    32. property var names: ['T1']
    33. Timer{
    34. id:textTimer
    35. interval:1000
    36. repeat:true
    37. running:true
    38. triggeredOnStart: true
    39. // initialize plot
    40. Component.onCompleted: {
    41. // remove all graphs
    42. //clearGraphs();
    43. // add new graphs
    44. for (var i=0; i <= colors.length; i++)
    45. addGraph(names[i], true, colors[i], 3, 'solid');
    46.  
    47. var i1=0;
    48. while(adcreader.hasSample()) //check whether a sample is present or not
    49. {
    50.  
    51. plot.addPoints(i1, [adcreader.getSample()]); //get it and plot
    52. i1++;
    53. }
    54. plot.visible= true;
    55.  
    56. }
    57. }
    58.  
    59. }
    To copy to clipboard, switch view to plain text mode 

    I think there is some mistake in the way I have tried to plot, since, I don't have experience of using Qt, any suggestions regarding the changes required will be great!
    Last edited by user03; 26th August 2016 at 18:21.

Similar Threads

  1. Qwt real-time plot memory problem
    By speak_no_evil in forum Qwt
    Replies: 1
    Last Post: 20th November 2014, 10:20
  2. How to real time plot?
    By RafaelRSE in forum Qwt
    Replies: 2
    Last Post: 7th August 2014, 18:14
  3. Replies: 3
    Last Post: 12th April 2013, 06:18
  4. real time graph plot
    By robotics in forum Qt Programming
    Replies: 5
    Last Post: 24th May 2011, 05:04
  5. QFileSystemWatcher with a Qwt Real-time plot
    By gen_mass in forum Qt Programming
    Replies: 1
    Last Post: 25th June 2010, 21:28

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.