25 mCategoryBrush.setStyle( Qt::SolidPattern );
26 mPen.setStyle( Qt::SolidLine );
56 maxValue = std::max( expression->
evaluate( &expressionContext ).toDouble(), maxValue );
68 double painterUnitConversionScale =
c.convertToPainterUnits( 1, s.
sizeType );
90 size.setWidth( size.width() + 2 * maxBleed );
91 size.setHeight( size.height() + 2 * maxBleed );
109 return value * scaleFactor;
122 if ( attributes.isEmpty() )
127 double maxValue = attributes.at( 0 ).toDouble();
129 for (
int i = 0; i < attributes.count(); ++i )
131 maxValue = std::max( attributes.at( i ).toDouble(), maxValue );
137 double painterUnitConversionScale =
c.convertToPainterUnits( 1, s.
sizeType );
145 mScaleFactor = maxValue / s.
size.height();
151 mScaleFactor = maxValue / s.
size.width();
159 size.setWidth( size.width() + 2 * maxBleed );
160 size.setHeight( size.height() + 2 * maxBleed );
168 QPainter *p =
c.painter();
174 QList<double> values;
186 double currentVal = expression->
evaluate( &expressionContext ).toDouble();
187 values.push_back( currentVal );
188 maxValue = std::max( currentVal, maxValue );
193 double currentOffset = 0;
198 double baseX = position.x();
199 double baseY = position.y();
215 QList<double>::const_iterator valIt = values.constBegin();
216 QList< QColor >::const_iterator colIt = s.
categoryColors.constBegin();
217 for ( ; valIt != values.constEnd(); ++valIt, ++colIt )
221 mCategoryBrush.setColor( *colIt );
222 p->setBrush( mCategoryBrush );
227 p->drawRect( QRectF( baseX + currentOffset, baseY, scaledWidth, length * -1 ) );
231 p->drawRect( QRectF( baseX + currentOffset, baseY - scaledMaxVal, scaledWidth, length ) );
235 p->drawRect( QRectF( baseX, baseY - scaledWidth * values.size() - spacing * std::max( 0, values.size() - 1 ) + currentOffset, length, scaledWidth ) );
239 p->drawRect( QRectF( baseX + scaledMaxVal, baseY - scaledWidth * values.size() - spacing * std::max( 0, values.size() - 1 ) + currentOffset, 0 - length, scaledWidth ) );
243 currentOffset += scaledWidth + spacing;
249 QPolygonF axisPoints;
253 axisPoints << QPointF( baseX, baseY - scaledMaxVal ) << QPointF( baseX, baseY ) << QPointF( baseX + scaledWidth * values.size() + spacing * std::max( 0, values.size() - 1 ), baseY );
257 axisPoints << QPointF( baseX, baseY ) << QPointF( baseX, baseY - scaledMaxVal ) << QPointF( baseX + scaledWidth * values.size() + spacing * std::max( 0, values.size() - 1 ), baseY - scaledMaxVal );
261 axisPoints << QPointF( baseX + scaledMaxVal, baseY - scaledWidth * values.size() - spacing * std::max( 0, values.size() - 1 ) )
262 << QPointF( baseX, baseY - scaledWidth * values.size() - spacing * std::max( 0, values.size() - 1 ) )
263 << QPointF( baseX, baseY );
267 axisPoints << QPointF( baseX, baseY - scaledWidth * values.size() - spacing * std::max( 0, values.size() - 1 ) )
268 << QPointF( baseX + scaledMaxVal, baseY - scaledWidth * values.size() - spacing * std::max( 0, values.size() - 1 ) )
269 << QPointF( baseX + scaledMaxVal, baseY );