QWT 7.0.1
Loading...
Searching...
No Matches
qwt_plot_item.h
1/******************************************************************************
2 * Qwt Widget Library
3 * Copyright (C) 1997 Josef Wilgen
4 * Copyright (C) 2002 Uwe Rathmann
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the Qwt License, Version 1.0
8 *
9 * Modified by ChenZongYan in 2024 <czy.t@163.com>
10 * Summary of major modifications (see ChangeLog.md for full history):
11 * 1. CMake build system & C++11 throughout.
12 * 2. Core panner/ zoomer refactored:
13 * - QwtPanner → QwtCachePanner (pixmap-cache version)
14 * - New real-time QwtPlotPanner derived from QwtPicker.
15 * 3. Zoomer supports multi-axis.
16 * 4. Parasite-plot framework:
17 * - QwtFigure, QwtPlotParasiteLayout, QwtPlotTransparentCanvas,
18 * - QwtPlotScaleEventDispatcher, built-in pan/zoom on axis.
19 * 5. New picker: QwtPlotSeriesDataPicker (works with date axis).
20 * 6. Raster & color-map extensions:
21 * - QwtGridRasterData (2-D table + interpolation)
22 * - QwtLinearColorMap::stopColors(), stopPos() API rename.
23 * 7. Bar-chart: expose pen/brush control.
24 * 8. Amalgamated build: single QwtPlot.h / QwtPlot.cpp pair in src-amalgamate.
25 *****************************************************************************/
26
27#ifndef QWT_PLOT_ITEM_H
28#define QWT_PLOT_ITEM_H
29
30#include "qwt_global.h"
31#include "qwt_axis_id.h"
32#include <qmetatype.h>
33
34class QwtScaleMap;
35class QwtScaleDiv;
36class QwtPlot;
37class QwtText;
38class QwtGraphic;
39class QwtLegendData;
40class QRectF;
41class QPainter;
42class QString;
43template< typename T >
44class QList;
45
84class QWT_EXPORT QwtPlotItem
85{
86public:
155
166 {
168 Legend = 0x01,
169
175 AutoScale = 0x02,
176
182 Margins = 0x04
183 };
184
185 Q_DECLARE_FLAGS(ItemAttributes, ItemAttribute)
186
187
198 {
203 ScaleInterest = 0x01,
204
216 LegendInterest = 0x02
217 };
218
219 Q_DECLARE_FLAGS(ItemInterests, ItemInterest)
220
221
223 {
225 RenderAntialiased = 0x1
226 };
227
228 Q_DECLARE_FLAGS(RenderHints, RenderHint)
229
230 explicit QwtPlotItem();
231 explicit QwtPlotItem(const QString& title);
232 explicit QwtPlotItem(const QwtText& title);
233
234 virtual ~QwtPlotItem();
235
236 void attach(QwtPlot* plot);
237 void detach();
238
239 QwtPlot* plot() const;
240
241 void setTitle(const QString& title);
242 void setTitle(const QwtText& title);
243 const QwtText& title() const;
244
245 virtual int rtti() const;
246
247 void setItemAttribute(ItemAttribute, bool on = true);
248 bool testItemAttribute(ItemAttribute) const;
249
250 void setItemInterest(ItemInterest, bool on = true);
251 bool testItemInterest(ItemInterest) const;
252
253 void setRenderHint(RenderHint, bool on = true);
254 bool testRenderHint(RenderHint) const;
255
256 void setRenderThreadCount(uint numThreads);
257 uint renderThreadCount() const;
258
259 void setLegendIconSize(const QSize&);
260 QSize legendIconSize() const;
261
262 double z() const;
263 void setZ(double z);
264
265 void show();
266 void hide();
267 virtual void setVisible(bool);
268 bool isVisible() const;
269
270 void setAxes(QwtAxisId xAxis, QwtAxisId yAxis);
271
272 void setXAxis(QwtAxisId);
273 QwtAxisId xAxis() const;
274
275 void setYAxis(QwtAxisId);
276 QwtAxisId yAxis() const;
277
278 virtual void itemChanged();
279 virtual void legendChanged();
280
289 virtual void draw(QPainter* painter, const QwtScaleMap& xMap, const QwtScaleMap& yMap, const QRectF& canvasRect) const = 0;
290
291 virtual QRectF boundingRect() const;
292
293 virtual void getCanvasMarginHint(const QwtScaleMap& xMap,
294 const QwtScaleMap& yMap,
295 const QRectF& canvasRect,
296 double& left,
297 double& top,
298 double& right,
299 double& bottom) const;
300
301 virtual void updateScaleDiv(const QwtScaleDiv&, const QwtScaleDiv&);
302
303 virtual void updateLegend(const QwtPlotItem*, const QList< QwtLegendData >&);
304
305 QRectF scaleRect(const QwtScaleMap&, const QwtScaleMap&) const;
306 QRectF paintRect(const QwtScaleMap&, const QwtScaleMap&) const;
307
308 virtual QList< QwtLegendData > legendData() const;
309
310 virtual QwtGraphic legendIcon(int index, const QSizeF&) const;
311
312protected:
313 QwtGraphic defaultIcon(const QBrush&, const QSizeF&) const;
314
315private:
316 Q_DISABLE_COPY(QwtPlotItem)
317
318 class PrivateData;
319 PrivateData* m_data;
320};
321
322Q_DECLARE_OPERATORS_FOR_FLAGS(QwtPlotItem::ItemAttributes)
323Q_DECLARE_OPERATORS_FOR_FLAGS(QwtPlotItem::ItemInterests)
324Q_DECLARE_OPERATORS_FOR_FLAGS(QwtPlotItem::RenderHints)
325
326Q_DECLARE_METATYPE(QwtPlotItem*)
327
328#endif
Definition qwt_dyngrid_layout.h:33
A paint device for scalable graphics.
Definition qwt_graphic.h:93
Attributes of an entry on a legend.
Definition qwt_legend_data.h:54
Base class for items on the plot canvas.
Definition qwt_plot_item.h:85
virtual void draw(QPainter *painter, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect) const =0
Draw the item.
RttiValues
Runtime type information.
Definition qwt_plot_item.h:94
@ Rtti_PlotVectorField
For QwtPlotVectorField.
Definition qwt_plot_item.h:147
@ Rtti_PlotLegend
For QwtPlotLegendItem.
Definition qwt_plot_item.h:105
@ Rtti_PlotMarker
For QwtPlotMarker.
Definition qwt_plot_item.h:108
@ Rtti_PlotSpectroCurve
For QwtPlotSpectroCurve.
Definition qwt_plot_item.h:114
@ Rtti_PlotScale
For QwtPlotScaleItem.
Definition qwt_plot_item.h:102
@ Rtti_PlotHistogram
For QwtPlotHistogram.
Definition qwt_plot_item.h:120
@ Rtti_PlotZone
For QwtPlotZoneItem.
Definition qwt_plot_item.h:144
@ Rtti_PlotIntervalCurve
For QwtPlotIntervalCurve.
Definition qwt_plot_item.h:117
@ Rtti_PlotMultiBarChart
For QwtPlotMultiBarChart.
Definition qwt_plot_item.h:135
@ Rtti_PlotBarChart
For QwtPlotBarChart.
Definition qwt_plot_item.h:132
@ Rtti_PlotTradingCurve
For QwtPlotTradingCurve.
Definition qwt_plot_item.h:129
@ Rtti_PlotSpectrogram
For QwtPlotSpectrogram.
Definition qwt_plot_item.h:123
@ Rtti_PlotTextLabel
For QwtPlotTextLabel.
Definition qwt_plot_item.h:141
@ Rtti_PlotShape
For QwtPlotShapeItem.
Definition qwt_plot_item.h:138
@ Rtti_PlotGrid
For QwtPlotGrid.
Definition qwt_plot_item.h:99
@ Rtti_PlotCurve
For QwtPlotCurve.
Definition qwt_plot_item.h:111
@ Rtti_PlotGraphic
For QwtPlotGraphicItem, QwtPlotSvgItem.
Definition qwt_plot_item.h:126
RenderHint
Render hints.
Definition qwt_plot_item.h:223
ItemAttribute
Plot Item Attributes.
Definition qwt_plot_item.h:166
ItemInterest
Plot Item Interests/绘图项关注的事件类型
Definition qwt_plot_item.h:198
A 2-D plotting widget.
Definition qwt_plot.h:99
A class representing a scale division/表示刻度划分的类
Definition qwt_scale_div.h:53
A scale map.
Definition qwt_scale_map.h:44
A class representing a text.
Definition qwt_text.h:69