38 using namespace KDChart;
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";