qwt_plot_seriesitem.cpp
/******************************************************************************
* Qwt Widget Library
* Copyright (C) 1997 Josef Wilgen
* Copyright (C) 2002 Uwe Rathmann
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the Qwt License, Version 1.0
*****************************************************************************/
#include "qwt_plot_seriesitem.h"
#include "qwt_scale_div.h"
#include "qwt_text.h"
class QwtPlotSeriesItem::PrivateData
{
public:
PrivateData()
: orientation( Qt::Vertical )
{
}
Qt::Orientation orientation;
};
QwtPlotSeriesItem::QwtPlotSeriesItem( const QwtText& title )
: QwtPlotItem( title )
{
m_data = new PrivateData();
setItemInterest( QwtPlotItem::ScaleInterest, true );
}
QwtPlotSeriesItem::QwtPlotSeriesItem( const QString& title )
: QwtPlotItem( QwtText( title ) )
{
m_data = new PrivateData();
setItemInterest( QwtPlotItem::ScaleInterest, true );
}
QwtPlotSeriesItem::~QwtPlotSeriesItem()
{
delete m_data;
}
void QwtPlotSeriesItem::setOrientation( Qt::Orientation orientation )
{
if ( m_data->orientation != orientation )
{
m_data->orientation = orientation;
legendChanged();
itemChanged();
}
}
Qt::Orientation QwtPlotSeriesItem::orientation() const
{
return m_data->orientation;
}
void QwtPlotSeriesItem::draw( QPainter* painter,
const QwtScaleMap& xMap, const QwtScaleMap& yMap,
const QRectF& canvasRect ) const
{
drawSeries( painter, xMap, yMap, canvasRect, 0, -1 );
}
QRectF QwtPlotSeriesItem::boundingRect() const
{
return dataRect();
}
void QwtPlotSeriesItem::updateScaleDiv(
const QwtScaleDiv& xScaleDiv, const QwtScaleDiv& yScaleDiv )
{
const QRectF rect = QRectF(
xScaleDiv.lowerBound(), yScaleDiv.lowerBound(),
xScaleDiv.range(), yScaleDiv.range() );
setRectOfInterest( rect );
}
void QwtPlotSeriesItem::dataChanged()
{
itemChanged();
}
QwtAbstractSeriesStore::dataRect
virtual QRectF dataRect() const =0
QwtAbstractSeriesStore::setRectOfInterest
virtual void setRectOfInterest(const QRectF &)=0
QwtPlotItem
Base class for items on the plot canvas.
Definition: qwt_plot_item.h:67
QwtPlotItem::legendChanged
virtual void legendChanged()
Definition: qwt_plot_item.cpp:491
QwtPlotItem::setItemInterest
void setItemInterest(ItemInterest, bool on=true)
Definition: qwt_plot_item.cpp:279
QwtPlotItem::itemChanged
virtual void itemChanged()
Definition: qwt_plot_item.cpp:481
QwtPlotItem::ScaleInterest
@ ScaleInterest
Definition: qwt_plot_item.h:185
QwtPlotSeriesItem::orientation
Qt::Orientation orientation() const
Definition: qwt_plot_seriesitem.cpp:77
QwtPlotSeriesItem::dataChanged
virtual void dataChanged() override
dataChanged() indicates, that the series has been changed.
Definition: qwt_plot_seriesitem.cpp:112
QwtPlotSeriesItem::setOrientation
void setOrientation(Qt::Orientation)
Definition: qwt_plot_seriesitem.cpp:62
QwtPlotSeriesItem::~QwtPlotSeriesItem
virtual ~QwtPlotSeriesItem()
Destructor.
Definition: qwt_plot_seriesitem.cpp:48
QwtPlotSeriesItem::updateScaleDiv
virtual void updateScaleDiv(const QwtScaleDiv &, const QwtScaleDiv &) override
Update the item to changes of the axes scale division.
Definition: qwt_plot_seriesitem.cpp:102
QwtPlotSeriesItem::draw
virtual void draw(QPainter *, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect) const override
Draw the complete series.
Definition: qwt_plot_seriesitem.cpp:90
QwtPlotSeriesItem::QwtPlotSeriesItem
QwtPlotSeriesItem(const QString &title=QString())
Definition: qwt_plot_seriesitem.cpp:40
QwtPlotSeriesItem::boundingRect
virtual QRectF boundingRect() const override
Definition: qwt_plot_seriesitem.cpp:97
QwtPlotSeriesItem::drawSeries
virtual void drawSeries(QPainter *painter, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect, int from, int to) const =0
QwtScaleDiv
A class representing a scale division.
Definition: qwt_scale_div.h:34
QwtScaleDiv::lowerBound
double lowerBound() const
Definition: qwt_scale_div.cpp:131
QwtScaleDiv::range
double range() const
Definition: qwt_scale_div.cpp:159
QwtScaleMap
A scale map.
Definition: qwt_scale_map.h:27
QwtText
A class representing a text.
Definition: qwt_text.h:52