25 for (
int i = 0; i < values.size(); i++ )
27 const double y = values[ i ];
105 s.reserve( samples.size() );
107 for (
int i = 0; i < samples.size(); i++ )
166 if ( valueIndex < 0 )
173 if ( symbol != NULL )
183 if ( symbol != it.value() )
187 if ( symbol == NULL )
264 int sampleIndex,
int valueIndex )
const 266 Q_UNUSED( sampleIndex );
267 Q_UNUSED( valueIndex );
304 const size_t numSamples =
dataSize();
306 if ( numSamples == 0 )
317 if ( rect.height() >= 0 )
319 if ( rect.bottom() < baseLine )
320 rect.setBottom( baseLine );
321 if ( rect.top() > baseLine )
322 rect.setTop( baseLine );
327 double xMin, xMax, yMin, yMax;
330 yMin = yMax = baseLine;
334 for (
size_t i = 0; i < numSamples; i++ )
339 xMin = xMax = sample.
value;
347 const double y = baseLine + sample.
added();
352 rect.setRect( xMin, yMin, xMax - xMin, yMax - yMin );
356 rect.setRect( rect.y(), rect.x(), rect.height(), rect.width() );
376 const QRectF &canvasRect,
int from,
int to )
const 389 const QwtInterval interval( br.left(), br.right() );
393 for (
int i = from; i <= to; i++ )
396 canvasRect, interval, i,
sample( i ) );
417 const QRectF &canvasRect,
const QwtInterval &boundingInterval,
420 if ( sample.
set.size() <= 0 )
439 canvasRect, index, sampleW, sample );
444 canvasRect, index, sampleW, sample );
463 const QRectF &canvasRect,
int index,
double sampleWidth,
466 Q_UNUSED( canvasRect );
468 const int numBars = sample.
set.size();
474 const double barWidth = sampleWidth / numBars;
479 for (
int i = 0; i < numBars; i++ )
481 const double x1 = x0 + i * barWidth;
482 const double x2 = x1 + barWidth;
496 drawBar( painter, index, i, barRect );
501 const double barHeight = sampleWidth / numBars;
506 for (
int i = 0; i < numBars; i++ )
508 double y1 = y0 + i * barHeight;
509 double y2 = y1 + barHeight;
523 drawBar( painter, index, i, barRect );
543 const QRectF &canvasRect,
int index,
546 Q_UNUSED( canvasRect );
548 const int numBars = sample.
set.size();
569 for (
int i = 0; i < numBars; i++ )
571 const double si = sample.
set[ i ];
576 const double y2 = yMap.
transform( sum + si );
578 if ( ( y2 > y1 ) != increasing )
587 drawBar( painter, index, i, bar );
611 for (
int i = 0; i < sample.
set.size(); i++ )
613 const double si = sample.
set[ i ];
618 const double x2 = xMap.
transform( sum + si );
620 if ( ( x2 > x1 ) != increasing )
629 drawBar( painter, index, i, bar );
653 int sampleIndex,
int valueIndex,
const QwtColumnRect &rect )
const 656 if ( sampleIndex >= 0 )
661 sym =
symbol( valueIndex );
665 sym->
draw( painter, rect );
673 columnSymbol.
draw( painter, rect );
721 const QSizeF &size )
const 731 QPainter painter( &icon );
732 painter.setRenderHint( QPainter::Antialiasing,
735 drawBar( &painter, -1, index, column );
virtual void legendChanged()
const QwtColumnSymbol * symbol(int valueIndex) const
QMap< int, QwtColumnSymbol * > symbolMap
Qt::Orientation orientation() const
QwtInterval vInterval
Interval for the vertical coordinates.
QwtInterval normalized() const
Normalize the limits of the interval.
virtual QwtGraphic legendIcon(int index, const QSizeF &) const QWT_OVERRIDE
Interface for iterating over an array of samples.
virtual QRectF boundingRect() const =0
A class representing an interval.
Max value is not included in the interval.
QWT_CONSTEXPR float qwtMaxF(float a, float b)
virtual void drawSeries(QPainter *, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect, int from, int to) const QWT_OVERRIDE
A drawing primitive for columns.
void drawStackedBars(QPainter *, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect, int index, double sampleWidth, const QwtSetSample &) const
For QwtPlotMultiBarChart.
virtual int rtti() const QWT_OVERRIDE
void setData(QwtSeriesData< QwtSetSample > *series)
QwtPlotMultiBarChart displays a series of a samples that consist each of a set of values...
Direction direction
Direction.
virtual void drawBar(QPainter *, int sampleIndex, int valueIndex, const QwtColumnRect &) const
static bool qwtIsIncreasing(const QwtScaleMap &map, const QVector< double > &values)
QList< QwtText > barTitles
Abstract base class for bar chart items.
QwtSeriesData< QwtSetSample > * data()
QWT_CONSTEXPR float qwtMinF(float a, float b)
virtual QRectF boundingRect() const QWT_OVERRIDE
void setStyle(ChartStyle style)
void setBarTitles(const QList< QwtText > &)
Set the titles for the bars.
void setSamples(const QVector< QwtSetSample > &)
QSize legendIconSize() const
A sample of the types (x1...xn, y) or (x, y1..yn)
void setDefaultSize(const QSizeF &)
Set a default size.
virtual QList< QwtLegendData > legendData() const QWT_OVERRIDE
QList< QwtText > barTitles() const
void setSymbol(int valueIndex, QwtColumnSymbol *)
Add a symbol to the symbol map.
bool testRenderHint(RenderHint) const
double sampleWidth(const QwtScaleMap &map, double canvasSize, double boundingSize, double value) const
QwtPlotMultiBarChart::ChartStyle style
virtual QwtColumnSymbol * specialSymbol(int sampleIndex, int valueIndex) const
Create a symbol for special values.
A class representing a text.
Min value is not included in the interval.
void setFrameStyle(FrameStyle)
A paint device for scalable graphics.
virtual void drawSample(QPainter *, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect, const QwtInterval &boundingInterval, int index, const QwtSetSample &) const
void setBorderFlags(BorderFlags)
void setLineWidth(int width)
QwtSetSample sample(int index) const
virtual void itemChanged()
virtual ~QwtPlotMultiBarChart()
Destructor.
void drawGroupedBars(QPainter *, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect, int index, double sampleWidth, const QwtSetSample &) const
QwtPlotMultiBarChart(const QString &title=QString())
Directed rectangle representing bounding rectangle and orientation of a column.
void setValue(int role, const QVariant &)
virtual void draw(QPainter *, const QwtColumnRect &) const
QwtInterval hInterval
Interval for the horizontal coordinates.
virtual T sample(size_t i) const =0
The bars of a set are displayed side by side.
virtual size_t dataSize() const QWT_OVERRIDE
double transform(double s) const
double width() const
Return the width of an interval.
Min/Max values are inside the interval.
QVector< double > set
Vector of values associated to value.
Attributes of an entry on a legend.
virtual QRectF boundingRect() const QWT_OVERRIDE
const QwtText & title() const