1 | /* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
|
---|
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 |
|
---|
10 | #ifndef QWT_PLOT_ABSTRACT_BAR_CHART_H
|
---|
11 | #define QWT_PLOT_ABSTRACT_BAR_CHART_H
|
---|
12 |
|
---|
13 | #include "qwt_global.h"
|
---|
14 | #include "qwt_plot_seriesitem.h"
|
---|
15 | #include "qwt_series_data.h"
|
---|
16 |
|
---|
17 | /*!
|
---|
18 | \brief Abstract base class for bar chart items
|
---|
19 |
|
---|
20 | In opposite to almost all other plot items bar charts can't be
|
---|
21 | displayed inside of their bounding rectangle and need a special
|
---|
22 | API how to calculate the width of the bars and how they affect
|
---|
23 | the layout of the attached plot.
|
---|
24 | */
|
---|
25 | class QWT_EXPORT QwtPlotAbstractBarChart: public QwtPlotSeriesItem
|
---|
26 | {
|
---|
27 | public:
|
---|
28 | /*!
|
---|
29 | \brief Mode how to calculate the bar width
|
---|
30 |
|
---|
31 | setLayoutPolicy(), setLayoutHint(), barWidthHint()
|
---|
32 | */
|
---|
33 | enum LayoutPolicy
|
---|
34 | {
|
---|
35 | /*!
|
---|
36 | The sample width is calculated by dividing the bounding rectangle
|
---|
37 | by the number of samples. The layoutHint() is used as a minimum width
|
---|
38 | in paint device coordinates.
|
---|
39 |
|
---|
40 | \sa boundingRectangle()
|
---|
41 | */
|
---|
42 | AutoAdjustSamples,
|
---|
43 |
|
---|
44 | /*!
|
---|
45 | layoutHint() defines an interval in axis coordinates
|
---|
46 | */
|
---|
47 | ScaleSamplesToAxes,
|
---|
48 |
|
---|
49 | /*!
|
---|
50 | The bar width is calculated by multiplying layoutHint()
|
---|
51 | with the height or width of the canvas.
|
---|
52 |
|
---|
53 | \sa boundingRectangle()
|
---|
54 | */
|
---|
55 | ScaleSampleToCanvas,
|
---|
56 |
|
---|
57 | /*!
|
---|
58 | layoutHint() defines a fixed width in paint device coordinates.
|
---|
59 | */
|
---|
60 | FixedSampleSize
|
---|
61 | };
|
---|
62 |
|
---|
63 | explicit QwtPlotAbstractBarChart( const QwtText &title );
|
---|
64 | virtual ~QwtPlotAbstractBarChart();
|
---|
65 |
|
---|
66 | void setLayoutPolicy( LayoutPolicy );
|
---|
67 | LayoutPolicy layoutPolicy() const;
|
---|
68 |
|
---|
69 | void setLayoutHint( double );
|
---|
70 | double layoutHint() const;
|
---|
71 |
|
---|
72 | void setSpacing( int );
|
---|
73 | int spacing() const;
|
---|
74 |
|
---|
75 | void setMargin( int );
|
---|
76 | int margin() const;
|
---|
77 |
|
---|
78 | void setBaseline( double );
|
---|
79 | double baseline() const;
|
---|
80 |
|
---|
81 | virtual void getCanvasMarginHint(
|
---|
82 | const QwtScaleMap &xMap, const QwtScaleMap &yMap,
|
---|
83 | const QRectF &canvasRect,
|
---|
84 | double &left, double &top, double &right, double &bottom) const;
|
---|
85 |
|
---|
86 |
|
---|
87 | protected:
|
---|
88 | double sampleWidth( const QwtScaleMap &map,
|
---|
89 | double canvasSize, double boundingSize,
|
---|
90 | double value ) const;
|
---|
91 |
|
---|
92 | private:
|
---|
93 | class PrivateData;
|
---|
94 | PrivateData *d_data;
|
---|
95 | };
|
---|
96 |
|
---|
97 | #endif
|
---|