1
/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
3
* Copyright (C) 1997 Josef Wilgen
4
* Copyright (C) 2002 Uwe Rathmann
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
*****************************************************************************/
10
#ifndef QWT_PLOT_SCALE_ITEM_H
11
#define QWT_PLOT_SCALE_ITEM_H
13
#include "qwt_global.h"
14
#include "qwt_plot_item.h"
15
#include "qwt_scale_draw.h"
17
#if QT_VERSION < 0x040000
24
\brief A class which draws a scale inside the plot canvas
26
QwtPlotScaleItem can be used to draw an axis inside the plot canvas.
27
It might by synchronized to one of the axis of the plot, but can
28
also display its own ticks and labels.
30
It is allowed to synchronize the scale item with a disabled axis.
31
In plots with vertical and horizontal scale items, it might be
32
necessary to remove ticks at the intersections, by overloading
35
The scale might be at a specific position (f.e 0.0) or it might be
36
aligned to a canvas border.
39
The following example shows how to replace the left axis, by a scale item
40
at the x position 0.0.
42
QwtPlotScaleItem *scaleItem =
43
new QwtPlotScaleItem(QwtScaleDraw::RightScale, 0.0);
44
scaleItem->setFont(plot->axisWidget(QwtPlot::yLeft)->font());
45
scaleItem->attach(plot);
47
plot->enableAxis(QwtPlot::yLeft, false);
51
class QWT_EXPORT QwtPlotScaleItem: public QwtPlotItem
54
explicit QwtPlotScaleItem(
55
QwtScaleDraw::Alignment = QwtScaleDraw::BottomScale,
56
const double pos = 0.0);
57
virtual ~QwtPlotScaleItem();
59
virtual int rtti() const;
61
void setScaleDiv(const QwtScaleDiv& );
62
const QwtScaleDiv& scaleDiv() const;
64
void setScaleDivFromAxis(bool on);
65
bool isScaleDivFromAxis() const;
67
#if QT_VERSION < 0x040000
68
void setColorGroup(const QColorGroup &);
69
QColorGroup colorGroup() const;
71
void setPalette(const QPalette &);
72
QPalette palette() const;
75
void setFont(const QFont&);
78
void setScaleDraw(QwtScaleDraw *);
80
const QwtScaleDraw *scaleDraw() const;
81
QwtScaleDraw *scaleDraw();
83
void setPosition(double pos);
84
double position() const;
86
void setBorderDistance(int numPixels);
87
int borderDistance() const;
89
void setAlignment(QwtScaleDraw::Alignment);
91
virtual void draw(QPainter *p,
92
const QwtScaleMap &xMap, const QwtScaleMap &yMap,
93
const QRect &rect) const;
95
virtual void updateScaleDiv(const QwtScaleDiv&,