26 mCategoryBrush.setStyle( Qt::SolidPattern );
27 mPen.setStyle( Qt::SolidLine );
57 maxValue = std::max( expression->
evaluate( &expressionContext ).toDouble(), maxValue );
69 double painterUnitConversionScale =
c.convertToPainterUnits( 1, s.
sizeType );
91 size.setWidth( size.width() + 2 * maxBleed );
92 size.setHeight( size.height() + 2 * maxBleed );
110 return value * scaleFactor;
123 if ( attributes.isEmpty() )
128 double maxValue = attributes.at( 0 ).toDouble();
130 for (
int i = 0; i < attributes.count(); ++i )
132 maxValue = std::max( attributes.at( i ).toDouble(), maxValue );
138 double painterUnitConversionScale =
c.convertToPainterUnits( 1, s.
sizeType );
146 mScaleFactor = maxValue / s.
size.height();
152 mScaleFactor = maxValue / s.
size.width();
160 size.setWidth( size.width() + 2 * maxBleed );
161 size.setHeight( size.height() + 2 * maxBleed );
169 QPainter *p =
c.painter();
175 QList<double> values;
187 double currentVal = expression->
evaluate( &expressionContext ).toDouble();
188 values.push_back( currentVal );
189 maxValue = std::max( currentVal, maxValue );
194 double currentOffset = 0;
199 double baseX = position.x();
200 double baseY = position.y();
216 QList<double>::const_iterator valIt = values.constBegin();
217 QList< QColor >::const_iterator colIt = s.
categoryColors.constBegin();
218 for ( ; valIt != values.constEnd(); ++valIt, ++colIt )
222 QColor brushColor( *colIt );
223 brushColor.setAlphaF( brushColor.alphaF() * s.
opacity );
224 mCategoryBrush.setColor( brushColor );
225 p->setBrush( mCategoryBrush );
230 p->drawRect( QRectF( baseX + currentOffset, baseY, scaledWidth, length * -1 ) );
234 p->drawRect( QRectF( baseX + currentOffset, baseY - scaledMaxVal, scaledWidth, length ) );
238 p->drawRect( QRectF( baseX, baseY - scaledWidth * values.size() - spacing * std::max( 0,
static_cast<int>( values.size() ) - 1 ) + currentOffset, length, scaledWidth ) );
242 p->drawRect( QRectF( baseX + scaledMaxVal, baseY - scaledWidth * values.size() - spacing * std::max( 0,
static_cast<int>( values.size() ) - 1 ) + currentOffset, 0 - length, scaledWidth ) );
246 currentOffset += scaledWidth + spacing;
252 QPolygonF axisPoints;
256 axisPoints << QPointF( baseX, baseY - scaledMaxVal ) << QPointF( baseX, baseY ) << QPointF( baseX + scaledWidth * values.size() + spacing * std::max( 0,
static_cast<int>( values.size() ) - 1 ), baseY );
260 axisPoints << QPointF( baseX, baseY ) << QPointF( baseX, baseY - scaledMaxVal ) << QPointF( baseX + scaledWidth * values.size() + spacing * std::max( 0,
static_cast<int>( values.size() ) - 1 ), baseY - scaledMaxVal );
264 axisPoints << QPointF( baseX + scaledMaxVal, baseY - scaledWidth * values.size() - spacing * std::max( 0,
static_cast<int>( values.size() ) - 1 ) )
265 << QPointF( baseX, baseY - scaledWidth * values.size() - spacing * std::max( 0,
static_cast<int>( values.size() ) - 1 ) )
266 << QPointF( baseX, baseY );
270 axisPoints << QPointF( baseX, baseY - scaledWidth * values.size() - spacing * std::max( 0,
static_cast<int>( values.size() ) - 1 ) )
271 << QPointF( baseX + scaledMaxVal, baseY - scaledWidth * values.size() - spacing * std::max( 0,
static_cast<int>( values.size() ) - 1 ) )
272 << QPointF( baseX + scaledMaxVal, baseY );