Qwt 和 QwtSeriesData
我最初使用C编程语言。但是现在,我需要使用Qt编程(顺便说一句,Qt就像一个梦)。我将一步步深入。但是我的C++面向对象知识比较薄弱,希望能够更强一些。现在我必须使用 Qwt,并且我陷入了 QwtSeriesData 对象。我需要知道如何为该对象设置一系列数据,以便使用 QwtPlot 绘制曲线。
例如我的数据如下所示,如何将它们设置到 QwtSeriesData 中。
浮动x[300]; 浮动y[300];
谢谢。
I originally use C Programming language. But Now, I need to use Qt programming (by the way, Qt is like a dream). I am going to more depth step by step. But my C++ object oriented knowledge is weak, I hope that it will be stronger. Nowadays I have to use Qwt and I stucked in QwtSeriesData object. I need to know how can I set a series of data to this object in order to draw a curve with using QwtPlot.
For example my data is like below, how can I set them into QwtSeriesData.
float x[300];
float y[300];
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我的答案是最新的 qwt 版本 6.xx(当前最新)
注意:qwt 内部使用 double 来表示数据,而不是 float。因此,您要么应该使用 double,要么需要实现自己的 QwtSeriesData 实现,该实现将 float 保留在内存中,但为外部组件的请求提供 double (这是一种非常糟糕的做法)
您可以使用由 QwtSeriesData 提供的子类之一重量:
QwtCPointerData
或QwtPointArrayData
。My answer is for latest qwt version 6.x.x (latest for current moment)
Note: qwt internally uses double for data representation, not float. So you either should use double or you would need to implement your own QwtSeriesData implementation which holds float in memory but provides double for requests of external components (that's a really bad way of doing things)
You can use one of subclasses of QwtSeriesData provided by the qwt:
QwtCPointerData
orQwtPointArrayData
.我就是这样做的:
然后您需要将曲线附加到绘图上。
This is how I do it:
you then need to attach the curve to the plot.