diff options
Diffstat (limited to 'src/barchart/horizontal/stacked')
5 files changed, 0 insertions, 373 deletions
diff --git a/src/barchart/horizontal/stacked/horizontalstackedbarchartitem.cpp b/src/barchart/horizontal/stacked/horizontalstackedbarchartitem.cpp deleted file mode 100644 index ad80ec72..00000000 --- a/src/barchart/horizontal/stacked/horizontalstackedbarchartitem.cpp +++ /dev/null @@ -1,107 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Digia Plc -** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com -** -** This file is part of the Qt Enterprise Charts Add-on. -** -** $QT_BEGIN_LICENSE$ -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. -** -** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "horizontalstackedbarchartitem_p.h" -#include "qabstractbarseries_p.h" -#include "qbarset_p.h" -#include "bar_p.h" - -QTCOMMERCIALCHART_BEGIN_NAMESPACE - -HorizontalStackedBarChartItem::HorizontalStackedBarChartItem(QAbstractBarSeries *series, QGraphicsItem* item) - : AbstractBarChartItem(series, item) -{ -} - -void HorizontalStackedBarChartItem::initializeLayout() -{ - qreal categoryCount = m_series->d_func()->categoryCount(); - qreal setCount = m_series->count(); - qreal barWidth = m_series->d_func()->barWidth(); - - m_layout.clear(); - for(int category = 0; category < categoryCount; category++) { - for (int set = 0; set < setCount; set++) { - QRectF rect; - QPointF topLeft; - QPointF bottomRight; - if (domain()->type() == AbstractDomain::LogXYDomain || domain()->type() == AbstractDomain::LogXLogYDomain) { - topLeft = domain()->calculateGeometryPoint(QPointF(domain()->minX(), category - barWidth / 2), m_validData); - bottomRight = domain()->calculateGeometryPoint(QPointF(domain()->minX(), category + barWidth / 2), m_validData); - } else { - topLeft = domain()->calculateGeometryPoint(QPointF(0, category - barWidth / 2), m_validData); - bottomRight = domain()->calculateGeometryPoint(QPointF(0, category + barWidth / 2), m_validData); - } - - if (!m_validData) - return; - - rect.setTopLeft(topLeft); - rect.setBottomRight(bottomRight); - m_layout.append(rect.normalized()); - } - } -} - -QVector<QRectF> HorizontalStackedBarChartItem::calculateLayout() -{ - QVector<QRectF> layout; - - // Use temporary qreals for accuracy - qreal categoryCount = m_series->d_func()->categoryCount(); - qreal setCount = m_series->count(); - qreal barWidth = m_series->d_func()->barWidth(); - - for(int category = 0; category < categoryCount; category++) { - qreal positiveSum = 0; - qreal negativeSum = 0; - for (int set = 0; set < setCount; set++) { - qreal value = m_series->barSets().at(set)->at(category); - QRectF rect; - QPointF topLeft; - QPointF bottomRight; - if (value < 0) { - bottomRight = domain()->calculateGeometryPoint(QPointF(value + negativeSum, category - barWidth / 2), m_validData); - if (domain()->type() == AbstractDomain::LogXYDomain || domain()->type() == AbstractDomain::LogXLogYDomain) - topLeft = domain()->calculateGeometryPoint(QPointF(set ? negativeSum : domain()->minX(), category + barWidth / 2), m_validData); - else - topLeft = domain()->calculateGeometryPoint(QPointF(set ? negativeSum : 0, category + barWidth / 2), m_validData); - negativeSum += value; - } else { - bottomRight = domain()->calculateGeometryPoint(QPointF(value + positiveSum, category - barWidth / 2), m_validData); - if (domain()->type() == AbstractDomain::LogXYDomain || domain()->type() == AbstractDomain::LogXLogYDomain) - topLeft = domain()->calculateGeometryPoint(QPointF(set ? positiveSum : domain()->minX(), category + barWidth / 2), m_validData); - else - topLeft = domain()->calculateGeometryPoint(QPointF(set ? positiveSum : 0, category + barWidth / 2), m_validData); - positiveSum += value; - } - - rect.setTopLeft(topLeft); - rect.setBottomRight(bottomRight); - layout.append(rect.normalized()); - } - } - return layout; -} - -#include "moc_horizontalstackedbarchartitem_p.cpp" - -QTCOMMERCIALCHART_END_NAMESPACE - diff --git a/src/barchart/horizontal/stacked/horizontalstackedbarchartitem_p.h b/src/barchart/horizontal/stacked/horizontalstackedbarchartitem_p.h deleted file mode 100644 index 4e91a8b3..00000000 --- a/src/barchart/horizontal/stacked/horizontalstackedbarchartitem_p.h +++ /dev/null @@ -1,51 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Digia Plc -** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com -** -** This file is part of the Qt Enterprise Charts Add-on. -** -** $QT_BEGIN_LICENSE$ -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. -** -** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com -** $QT_END_LICENSE$ -** -****************************************************************************/ - -// W A R N I N G -// ------------- -// -// This file is not part of the Qt Enterprise Chart API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. - -#ifndef HORIZONTALSTACKEDBARCHARTITEM_P_H -#define HORIZONTALSTACKEDBARCHARTITEM_P_H - -#include "abstractbarchartitem_p.h" -#include <QGraphicsItem> - -QTCOMMERCIALCHART_BEGIN_NAMESPACE - -class HorizontalStackedBarChartItem : public AbstractBarChartItem -{ - Q_OBJECT -public: - HorizontalStackedBarChartItem(QAbstractBarSeries *series, QGraphicsItem* item = 0); - -private: - virtual QVector<QRectF> calculateLayout(); - void initializeLayout(); -}; - -QTCOMMERCIALCHART_END_NAMESPACE - -#endif // HORIZONTALSTACKEDBARCHARTITEM_P_H diff --git a/src/barchart/horizontal/stacked/qhorizontalstackedbarseries.cpp b/src/barchart/horizontal/stacked/qhorizontalstackedbarseries.cpp deleted file mode 100644 index a5d8f519..00000000 --- a/src/barchart/horizontal/stacked/qhorizontalstackedbarseries.cpp +++ /dev/null @@ -1,120 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Digia Plc -** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com -** -** This file is part of the Qt Enterprise Charts Add-on. -** -** $QT_BEGIN_LICENSE$ -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. -** -** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include "qhorizontalstackedbarseries.h" -#include "qhorizontalstackedbarseries_p.h" -#include "horizontalstackedbarchartitem_p.h" - -#include "chartdataset_p.h" -#include "charttheme_p.h" - -QTCOMMERCIALCHART_BEGIN_NAMESPACE -/*! - \class QHorizontalStackedBarSeries - \inmodule Qt Charts - \brief Series for creating horizontal stacked bar chart. - \mainclass - - QHorizontalStackedBarSeries represents a series of data shown as bars. The purpose of this class is to draw bars - as groups, where bars in same category are grouped next to each other. QHorizontalStackedBarSeries groups the data - from sets to categories, which are defined by a QStringList. - - See the \l {HorizontalStackedBarChart Example} {horizontal stacked bar chart example} to learn how to create a horizontal stacked bar chart. - \image examples_horizontalstackedbarchart.png - - \sa QBarSet, QBarSeries, QPercentBarSeries, QAbstractBarSeries, QStackedBarSeries, QHorizontalPercentBarSeries, QHorizontalBarSeries -*/ -#ifdef QDOC_QT5 -/*! - \qmltype HorizontalStackedBarSeries - \instantiates QHorizontalStackedBarSeries - \inqmlmodule QtCommercial.Chart - - \include doc/src/horizontalstackedbarseries.qdocinc -*/ -#else -/*! - \qmlclass HorizontalStackedBarSeries QHorizontalStackedBarSeries - - \include ../doc/src/horizontalstackedbarseries.qdocinc -*/ -#endif - -/*! - Constructs empty QHorizontalStackedBarSeries. - QHorizontalStackedBarSeries is QObject which is a child of a \a parent. -*/ -QHorizontalStackedBarSeries::QHorizontalStackedBarSeries(QObject *parent) - : QAbstractBarSeries(*new QHorizontalStackedBarSeriesPrivate(this), parent) -{ -} - -/*! - Destructor. - Removes series from chart. -*/ -QHorizontalStackedBarSeries::~QHorizontalStackedBarSeries() -{ - Q_D(QHorizontalStackedBarSeries); - if (d->m_chart) - d->m_chart->removeSeries(this); -} - -/*! - Returns QAbstractSeries::SeriesTypeHorizontalStackedBar. -*/ -QAbstractSeries::SeriesType QHorizontalStackedBarSeries::type() const -{ - return QAbstractSeries::SeriesTypeHorizontalStackedBar; -} - -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - -QHorizontalStackedBarSeriesPrivate::QHorizontalStackedBarSeriesPrivate(QHorizontalStackedBarSeries *q) : QAbstractBarSeriesPrivate(q) -{ - -} - -void QHorizontalStackedBarSeriesPrivate::initializeDomain() -{ - qreal minX(domain()->minX()); - qreal minY(domain()->minY()); - qreal maxX(domain()->maxX()); - qreal maxY(domain()->maxY()); - - qreal y = categoryCount(); - minX = qMin(minX, bottom()); - minY = qMin(minY, - (qreal)0.5); - maxX = qMax(maxX, top()); - maxY = qMax(maxY, y - (qreal)0.5); - - domain()->setRange(minX, maxX, minY, maxY); -} - -void QHorizontalStackedBarSeriesPrivate::initializeGraphics(QGraphicsItem *parent) -{ - Q_Q(QHorizontalStackedBarSeries); - HorizontalStackedBarChartItem *bar = new HorizontalStackedBarChartItem(q,parent); - m_item.reset(bar); - QAbstractSeriesPrivate::initializeGraphics(parent); -} - -#include "moc_qhorizontalstackedbarseries.cpp" - -QTCOMMERCIALCHART_END_NAMESPACE diff --git a/src/barchart/horizontal/stacked/qhorizontalstackedbarseries.h b/src/barchart/horizontal/stacked/qhorizontalstackedbarseries.h deleted file mode 100644 index 5db21851..00000000 --- a/src/barchart/horizontal/stacked/qhorizontalstackedbarseries.h +++ /dev/null @@ -1,45 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Digia Plc -** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com -** -** This file is part of the Qt Enterprise Charts Add-on. -** -** $QT_BEGIN_LICENSE$ -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. -** -** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QHORIZONTALSTACKEDBARSERIES_H -#define QHORIZONTALSTACKEDBARSERIES_H - -#include <qabstractbarseries.h> - -QTCOMMERCIALCHART_BEGIN_NAMESPACE - -class QHorizontalStackedBarSeriesPrivate; - -class QTCOMMERCIALCHART_EXPORT QHorizontalStackedBarSeries : public QAbstractBarSeries -{ - Q_OBJECT -public: - explicit QHorizontalStackedBarSeries(QObject *parent = 0); - ~QHorizontalStackedBarSeries(); - QAbstractSeries::SeriesType type() const; - -private: - Q_DECLARE_PRIVATE(QHorizontalStackedBarSeries) - Q_DISABLE_COPY(QHorizontalStackedBarSeries) -}; - -QTCOMMERCIALCHART_END_NAMESPACE - -#endif // QHORIZONTALSTACKEDBARSERIES_H diff --git a/src/barchart/horizontal/stacked/qhorizontalstackedbarseries_p.h b/src/barchart/horizontal/stacked/qhorizontalstackedbarseries_p.h deleted file mode 100644 index 869cf593..00000000 --- a/src/barchart/horizontal/stacked/qhorizontalstackedbarseries_p.h +++ /dev/null @@ -1,50 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Digia Plc -** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com -** -** This file is part of the Qt Enterprise Charts Add-on. -** -** $QT_BEGIN_LICENSE$ -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. -** -** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com -** $QT_END_LICENSE$ -** -****************************************************************************/ - -// W A R N I N G -// ------------- -// -// This file is not part of the Qt Enterprise Chart API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. - -#ifndef QHORIZONTALSTACKEDBARSERIES_P_H -#define QHORIZONTALSTACKEDBARSERIES_P_H - -#include "qabstractbarseries_p.h" -#include "abstractdomain_p.h" - -QTCOMMERCIALCHART_BEGIN_NAMESPACE - -class QHorizontalStackedBarSeriesPrivate: public QAbstractBarSeriesPrivate -{ -public: - QHorizontalStackedBarSeriesPrivate(QHorizontalStackedBarSeries *q); - void initializeGraphics(QGraphicsItem* parent); - void initializeDomain(); -private: - Q_DECLARE_PUBLIC(QHorizontalStackedBarSeries) -}; - -QTCOMMERCIALCHART_END_NAMESPACE - -#endif // QHORIZONTALSTACKEDBARSERIES_P_H |