51 m_fifty->
setText( QObject::tr(
"50%" ) );
53 diagram->addAxis(
this );
58 delete m_label; m_label = 0;
59 delete m_fifty; m_fifty = 0;
74 QPainter* p = paintContext->
painter();
82 labels << m_label << m_fifty;
84 const QPixmap& pixmap = label->
pixmap();
87 p->drawPixmap( point, pixmap );
110 return QSize( 100, 100 );
115 return QSize( 300, 200 );
120 return QSize( 150, 100 );
125 return Qt::Vertical | Qt::Horizontal;
141 qDebug() <<
"TernaryAxis::setPosition: only south, east and west are supported " 142 "positions for ternary axes.";
146 if ( m_title.isEmpty() )
147 switch ( p.
value() ) {
162 updatePrerenderedLabels();
173 return m_label->
text();
178 m_titleAttributes = a;
179 updatePrerenderedLabels();
184 return m_titleAttributes;
190 m_titleAttributes = a;
191 updatePrerenderedLabels();
197 return m_titleAttributes == a;
200 void TernaryAxis::updatePrerenderedLabels()
203 qreal axisLabelAngle = 0.0;
204 qreal fiftyMarkAngle = 0.0;
205 QPointF axisLabelPosition;
206 QPointF fiftyMarkPosition;
212 axisLabelAngle = 0.0;
213 fiftyMarkAngle = 0.0;
220 axisLabelAngle = 240.0;
228 axisLabelAngle = 120.0;
229 fiftyMarkAngle = 300.0;
237 qDebug() <<
"TernaryAxis::updatePrerenderedLabel: unknown location";
242 m_label->
setAngle( axisLabelAngle );
245 QFont font = attributes.
font();
246 font.setPointSizeF( 0.85 * font.pointSizeF() );
248 m_fifty->
setAngle( fiftyMarkAngle );
255 QSizeF topleft( 0.0, 0.0 );
256 QSizeF bottomRight( 0.0, 0.0 );
261 topleft.setHeight( m_label->
pixmap().height() );
262 bottomRight.setHeight( m_fifty->
pixmap().height() );
265 bottomRight.setWidth( m_label->
pixmap().width()
267 bottomRight.setHeight( m_label->
pixmap().height()
271 topleft.setWidth( m_label->
pixmap().width()
272 - ( m_label->
pixmap().width()
274 bottomRight.setHeight( m_label->
pixmap().height()
275 - ( m_label->
pixmap().height()
279 qDebug() <<
"TernaryAxis::requiredMargins: unknown location";
KDChartEnums::PositionValue value() const
Returns an integer value corresponding to this Position.
Ternary coordinate plane.
const QString & text() const
Project global class providing some enums needed both by KDChartParams and by KDChartCustomBox.
void setTitleTextAttributes(const TextAttributes &a)
const QPointF AxisVector_B_A
const QPointF TriangleBottomRight
AbstractCoordinatePlane * coordinatePlane() const
const QPixmap & pixmap() const override
Returns the rendered element.
const QPointF AxisVector_C_A
QPainter * painter() const
const QPointF & position() const
Get the position of the element.
const QPointF AxisVector_B_C
QSize minimumSize() const override
QSize maximumSize() const override
QRect geometry() const override
QStringList labels() const
Returns a list of strings, that are used as axis labels, as set via setLabels.
void setFont(const QFont &font)
Sets the label's font to font.
const QPointF TriangleBottomLeft
QPointF referencePointLocation(KDChartEnums::PositionValue position) const override
Return the location of the reference point relatively to the pixmap's origin.
virtual void setPosition(Position p)
bool isEmpty() const override
void paintAll(QPainter &) override
Call paintAll, if you want the background and the frame to be drawn before the normal paint() is invo...
PrerenderedLabel is an internal KDChart class that simplifies creation and caching of cached text lab...
virtual const Position position() const
void setReferencePoint(KDChartEnums::PositionValue)
Set the reference point of the element.
void setText(const QString &text)
Sets the label's text to text.
Qt::Orientations expandingDirections() const override
PositionValue
Numerical values of the static KDChart::Position instances, for using a Position::value() with a swit...
Stores information about painting diagrams.
Base class for diagrams based on a ternary coordinate plane.
bool hasDefaultTitleTextAttributes() const
void resetTitleTextAttributes()
void setPosition(const QPointF &position)
Set the position of the element.
TextAttributes titleTextAttributes() const
void paint(QPainter *) override
void setAngle(qreal angle)
Sets the angle of the label to angle degrees.
void setGeometry(const QRect &rect) override
QSize sizeHint() const override
void setTitleText(const QString &text)
QPair< QSizeF, QSizeF > requiredMargins() const
Defines a position, using compass terminology.
const QPointF TriangleTop
QString titleText() const
const qreal RelMarkerLength
void paintCtx(PaintContext *) override
Default impl: Paint the complete item using its layouted position and size.
TernaryAxis(AbstractTernaryDiagram *diagram=0)
A set of text attributes.
const QPointF translate(const QPointF &diagramPoint) const override
Translate the given point in value space coordinates to a position in pixel space.