Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7930959
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T20:34:51+00:00 2026-06-03T20:34:51+00:00

I am using QWT 6 and I am trying to plot some dots every

  • 0

I am using QWT 6 and I am trying to plot some dots every second. To do that I use the following code:

d_plot_dots->setRawSamples(_realDataPoints, _imagDataPoints, size);
plot->replot();

I want to support a hold on option, so dots from previous seconds to be still visible at the plot. One solution to this is to resize every second the arrays that hold the points, append the new values and call again the setRawSamples() and the replot(), but this solution is not memory efficient as at every seconds I have to store at least 2 * 2048 points.

Is there any, more efficient way?
Thanks in advance!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T20:34:52+00:00Added an answer on June 3, 2026 at 8:34 pm

    The solution to that was the use of directPainter.
    Following the realtime example of the QWT I done the following:

    First I created the helper class CurveData.

    class CurveData: public QwtArraySeriesData<QPointF>
    {
    public:
      CurveData()
      {
      }
    
      virtual QRectF boundingRect() const
      {
        if ( d_boundingRect.width() < 0.0 )
          d_boundingRect = qwtBoundingRect( *this );
    
        return d_boundingRect;
      }
    
    
      inline void replace(double *x, double *y, int size)
      {
        if(d_samples.size() != size){
          d_samples.resize(size);
        }
        for(int i = 0; i < size; i++){
          d_samples.replace(i, QPointF(x[i], y[i]));
        }
      }
    
    
      void clear()
      {
        d_samples.clear();
        d_samples.squeeze();
        d_boundingRect = QRectF( 0.0, 0.0, -1.0, -1.0 );
      }
    };
    

    And then at my plotting code:

    void
    PlottingClass::plotHoldOnPoints(int size)
    {
       CurveData *data = static_cast<CurveData *>( d_curve->data() );
       data->replace(_realDataPoints, _imagDataPoints, size);
       d_direct_painter->drawSeries(d_curve, 0, data->size() -1);
    }
    

    And the hold on effect with minimum memory consumption is ready!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to get the following c++ program using Qwt v. 6.0.1 to work:
Using LINQ on collections, what is the difference between the following lines of code?
I am trying to use Qwt in one of my Qt DLLs. The thing
I try to build chart demo using Qwt and C++. I've added the following
Using this code, the following execution yields strange results: C 100 R W The
I'm trying to make a Qt program using Qt Creator and Qwt for plotting.
Using Rails 3.2.0.rc2 and ruby 1.9.3p0 In app/views/requests/_form.html.erb I have the following code for
Using C# .NET 3.5 and WCF, I'm trying to write out some of the
Using Rails 3.1. I have some pages that render same layout, except the contents
Using DMD 2.057, I cannot get the following code to compile: import std.stdio; import

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.