Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
QmitkHistogram.h
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 #ifndef QmitkHistogram_h
14 #define QmitkHistogram_h
15 
16 #include <QColor>
17 
18 #include <qwt_plot_item.h>
19 #include <qwt_series_data.h>
20 #include <qwt_text.h>
21 
31 class QmitkHistogram : public QwtPlotItem
32 {
33 public:
38  explicit QmitkHistogram(const QString &title = QString());
39 
44  explicit QmitkHistogram(const QwtText &title);
45 
47  ~QmitkHistogram() override;
48 
53  void setData(const QwtIntervalSeriesData &data);
54 
59  const QwtIntervalSeriesData &data() const;
60 
65  void setColor(const QColor &color);
66 
71  QColor color() const;
72 
77  QRectF boundingRect() const override;
78 
86  void draw(QPainter *painter, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect) const override;
87 
92  void setBaseline(double reference);
93 
98  double baseline() const;
99 
100 protected:
107  virtual void drawBar(QPainter *painter, Qt::Orientation o, const QRect &rect) const;
108 
109 private:
110  void init();
111 
112  class HistogramData;
113  HistogramData *m_Data;
114 };
115 
116 #endif
A QwtPlotItem that renders a histogram as vertical bars in a QwtPlot.
QRectF boundingRect() const override
Calculate the bounding rectangle of the histogram data.
~QmitkHistogram() override
Destructor.
const QwtIntervalSeriesData & data() const
Get the current interval series data.
void setData(const QwtIntervalSeriesData &data)
Set the interval series data for the histogram.
void setBaseline(double reference)
Set the baseline reference value for the histogram.
QColor color() const
Get the current bar color.
QmitkHistogram(const QwtText &title)
Construct a histogram with a formatted QwtText title.
QmitkHistogram(const QString &title=QString())
Construct a histogram with a plain text title.
double baseline() const
Get the current baseline reference value.
virtual void drawBar(QPainter *painter, Qt::Orientation o, const QRect &rect) const
Draw a single histogram bar with 3D shading.
void setColor(const QColor &color)
Set the fill color for the histogram bars.
void draw(QPainter *painter, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect) const override
Draw the histogram bars onto the given painter.