158 QRectF rect = d_data->data->boundingRect();
162 if(d_data->attributes & Xfy) {
163 rect = QRectF(rect.y(), rect.x(),
164 rect.height(), rect.width());
166 if(rect.left() > d_data->reference)
167 rect.setLeft(d_data->reference);
168 else if(rect.right() < d_data->reference)
169 rect.setRight(d_data->reference);
172 if(rect.bottom() < d_data->reference)
173 rect.setBottom(d_data->reference);
174 else if(rect.top() > d_data->reference)
175 rect.setTop(d_data->reference);
235 const QwtScaleMap &yMap,
const QRectF &)
const {
236 const QwtIntervalSeriesData &
data = *d_data->data;
238 painter->setPen(QPen(d_data->color));
240 const int x0 = xMap.transform(
baseline());
241 const int y0 = yMap.transform(
baseline());
243 for(
int i = 0; i < (int)
data.size(); i++) {
244 if(d_data->attributes & HistogramItem::Xfy) {
245 const int x2 = xMap.transform(
data.sample(i).value);
249 int y1 = yMap.transform(
data.sample(i).interval.minValue());
250 int y2 = yMap.transform(
data.sample(i).interval.maxValue());
254 if(i < (
int)
data.size() - 2) {
255 const int yy1 = yMap.transform(
data.sample(i + 1).interval.minValue());
256 const int yy2 = yMap.transform(
data.sample(i + 1).interval.maxValue());
258 if(y2 == qMin(yy1, yy2)) {
259 const int xx2 = xMap.transform(
260 data.sample(i + 1).interval.minValue());
261 if(xx2 != x0 && ((xx2 < x0 && x2 < x0) ||
262 (xx2 > x0 && x2 > x0))) {
269 drawBar(painter, Qt::Horizontal,
270 QRect(x0, y1, x2 - x0, y2 - y1));
273 const int y2 = yMap.transform(
data.sample(i).value);
277 int x1 = xMap.transform(
data.sample(i).interval.minValue());
278 int x2 = xMap.transform(
data.sample(i).interval.maxValue());
282 if(i < (
int)
data.size() - 2) {
283 const int xx1 = xMap.transform(
data.sample(i + 1).interval.minValue());
284 const int xx2 = xMap.transform(
data.sample(i + 1).interval.maxValue());
286 if(x2 == qMin(xx1, xx2)) {
287 const int yy2 = yMap.transform(
data.sample(i + 1).value);
288 if(yy2 != y0 && ((yy2 < y0 && y2 < y0) ||
289 (yy2 > y0 && y2 > y0))) {
296 QRect(x1, y0, x2 - x1, y2 - y0));
310 Qt::Orientation,
const QRect &rect)
const {
313 const QColor
color(painter->pen().color());
314 const QRect r = rect.normalized();
316 const int factor = 125;
317 const QColor light(
color.lighter(factor));
318 const QColor dark(
color.darker(factor));
320 painter->setBrush(
color);
321 painter->setPen(Qt::NoPen);
322 QwtPainter::drawRect(painter, r.x() + 1, r.y() + 1,
323 r.width() - 2, r.height() - 2);
324 painter->setBrush(Qt::NoBrush);
326 painter->setPen(QPen(light, 2));
327 QwtPainter::drawLine(painter,
328 r.left() + 1, r.top() + 2, r.right() + 1, r.top() + 2);
330 painter->setPen(QPen(dark, 2));
331 QwtPainter::drawLine(painter,
332 r.left() + 1, r.bottom(), r.right() + 1, r.bottom());
334 painter->setPen(QPen(light, 1));
336 QwtPainter::drawLine(painter,
337 r.left(), r.top() + 1, r.left(), r.bottom());
338 QwtPainter::drawLine(painter,
339 r.left() + 1, r.top() + 2, r.left() + 1, r.bottom() - 1);
341 painter->setPen(QPen(dark, 1));
343 QwtPainter::drawLine(painter,
344 r.right() + 1, r.top() + 1, r.right() + 1, r.bottom());
345 QwtPainter::drawLine(painter,
346 r.right(), r.top() + 2, r.right(), r.bottom() - 1);