##// END OF EJS Templates
Fix Linux package generation script...
Fix Linux package generation script Set the correct directory name to the package. Change-Id: I46d87c52535635f07623e3fb15849a4b219d9fd8 Reviewed-by: Miikka Heikkinen <miikka.heikkinen@digia.com>

File last commit:

r2639:2ce3423968b5
r2645:f49860f63006
Show More
qchart.cpp
828 lines | 23.0 KiB | text/x-c | CppLexer
Michal Klocek
adds QChartView PIMPL, refactor public API
r746 /****************************************************************************
**
Miikka Heikkinen
Fixed the copyright year 2012 -> 2013
r2432 ** Copyright (C) 2013 Digia Plc
Michal Klocek
adds QChartView PIMPL, refactor public API
r746 ** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
Miikka Heikkinen
Qt Commercial -> Qt Enterprise...
r2574 ** This file is part of the Qt Enterprise Charts Add-on.
Michal Klocek
adds QChartView PIMPL, refactor public API
r746 **
** $QT_BEGIN_LICENSE$
Miikka Heikkinen
Qt Commercial -> Qt Enterprise...
r2574 ** Licensees holding valid Qt Enterprise licenses may use this file in
** accordance with the Qt Enterprise License Agreement provided with the
Michal Klocek
adds QChartView PIMPL, refactor public API
r746 ** 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$
**
****************************************************************************/
Michal Klocek
adds missing files form previous commit
r12 #include "qchart.h"
Michal Klocek
Adds PIMPL to qchart
r740 #include "qchart_p.h"
Michal Klocek
Adds qlegend pimpl...
r950 #include "legendscroller_p.h"
#include "qlegend_p.h"
Michal Klocek
Changes QChartAxis -> QAxis
r1006 #include "chartbackground_p.h"
Michal Klocek
Refactors QAxis to QAbstractAxis...
r1541 #include "qabstractaxis.h"
Miikka Heikkinen
Add Polar chart support...
r2483 #include "abstractchartlayout_p.h"
Michal Klocek
Refactors internals...
r2273 #include "charttheme_p.h"
#include "chartpresenter_p.h"
#include "chartdataset_p.h"
Tero Ahola
Integrated scatter type series...
r42 #include <QGraphicsScene>
Michal Klocek
Adds layout support for charts....
r115 #include <QGraphicsSceneResizeEvent>
Michal Klocek
adds missing files form previous commit
r12
Marek Rosa
Added some more documentation to QChart and QChartView
r277 QTCOMMERCIALCHART_BEGIN_NAMESPACE
/*!
Michal Klocek
Adds PIMPL to qchart
r740 \enum QChart::ChartTheme
Marek Rosa
Added some more documentation to QChart and QChartView
r277
Michal Klocek
Adds PIMPL to qchart
r740 This enum describes the theme used by the chart.
Marek Rosa
Added some more documentation to QChart and QChartView
r277
Tero Ahola
Removed default theme, now using light as the default
r853 \value ChartThemeLight The default theme
Michal Klocek
Adds PIMPL to qchart
r740 \value ChartThemeBlueCerulean
\value ChartThemeDark
\value ChartThemeBrownSand
\value ChartThemeBlueNcs
Tero Ahola
Added Icy Blue and High Contrast theme
r757 \value ChartThemeHighContrast
\value ChartThemeBlueIcy
Titta Heikkala
Fix documentation...
r2632 \value ChartThemeQt
Michal Klocek
Adds PIMPL to qchart
r740 */
Marek Rosa
Added some more documentation to QChart and QChartView
r277
Tero Ahola
QDoc for animation options in QChart
r302 /*!
Michal Klocek
Adds PIMPL to qchart
r740 \enum QChart::AnimationOption
Tero Ahola
QDoc for animation options in QChart
r302
Michal Klocek
Adds PIMPL to qchart
r740 For enabling/disabling animations. Defaults to NoAnimation.
Tero Ahola
QDoc for animation options in QChart
r302
Michal Klocek
Adds PIMPL to qchart
r740 \value NoAnimation
\value GridAxisAnimations
\value SeriesAnimations
\value AllAnimations
*/
Tero Ahola
QDoc for animation options in QChart
r302
Miikka Heikkinen
Add Polar chart support...
r2483 /*!
\enum QChart::ChartType
This enum describes the chart type.
\value ChartTypeUndefined
\value ChartTypeCartesian
\value ChartTypePolar
*/
Tero Ahola
Started documenting QChart
r264 /*!
Michal Klocek
Adds PIMPL to qchart
r740 \class QChart
Titta Heikkala
Fix Charts documentation...
r2639 \inmodule Qt Charts
Miikka Heikkinen
Fix some docs issues...
r2591 \brief Main chart API for Qt Charts.
Tero Ahola
Started documenting QChart
r264
Michal Klocek
Adds PIMPL to qchart
r740 QChart is a QGraphicsWidget that you can show in a QGraphicsScene. It manages the graphical
Miikka Heikkinen
Documentation updates...
r2494 representation of different types of series and other chart related objects like legend and
axes. If you simply want to show a chart in a layout, you can use the
Michal Klocek
Adds PIMPL to qchart
r740 convenience class QChartView instead of QChart.
Miikka Heikkinen
Documentation updates...
r2494 \sa QChartView, QPolarChart
Michal Klocek
Adds PIMPL to qchart
r740 */
Tero Ahola
Started documenting QChart
r264
Tero Ahola
Documented QChart properties
r1526 /*!
\property QChart::animationOptions
The animation \a options for the chart. Animations are enabled/disabled based on this setting.
*/
/*!
\property QChart::backgroundVisible
Miikka Heikkinen
Documentation updates...
r2494 Specifies whether the chart background is visible or not.
Miikka Heikkinen
Add API to specify plot area background....
r2498 \sa setBackgroundBrush(), setBackgroundPen(), plotAreaBackgroundVisible
Tero Ahola
Documented QChart properties
r1526 */
/*!
\property QChart::dropShadowEnabled
If set to true, the background drop shadow effect is enabled. If set to false, it is disabled. Note that the drop
shadow effect depends on theme, which means the setting may be changed if you switch to another theme.
*/
Miikka Heikkinen
Added API to set chart background roundness...
r2549 /*!
\property QChart::backgroundRoundness
The diameter of the rounding cirle at the corners of the chart background.
*/
Tero Ahola
Documented QChart properties
r1526 /*!
sauimone
Updated QChart margins documentation
r1982 \property QChart::minimumMargins
Minimum margins between the plot area (axes) and the edge of the chart widget.
Miikka Heikkinen
Documentation updates...
r2494 This property is deprecated; use margins property instead.
\sa margins
Tero Ahola
Documented QChart properties
r1526 */
Tero Ahola
Documented the new functionality in QChart
r2360 /*!
\property QChart::margins
Miikka Heikkinen
Documentation updates...
r2494 Margins between the plot area (axes) and the edge of the chart widget.
Tero Ahola
Documented the new functionality in QChart
r2360 */
Tero Ahola
Documented QChart properties
r1526 /*!
\property QChart::theme
Theme is a built-in collection of UI style related settings applied for all visual elements of a chart, like colors,
Miikka Heikkinen
Documentation updates...
r2494 pens, brushes, and fonts of series, axes, title, and legend. \l {Chart themes demo} shows an example with a few
Tero Ahola
Documented QChart properties
r1526 different themes.
Miikka Heikkinen
Documentation updates...
r2494 \note Changing the theme will overwrite all customizations previously applied to the series.
Tero Ahola
Documented QChart properties
r1526 */
/*!
\property QChart::title
Miikka Heikkinen
Added HTML support for various text items...
r2539 Title is the name (label) of a chart. It is shown as a headline on top of the chart. Chart title supports html formatting.
Tero Ahola
Documented QChart properties
r1526 */
Tero Ahola
Started documenting QChart
r264 /*!
Miikka Heikkinen
Add Polar chart support...
r2483 \property QChart::chartType
Chart type indicates if the chart is a cartesian chart or a polar chart.
Miikka Heikkinen
Documentation updates...
r2494 This property is set internally and it is read only.
Miikka Heikkinen
Add Polar chart support...
r2483 \sa QPolarChart
*/
Miikka Heikkinen
Add API to specify plot area background....
r2498 /*!
\property QChart::plotAreaBackgroundVisible
Specifies whether the chart plot area background is visible or not.
\note By default the plot area background is not visible and the plot area uses
the general chart background.
\sa setPlotAreaBackgroundBrush(), setPlotAreaBackgroundPen(), backgroundVisible
*/
Miikka Heikkinen
Add Polar chart support...
r2483 /*!
\internal
Constructs a chart object of \a type which is a child of a \a parent.
Parameter \a wFlags is passed to the QGraphicsWidget constructor.
This constructor is called only by subclasses.
*/
QChart::QChart(QChart::ChartType type, QGraphicsItem *parent, Qt::WindowFlags wFlags)
: QGraphicsWidget(parent, wFlags),
d_ptr(new QChartPrivate(this, type))
{
d_ptr->init();
}
/*!
Constructs a chart object which is a child of a \a parent.
Parameter \a wFlags is passed to the QGraphicsWidget constructor.
Michal Klocek
Adds PIMPL to qchart
r740 */
Jani Honkonen
src folder: another massive victory for coding style police
r2131 QChart::QChart(QGraphicsItem *parent, Qt::WindowFlags wFlags)
: QGraphicsWidget(parent, wFlags),
Miikka Heikkinen
Add Polar chart support...
r2483 d_ptr(new QChartPrivate(this, ChartTypeCartesian))
Michal Klocek
adds missing files form previous commit
r12 {
Miikka Heikkinen
Add Polar chart support...
r2483 d_ptr->init();
Michal Klocek
adds missing files form previous commit
r12 }
Tero Ahola
Started documenting QChart
r264 /*!
Miikka Heikkinen
Documentation updates...
r2494 Destroys the chart object and its children, like series and axis objects added to it.
Michal Klocek
Adds PIMPL to qchart
r740 */
Tero Ahola
Started documenting QChart
r264 QChart::~QChart()
{
Michal Klocek
Refactors internals...
r2273 //start by deleting dataset, it will remove all series and axes
delete d_ptr->m_dataset;
d_ptr->m_dataset = 0;
Tero Ahola
Started documenting QChart
r264 }
Michal Klocek
adds missing files form previous commit
r12
Tero Ahola
Started documenting QChart
r264 /*!
Miikka Heikkinen
Documentation updates...
r2494 Adds the \a series onto the chart and takes the ownership of it.
\note A newly added series is attached to no axes by default, including any axes that were created for the chart
using createDefaultAxes() before the series was added to the chart. If no axes are attached to
the newly added series before the chart is shown, the series will get drawn as if it had axes with ranges
that exactly fit the series to the plot area of the chart. This can be confusing if the same chart also displays other
series that have properly attached axes, so always make sure you either call createDefaultAxes() after
a series has been added or explicitly attach axes for the series.
Jani Honkonen
Add QChart::series() doc and tests
r1316
Miikka Heikkinen
Documentation updates...
r2494 \sa removeSeries(), removeAllSeries(), createDefaultAxes(), QAbstractSeries::attachAxis()
Michal Klocek
Adds PIMPL to qchart
r740 */
Michal Klocek
Refactors QAxis to QAbstractAxis...
r1541 void QChart::addSeries(QAbstractSeries *series)
Michal Klocek
Refactors axis handling...
r223 {
Michal Klocek
Adds missing titleFont getter
r895 Q_ASSERT(series);
Michal Klocek
Refactors QAxis to QAbstractAxis...
r1541 d_ptr->m_dataset->addSeries(series);
Michal Klocek
Refactors axis handling...
r223 }
Tero Ahola
Integrated scatter type series...
r42
Marek Rosa
Added some documentation to QChart and QChartView
r274 /*!
Miikka Heikkinen
Documentation updates...
r2494 Removes the \a series from the chart.
The chart releases its ownership of the specified \a series object.
Michal Klocek
Adds PIMPL to qchart
r740 \sa addSeries(), removeAllSeries()
*/
Tero Ahola
Renamed QSeries to QAbstractSeries
r988 void QChart::removeSeries(QAbstractSeries *series)
Michal Klocek
Refactors axis handling...
r223 {
Michal Klocek
Adds missing titleFont getter
r895 Q_ASSERT(series);
Michal Klocek
Adds PIMPL to qchart
r740 d_ptr->m_dataset->removeSeries(series);
Tero Ahola
Integrated scatter type series...
r42 }
Tero Ahola
Resizing of QGraphicItems now possible by resize signal from QChart
r48
Marek Rosa
Added some documentation to QChart and QChartView
r274 /*!
Miikka Heikkinen
Documentation updates...
r2494 Removes and deletes all series objects that have been added to the chart.
Michal Klocek
Adds PIMPL to qchart
r740 \sa addSeries(), removeSeries()
*/
Michal Klocek
Adds RemoveAllSeries method to API
r258 void QChart::removeAllSeries()
{
Michal Klocek
Adds domains swap logic
r2284 foreach (QAbstractSeries *s , d_ptr->m_dataset->series()){
removeSeries(s);
delete s;
}
Michal Klocek
Adds RemoveAllSeries method to API
r258 }
Marek Rosa
QChart and QChartView now has some description for all the functions
r287 /*!
Michal Klocek
Adds PIMPL to qchart
r740 Sets the \a brush that is used for painting the background of the chart area.
*/
Jani Honkonen
src folder: another massive victory for coding style police
r2131 void QChart::setBackgroundBrush(const QBrush &brush)
Michal Klocek
Change background gradient to use ObjectBoundingMode...
r122 {
Michal Klocek
Refactors layout managment...
r1534 d_ptr->m_presenter->setBackgroundBrush(brush);
Michal Klocek
Change background gradient to use ObjectBoundingMode...
r122 }
Marek Rosa
Some more doc fixes and additions
r924 /*!
Miikka Heikkinen
Documentation updates...
r2494 Gets the brush that is used for painting the background of the chart area.
Marek Rosa
Some more doc fixes and additions
r924 */
Michal Klocek
Adds force option to chartTheme...
r645 QBrush QChart::backgroundBrush() const
{
Michal Klocek
Refactors layout managment...
r1534 return d_ptr->m_presenter->backgroundBrush();
Michal Klocek
Adds force option to chartTheme...
r645 }
Marek Rosa
QChart and QChartView now has some description for all the functions
r287 /*!
Michal Klocek
Adds PIMPL to qchart
r740 Sets the \a pen that is used for painting the background of the chart area.
*/
Jani Honkonen
src folder: another massive victory for coding style police
r2131 void QChart::setBackgroundPen(const QPen &pen)
Michal Klocek
Change background gradient to use ObjectBoundingMode...
r122 {
Michal Klocek
Refactors layout managment...
r1534 d_ptr->m_presenter->setBackgroundPen(pen);
Michal Klocek
Change background gradient to use ObjectBoundingMode...
r122 }
Marek Rosa
Some more doc fixes and additions
r924 /*!
Miikka Heikkinen
Documentation updates...
r2494 Gets the pen that is used for painting the background of the chart area.
Marek Rosa
Some more doc fixes and additions
r924 */
Michal Klocek
Adds force option to chartTheme...
r645 QPen QChart::backgroundPen() const
{
Michal Klocek
Refactors layout managment...
r1534 return d_ptr->m_presenter->backgroundPen();
Michal Klocek
Adds force option to chartTheme...
r645 }
Jani Honkonen
src folder: another massive victory for coding style police
r2131 void QChart::setTitle(const QString &title)
Michal Klocek
Add background to chart...
r69 {
Michal Klocek
Refactors layout managment...
r1534 d_ptr->m_presenter->setTitle(title);
Michal Klocek
Refactor animation to fit line,spline,scatter...
r476 }
Michal Klocek
Adds force option to chartTheme...
r645 QString QChart::title() const
Michal Klocek
Refactor animation to fit line,spline,scatter...
r476 {
Michal Klocek
Refactors layout managment...
r1534 return d_ptr->m_presenter->title();
Michal Klocek
Adds font handling for chart's titile...
r192 }
Marek Rosa
Added some documentation to QChart and QChartView
r274 /*!
Miikka Heikkinen
Documentation updates...
r2494 Sets the \a font that is used for drawing the chart title.
Michal Klocek
Adds PIMPL to qchart
r740 */
Jani Honkonen
src folder: another massive victory for coding style police
r2131 void QChart::setTitleFont(const QFont &font)
Michal Klocek
Adds font handling for chart's titile...
r192 {
Michal Klocek
Refactors layout managment...
r1534 d_ptr->m_presenter->setTitleFont(font);
Michal Klocek
Add background to chart...
r69 }
Marek Rosa
Some more doc fixes and additions
r924 /*!
Miikka Heikkinen
Documentation updates...
r2494 Gets the font that is used for drawing the chart title.
Marek Rosa
Some more doc fixes and additions
r924 */
Michal Klocek
Adds missing titleFont getter
r895 QFont QChart::titleFont() const
{
Michal Klocek
Refactors layout managment...
r1534 return d_ptr->m_presenter->titleFont();
Michal Klocek
Adds missing titleFont getter
r895 }
Tero Ahola
Chart title font color
r495 /*!
Miikka Heikkinen
Documentation updates...
r2494 Sets the \a brush used for drawing the title text.
Michal Klocek
Adds PIMPL to qchart
r740 */
Michal Klocek
Adds force option to chartTheme...
r645 void QChart::setTitleBrush(const QBrush &brush)
Tero Ahola
Chart title font color
r495 {
Michal Klocek
Refactors layout managment...
r1534 d_ptr->m_presenter->setTitleBrush(brush);
Tero Ahola
Chart title font color
r495 }
/*!
Miikka Heikkinen
Documentation updates...
r2494 Returns the brush used for drawing the title text.
Michal Klocek
Adds PIMPL to qchart
r740 */
Michal Klocek
Adds force option to chartTheme...
r645 QBrush QChart::titleBrush() const
Tero Ahola
Chart title font color
r495 {
Michal Klocek
Refactors layout managment...
r1534 return d_ptr->m_presenter->titleBrush();
Michal Klocek
Refactors axis handling...
r223 }
Michal Klocek
Adds PIMPL to qchart
r740 void QChart::setTheme(QChart::ChartTheme theme)
Tero Ahola
Draft implementation for setting color themes for a chart
r64 {
Michal Klocek
Refactors internals...
r2273 d_ptr->m_themeManager->setTheme(theme);
Tero Ahola
Draft implementation for setting color themes for a chart
r64 }
Michal Klocek
Adds PIMPL to qchart
r740 QChart::ChartTheme QChart::theme() const
Tero Ahola
Proof-of-concept for QML api...
r120 {
Michal Klocek
Refactors internals...
r2273 return d_ptr->m_themeManager->theme()->id();
Tero Ahola
Proof-of-concept for QML api...
r120 }
Marek Rosa
else clause added to QChartView mousePressEvent. Added some more docs to QChart and QChartView
r285 /*!
Miikka Heikkinen
Documentation updates...
r2494 Zooms in the view by a factor of two.
Michal Klocek
Adds PIMPL to qchart
r740 */
Michal Klocek
Refactors axis handling...
r223 void QChart::zoomIn()
Michal Klocek
Add zoom support...
r67 {
Michal Klocek
Refactors internals...
r2273 d_ptr->zoomIn(2.0);
Michal Klocek
Add zoom support...
r67 }
Marek Rosa
else clause added to QChartView mousePressEvent. Added some more docs to QChart and QChartView
r285 /*!
Michal Klocek
Adds PIMPL to qchart
r740 Zooms in the view to a maximum level at which \a rect is still fully visible.
Miikka Heikkinen
Add Polar chart support...
r2483 \note This is not supported for polar charts.
Michal Klocek
Adds PIMPL to qchart
r740 */
Jani Honkonen
src folder: another massive victory for coding style police
r2131 void QChart::zoomIn(const QRectF &rect)
Michal Klocek
Add zoom support...
r67 {
Miikka Heikkinen
Add Polar chart support...
r2483 if (d_ptr->m_type == QChart::ChartTypePolar)
return;
Marek Rosa
Mapping functions added to QChart. Callout example updated
r2344 d_ptr->zoomIn(rect);
Michal Klocek
Add zoom support...
r67 }
Marek Rosa
else clause added to QChartView mousePressEvent. Added some more docs to QChart and QChartView
r285 /*!
Miikka Heikkinen
Documentation updates...
r2494 Zooms out the view by a factor of two.
Michal Klocek
Adds PIMPL to qchart
r740 */
Michal Klocek
Add zoom support...
r67 void QChart::zoomOut()
{
Michal Klocek
Refactors internals...
r2273 d_ptr->zoomOut(2.0);
Jani Honkonen
Add gestures support for zoomlinechart example...
r1187 }
/*!
Miikka Heikkinen
Documentation updates...
r2494 Zooms in the view by a custom \a factor.
Jani Honkonen
Add gestures support for zoomlinechart example...
r1187
A factor over 1.0 zooms the view in and factor between 0.0 and 1.0 zooms out.
*/
void QChart::zoom(qreal factor)
{
Marek Rosa
Replaced qFuzzyIsNull with qFuzzyCompare. Once qchart test case still uses qFuzzyIsNull becasue it started failing when qFuzzyCompare was used
r2242 if (qFuzzyCompare(factor, 0))
Jani Honkonen
Add gestures support for zoomlinechart example...
r1187 return;
Marek Rosa
Added casting to qreal in qMin, qFuzzyCompare calls to fix build on arm
r1679 if (qFuzzyCompare(factor, (qreal)1.0))
Jani Honkonen
Add gestures support for zoomlinechart example...
r1187 return;
if (factor < 0)
return;
if (factor > 1.0)
Michal Klocek
Refactors internals...
r2273 d_ptr->zoomIn(factor);
Jani Honkonen
Add gestures support for zoomlinechart example...
r1187 else
Michal Klocek
Refactors internals...
r2273 d_ptr->zoomOut(1.0 / factor);
Michal Klocek
Add zoom support...
r67 }
Miikka Heikkinen
Added QChart::zoomReset() and QChart::isZoomed()...
r2545
/*!
Resets the series domains to what they were before any zoom method was called.
Note that this will also reset any scrolls and explicit axis range settings done between
the first zoom operation and calling this method. If no zoom operation has been
done, this method does nothing.
*/
void QChart::zoomReset()
{
d_ptr->zoomReset();
}
/*!
Returns true if any series has a zoomed domain.
*/
bool QChart::isZoomed()
{
return d_ptr->isZoomed();
}
Marek Rosa
Added some more documentation to QChart and QChartView
r277 /*!
Miikka Heikkinen
Documentation updates...
r2494 Returns a pointer to the horizontal axis attached to the specified \a series.
If no \a series is specified, the first horizontal axis added to the chart is returned.
\sa addAxis(), QAbstractSeries::attachAxis()
Michal Klocek
Adds PIMPL to qchart
r740 */
Jani Honkonen
src folder: another massive victory for coding style police
r2131 QAbstractAxis *QChart::axisX(QAbstractSeries *series) const
Michal Klocek
Adds more axis handling...
r176 {
Tero Ahola
Fixed a bug with QChart::axis getters with no series defined
r2384 QList<QAbstractAxis *> axisList = axes(Qt::Horizontal, series);
if (axisList.count())
return axisList[0];
return 0;
Michal Klocek
Adds more axis handling...
r176 }
Marek Rosa
Added some more documentation to QChart and QChartView
r277 /*!
Miikka Heikkinen
Documentation updates...
r2494 Returns a pointer to the vertical axis attached to the specified \a series.
If no \a series is specified, the first vertical axis added to the chart is returned.
\sa addAxis(), QAbstractSeries::attachAxis()
Michal Klocek
Adds PIMPL to qchart
r740 */
Jani Honkonen
src folder: another massive victory for coding style police
r2131 QAbstractAxis *QChart::axisY(QAbstractSeries *series) const
Michal Klocek
Adds more axis handling...
r176 {
Tero Ahola
Fixed a bug with QChart::axis getters with no series defined
r2384 QList<QAbstractAxis *> axisList = axes(Qt::Vertical, series);
if (axisList.count())
return axisList[0];
return 0;
Michal Klocek
Refactors internals...
r2273 }
Tero Ahola
Documented the new functionality in QChart
r2360 /*!
Miikka Heikkinen
Documentation updates...
r2494 Returns the axes attached to the \a series with \a orientation. If no \a series is provided,
then all axes added to the chart with the specified orientation are returned.
Tero Ahola
Documented the new functionality in QChart
r2360 \sa addAxis(), createDefaultAxes()
*/
Michal Klocek
Refactors internals...
r2273 QList<QAbstractAxis *> QChart::axes(Qt::Orientations orientation, QAbstractSeries *series) const
{
QList<QAbstractAxis *> result ;
Tero Ahola
Added axisXTop and axisYRight properties to QML series APIs
r2296 if (series) {
foreach (QAbstractAxis *axis, series->attachedAxes()){
if (orientation.testFlag(axis->orientation()))
result << axis;
}
} else {
Tero Ahola
Fixed a bug with QChart::axis getters with no series defined
r2384 foreach (QAbstractAxis *axis, d_ptr->m_dataset->axes()){
if (orientation.testFlag(axis->orientation()) && !result.contains(axis))
result << axis;
Tero Ahola
Added axisXTop and axisYRight properties to QML series APIs
r2296 }
Michal Klocek
Refactors internals...
r2273 }
return result;
Michal Klocek
Refactora axis and line chart to use graphics items insted of painter.
r85 }
Marek Rosa
Few QChart doc updates
r1633 /*!
Miikka Heikkinen
Documentation updates...
r2494 Creates axes for the chart based on the series that have already been added to the chart. Any axes previously added to
the chart will be deleted.
Marek Rosa
Few QChart doc updates
r1633
Miikka Heikkinen
Documentation updates...
r2494 \note This function has to be called after all series have been added to the chart. The axes created by this function
will NOT get automatically attached to any series added to the chart after this function has been called.
A series with no axes attached will by default scale to utilize the entire plot area of the chart, which can be confusing
if there are other series with properly attached axes also present.
Marek Rosa
Various docs fixes
r1638
Miikka Heikkinen
Documentation updates...
r2494 \table
Marek Rosa
Various docs fixes
r1638 \header
Titta Heikkala
Fix Charts documentation...
r2639 \li Series type
\li X-axis
\li Y-axis
Marek Rosa
Various docs fixes
r1638 \row
Titta Heikkala
Fix Charts documentation...
r2639 \li QXYSeries
\li QValueAxis
\li QValueAxis
Marek Rosa
Various docs fixes
r1638 \row
Titta Heikkala
Fix Charts documentation...
r2639 \li QBarSeries
\li QBarCategoryAxis
\li QValueAxis
Marek Rosa
Various docs fixes
r1638 \row
Titta Heikkala
Fix Charts documentation...
r2639 \li QPieSeries
\li None
\li None
Miikka Heikkinen
Documentation updates...
r2494 \endtable
Marek Rosa
Various docs fixes
r1638
Miikka Heikkinen
Documentation updates...
r2494 If there are several QXYSeries derived series added to the chart and no series of other types have been added, then only one pair of axes is created.
If there are several series of different types added to the chart, then each series gets its own axes pair.
Marek Rosa
Few QChart doc updates
r1633
Miikka Heikkinen
Documentation updates...
r2494 The axes specific to the series can be later obtained from the chart by providing the series as the parameter for axes() function call.
Marek Rosa
Few QChart doc updates
r1633 QPieSeries does not create any axes.
Miikka Heikkinen
Documentation updates...
r2494 \sa axisX(), axisY(), axes(), setAxisX(), setAxisY(), QAbstractSeries::attachAxis()
Marek Rosa
Few QChart doc updates
r1633 */
Michal Klocek
Refactor QChart API...
r1577 void QChart::createDefaultAxes()
{
Jani Honkonen
src folder: another massive victory for coding style police
r2131 d_ptr->m_dataset->createDefaultAxes();
Michal Klocek
Refactor QChart API...
r1577 }
sauimone
framework for legend
r524 /*!
Miikka Heikkinen
Documentation updates...
r2494 Returns the legend object of the chart. Ownership stays with the chart.
Michal Klocek
Adds PIMPL to qchart
r740 */
Jani Honkonen
src folder: another massive victory for coding style police
r2131 QLegend *QChart::legend() const
sauimone
framework for legend
r524 {
sauimone
improved legend layout
r783 return d_ptr->m_legend;
sauimone
framework for legend
r524 }
Jani Honkonen
Fix BC: QChart::setMinimumMargins and QChart::minimumMargins are in v1.1.0 so they have to stay.
r2272 void QChart::setMinimumMargins(const QMargins &margins)
{
qWarning() << "QChart::setMinimumMargins is deprecated. Use QChart::setMargins instead.";
d_ptr->m_presenter->layout()->setMargins(margins);
}
QMargins QChart::minimumMargins() const
{
qWarning() << "QChart::minimumMargins is deprecated. Use QChart::margins instead.";
return d_ptr->m_presenter->layout()->margins();
}
Jani Honkonen
src folder: another massive victory for coding style police
r2131 void QChart::setMargins(const QMargins &margins)
Michal Klocek
Implements minimumMargins...
r1883 {
Michal Klocek
Refactors layout:...
r2105 d_ptr->m_presenter->layout()->setMargins(margins);
Michal Klocek
Implements minimumMargins...
r1883 }
Michal Klocek
Refactors layout...
r1965 QMargins QChart::margins() const
sauimone
legend pos to theme example, legend padding
r803 {
Michal Klocek
Refactors layout:...
r2105 return d_ptr->m_presenter->layout()->margins();
sauimone
legend pos to theme example, legend padding
r803 }
Miikka Heikkinen
Add Polar chart support...
r2483 QChart::ChartType QChart::chartType() const
{
return d_ptr->m_type;
}
Marek Rosa
Docs fixes
r1657 /*!
Miikka Heikkinen
Documentation updates...
r2494 Returns the the rectangle within which the drawing of the chart is done.
It does not include the area defined by margins.
Marek Rosa
Docs fixes
r1657 */
Michal Klocek
Adds plotArea()...
r1648 QRectF QChart::plotArea() const
{
Michal Klocek
Refactors internals...
r2273 return d_ptr->m_presenter->geometry();
Michal Klocek
Adds plotArea()...
r1648 }
Miikka Heikkinen
Add API to specify plot area background....
r2498 /*!
Sets the \a brush for the background of the plot area of the chart.
\sa plotArea(), plotAreaBackgroundVisible, setPlotAreaBackgroundPen(), plotAreaBackgroundBrush()
*/
void QChart::setPlotAreaBackgroundBrush(const QBrush &brush)
{
d_ptr->m_presenter->setPlotAreaBackgroundBrush(brush);
}
/*!
Returns the brush for the background of the plot area of the chart.
\sa plotArea(), plotAreaBackgroundVisible, plotAreaBackgroundPen(), setPlotAreaBackgroundBrush()
*/
QBrush QChart::plotAreaBackgroundBrush() const
{
return d_ptr->m_presenter->plotAreaBackgroundBrush();
}
/*!
Sets the \a pen for the background of the plot area of the chart.
\sa plotArea(), plotAreaBackgroundVisible, setPlotAreaBackgroundBrush(), plotAreaBackgroundPen()
*/
void QChart::setPlotAreaBackgroundPen(const QPen &pen)
{
d_ptr->m_presenter->setPlotAreaBackgroundPen(pen);
}
/*!
Miikka Heikkinen
Fix warnings in documentation build...
r2503 Returns the pen for the background of the plot area of the chart.
Miikka Heikkinen
Add API to specify plot area background....
r2498
\sa plotArea(), plotAreaBackgroundVisible, plotAreaBackgroundBrush(), setPlotAreaBackgroundPen()
*/
QPen QChart::plotAreaBackgroundPen() const
{
return d_ptr->m_presenter->plotAreaBackgroundPen();
}
void QChart::setPlotAreaBackgroundVisible(bool visible)
{
d_ptr->m_presenter->setPlotAreaBackgroundVisible(visible);
}
bool QChart::isPlotAreaBackgroundVisible() const
{
return d_ptr->m_presenter->isPlotAreaBackgroundVisible();
}
Michal Klocek
Adds animation settings handling
r298 void QChart::setAnimationOptions(AnimationOptions options)
{
Michal Klocek
Adds PIMPL to qchart
r740 d_ptr->m_presenter->setAnimationOptions(options);
Michal Klocek
Adds animation settings handling
r298 }
QChart::AnimationOptions QChart::animationOptions() const
{
Michal Klocek
Adds PIMPL to qchart
r740 return d_ptr->m_presenter->animationOptions();
Michal Klocek
Adds animation settings handling
r298 }
Jani Honkonen
Add gestures support for zoomlinechart example...
r1187 /*!
sauimone
fixed documentation errors
r1575 Scrolls the visible area of the chart by the distance defined in the \a dx and \a dy.
Miikka Heikkinen
Add Polar chart support...
r2483
For polar charts, \a dx indicates the angle along angular axis instead of distance.
Jani Honkonen
Add gestures support for zoomlinechart example...
r1187 */
Michal Klocek
Changes to qchart qabstractseries API
r1553 void QChart::scroll(qreal dx, qreal dy)
Jani Honkonen
Add gestures support for zoomlinechart example...
r1187 {
Michal Klocek
Refactors internals...
r2273 d_ptr->scroll(dx,dy);
Jani Honkonen
Add gestures support for zoomlinechart example...
r1187 }
Michal Klocek
Adds PIMPL to qchart
r740 void QChart::setBackgroundVisible(bool visible)
{
Michal Klocek
Refactors layout managment...
r1534 d_ptr->m_presenter->setBackgroundVisible(visible);
Michal Klocek
Adds PIMPL to qchart
r740 }
sauimone
Scrolling logic to legend
r716
Michal Klocek
Adds PIMPL to qchart
r740 bool QChart::isBackgroundVisible() const
{
Michal Klocek
Refactors layout managment...
r1534 return d_ptr->m_presenter->isBackgroundVisible();
sauimone
Scrolling logic to legend
r716 }
Tero Ahola
Minor modifications to properties of abstract, area and bar series
r1462 void QChart::setDropShadowEnabled(bool enabled)
Tero Ahola
Added drop shadow effect for light themes
r1001 {
Michal Klocek
Refactors layout managment...
r1534 d_ptr->m_presenter->setBackgroundDropShadowEnabled(enabled);
Tero Ahola
Added drop shadow effect for light themes
r1001 }
Tero Ahola
Minor modifications to properties of abstract, area and bar series
r1462 bool QChart::isDropShadowEnabled() const
Tero Ahola
Added drop shadow effect for light themes
r1001 {
Michal Klocek
Refactors layout managment...
r1534 return d_ptr->m_presenter->isBackgroundDropShadowEnabled();
Tero Ahola
Added drop shadow effect for light themes
r1001 }
Miikka Heikkinen
Added API to set chart background roundness...
r2549 void QChart::setBackgroundRoundness(qreal diameter)
{
d_ptr->m_presenter->setBackgroundRoundness(diameter);
}
qreal QChart::backgroundRoundness() const
{
return d_ptr->m_presenter->backgroundRoundness();
}
Jani Honkonen
Add QChart::series() doc and tests
r1316 /*!
Miikka Heikkinen
Documentation updates...
r2494 Returns all series that are added to the chart.
Jani Honkonen
Add QChart::series() doc and tests
r1316
\sa addSeries(), removeSeries(), removeAllSeries()
*/
Jani Honkonen
src folder: another massive victory for coding style police
r2131 QList<QAbstractSeries *> QChart::series() const
Michal Klocek
Fixes to API , QSeriesType -> SeriesType , add missing getters
r1107 {
return d_ptr->m_dataset->series();
}
Michal Klocek
Refactors layout managment...
r1534
Marek Rosa
Few QChart doc updates
r1633 /*!
Miikka Heikkinen
Documentation updates...
r2494 Adds the \a axis to the chart and attaches it to the \a series as a bottom-aligned horizontal axis.
The chart takes ownership of both the \a axis and the \a series.
Any horizontal axes previously attached to the \a series are deleted.
Marek Rosa
Few QChart doc updates
r1633
Miikka Heikkinen
Documentation updates...
r2494 \sa axisX(), axisY(), setAxisY(), createDefaultAxes(), QAbstractSeries::attachAxis()
Marek Rosa
Few QChart doc updates
r1633 */
Miikka Heikkinen
Documentation updates...
r2494 void QChart::setAxisX(QAbstractAxis *axis ,QAbstractSeries *series)
Michal Klocek
Refactors QAxis to QAbstractAxis...
r1541 {
Miikka Heikkinen
Documentation updates...
r2494 QList<QAbstractAxis*> list = axes(Qt::Horizontal, series);
Michal Klocek
Refactors internals...
r2273
Miikka Heikkinen
Documentation updates...
r2494 foreach (QAbstractAxis* a, list) {
Michal Klocek
make setAxisX setAxisY functionality compatible
r2278 d_ptr->m_dataset->removeAxis(a);
delete a;
Marek Rosa
Mapping functions added to QChart. Callout example updated
r2344 }
Michal Klocek
Refactors internals...
r2273
Miikka Heikkinen
Documentation updates...
r2494 if (!d_ptr->m_dataset->axes().contains(axis))
d_ptr->m_dataset->addAxis(axis, Qt::AlignBottom);
d_ptr->m_dataset->attachAxis(series, axis);
Michal Klocek
Refactors QAxis to QAbstractAxis...
r1541 }
Marek Rosa
Few QChart doc updates
r1633 /*!
Miikka Heikkinen
Documentation updates...
r2494 Adds the \a axis to the chart and attaches it to the \a series as a left-aligned vertical axis.
The chart takes ownership of both the \a axis and the \a series.
Any vertical axes previously attached to the \a series are deleted.
Marek Rosa
Few QChart doc updates
r1633
Miikka Heikkinen
Documentation updates...
r2494 \sa axisX(), axisY(), setAxisX(), createDefaultAxes(), QAbstractSeries::attachAxis()
Marek Rosa
Few QChart doc updates
r1633 */
Miikka Heikkinen
Documentation updates...
r2494 void QChart::setAxisY(QAbstractAxis *axis ,QAbstractSeries *series)
Michal Klocek
Refactors QAxis to QAbstractAxis...
r1541 {
Miikka Heikkinen
Documentation updates...
r2494 QList<QAbstractAxis*> list = axes(Qt::Vertical, series);
Michal Klocek
Refactors internals...
r2273
Miikka Heikkinen
Documentation updates...
r2494 foreach (QAbstractAxis* a, list) {
Michal Klocek
make setAxisX setAxisY functionality compatible
r2278 d_ptr->m_dataset->removeAxis(a);
delete a;
Michal Klocek
Refactors internals...
r2273 }
Miikka Heikkinen
Documentation updates...
r2494 if (!d_ptr->m_dataset->axes().contains(axis))
d_ptr->m_dataset->addAxis(axis, Qt::AlignLeft);
d_ptr->m_dataset->attachAxis(series, axis);
Michal Klocek
Refactors internals...
r2273 }
Tero Ahola
Documented the new functionality in QChart
r2360 /*!
Miikka Heikkinen
Documentation updates...
r2494 Adds the \a axis to the chart with \a alignment. The chart takes the ownership of the axis.
Tero Ahola
Documented the new functionality in QChart
r2360 \sa removeAxis(), createDefaultAxes(), QAbstractSeries::attachAxis()
*/
void QChart::addAxis(QAbstractAxis *axis, Qt::Alignment alignment)
Michal Klocek
Refactors internals...
r2273 {
Tero Ahola
Documented the new functionality in QChart
r2360 d_ptr->m_dataset->addAxis(axis, alignment);
Michal Klocek
Refactors internals...
r2273 }
Tero Ahola
Documented the new functionality in QChart
r2360 /*!
Miikka Heikkinen
Documentation updates...
r2494 Removes the \a axis from the chart.
The chart releases its ownership of the specified \a axis object.
Tero Ahola
Documented the new functionality in QChart
r2360 \sa addAxis(), createDefaultAxes(), QAbstractSeries::detachAxis()
*/
Michal Klocek
Refactors internals...
r2273 void QChart::removeAxis(QAbstractAxis *axis)
{
Marek Rosa
Mapping functions added to QChart. Callout example updated
r2344 d_ptr->m_dataset->removeAxis(axis);
}
Marek Rosa
Documented mapToValue and mapToPostion methods in QChart
r2357 /*!
Miikka Heikkinen
Documentation updates...
r2494 Returns the value in the \a series domain that corresponds to the \a position relative to chart widget.
Marek Rosa
Documented mapToValue and mapToPostion methods in QChart
r2357 */
Marek Rosa
Mapping functions added to QChart. Callout example updated
r2344 QPointF QChart::mapToValue(const QPointF &position, QAbstractSeries *series)
{
return d_ptr->m_dataset->mapToValue(position, series);
}
Marek Rosa
Documented mapToValue and mapToPostion methods in QChart
r2357 /*!
Miikka Heikkinen
Documentation updates...
r2494 Returns the position on the chart widget that corresponds to the \a value in the \a series domain.
Marek Rosa
Documented mapToValue and mapToPostion methods in QChart
r2357 */
Marek Rosa
Mapping functions added to QChart. Callout example updated
r2344 QPointF QChart::mapToPosition(const QPointF &value, QAbstractSeries *series)
{
return d_ptr->m_dataset->mapToPosition(value, series);
Michal Klocek
Refactors QAxis to QAbstractAxis...
r1541 }
Michal Klocek
Adds PIMPL to qchart
r740 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Michal Klocek
Changes background item...
r639
Miikka Heikkinen
Add Polar chart support...
r2483 QChartPrivate::QChartPrivate(QChart *q, QChart::ChartType type):
Michal Klocek
Refactors internals...
r2273 q_ptr(q),
Marek Rosa
Some more doc fixes and additions
r924 m_legend(0),
Michal Klocek
Refactors internals...
r2273 m_dataset(new ChartDataSet(q)),
Miikka Heikkinen
Add Polar chart support...
r2483 m_presenter(new ChartPresenter(q, type)),
Miikka Heikkinen
Fix some warnings for android build....
r2504 m_themeManager(new ChartThemeManager(q)),
m_type(type)
Michal Klocek
Changes background item...
r639 {
Michal Klocek
Refactors internals...
r2273 QObject::connect(m_dataset, SIGNAL(seriesAdded(QAbstractSeries*)), m_presenter, SLOT(handleSeriesAdded(QAbstractSeries*)));
QObject::connect(m_dataset, SIGNAL(seriesRemoved(QAbstractSeries*)), m_presenter, SLOT(handleSeriesRemoved(QAbstractSeries*)));
QObject::connect(m_dataset, SIGNAL(axisAdded(QAbstractAxis*)), m_presenter, SLOT(handleAxisAdded(QAbstractAxis*)));
QObject::connect(m_dataset, SIGNAL(axisRemoved(QAbstractAxis*)), m_presenter, SLOT(handleAxisRemoved(QAbstractAxis*)));
QObject::connect(m_dataset, SIGNAL(seriesAdded(QAbstractSeries*)), m_themeManager, SLOT(handleSeriesAdded(QAbstractSeries*)));
QObject::connect(m_dataset, SIGNAL(seriesRemoved(QAbstractSeries*)), m_themeManager, SLOT(handleSeriesRemoved(QAbstractSeries*)));
QObject::connect(m_dataset, SIGNAL(axisAdded(QAbstractAxis*)), m_themeManager, SLOT(handleAxisAdded(QAbstractAxis*)));
QObject::connect(m_dataset, SIGNAL(axisRemoved(QAbstractAxis*)), m_themeManager, SLOT(handleAxisRemoved(QAbstractAxis*)));
Michal Klocek
Changes background item...
r639 }
Michal Klocek
Adds PIMPL to qchart
r740 QChartPrivate::~QChartPrivate()
Michal Klocek
Changes background item...
r639 {
}
Miikka Heikkinen
Fix explicitly set default pen/brush/font getting overridden by theme...
r2516 // Hackish solution to the problem of explicitly assigning the default pen/brush/font
// to a series or axis and having theme override it:
// Initialize pens, brushes, and fonts to something nobody is likely to ever use,
// so that default theme initialization will always set these properly.
QPen &QChartPrivate::defaultPen()
{
Miikka Heikkinen
Clean up static variables a bit...
r2543 static QPen defaultPen(QColor(1, 2, 0), 0.93247536);
return defaultPen;
Miikka Heikkinen
Fix explicitly set default pen/brush/font getting overridden by theme...
r2516 }
QBrush &QChartPrivate::defaultBrush()
{
Miikka Heikkinen
Clean up static variables a bit...
r2543 static QBrush defaultBrush(QColor(1, 2, 0), Qt::Dense7Pattern);
return defaultBrush;
Miikka Heikkinen
Fix explicitly set default pen/brush/font getting overridden by theme...
r2516 }
QFont &QChartPrivate::defaultFont()
{
Miikka Heikkinen
Clean up static variables a bit...
r2543 static bool defaultFontInitialized(false);
static QFont defaultFont;
if (!defaultFontInitialized) {
defaultFont.setPointSizeF(8.34563465);
defaultFontInitialized = true;
Miikka Heikkinen
Fix explicitly set default pen/brush/font getting overridden by theme...
r2516 }
Miikka Heikkinen
Clean up static variables a bit...
r2543 return defaultFont;
Miikka Heikkinen
Fix explicitly set default pen/brush/font getting overridden by theme...
r2516 }
Miikka Heikkinen
Add Polar chart support...
r2483 void QChartPrivate::init()
{
m_legend = new LegendScroller(q_ptr);
q_ptr->setTheme(QChart::ChartThemeLight);
q_ptr->setLayout(m_presenter->layout());
}
Michal Klocek
Refactors internals...
r2273 void QChartPrivate::zoomIn(qreal factor)
Michal Klocek
Refactor , move dataset legend presentr connections to one place
r871 {
Michal Klocek
Refactors internals...
r2273 QRectF rect = m_presenter->geometry();
rect.setWidth(rect.width() / factor);
rect.setHeight(rect.height() / factor);
rect.moveCenter(m_presenter->geometry().center());
zoomIn(rect);
}
void QChartPrivate::zoomIn(const QRectF &rect)
{
if (!rect.isValid())
Marek Rosa
Mapping functions added to QChart. Callout example updated
r2344 return;
Michal Klocek
Refactors internals...
r2273
QRectF r = rect.normalized();
const QRectF geometry = m_presenter->geometry();
r.translate(-geometry.topLeft());
if (!r.isValid())
return;
QPointF zoomPoint(r.center().x() / geometry.width(), r.center().y() / geometry.height());
m_presenter->setState(ChartPresenter::ZoomInState,zoomPoint);
m_dataset->zoomInDomain(r);
m_presenter->setState(ChartPresenter::ShowState,QPointF());
}
Miikka Heikkinen
Added QChart::zoomReset() and QChart::isZoomed()...
r2545 void QChartPrivate::zoomReset()
{
m_dataset->zoomResetDomain();
}
bool QChartPrivate::isZoomed()
{
return m_dataset->isZoomedDomain();
}
Michal Klocek
Refactors internals...
r2273 void QChartPrivate::zoomOut(qreal factor)
{
const QRectF geometry = m_presenter->geometry();
QRectF r;
r.setSize(geometry.size() / factor);
r.moveCenter(QPointF(geometry.size().width()/2 ,geometry.size().height()/2));
if (!r.isValid())
return;
QPointF zoomPoint(r.center().x() / geometry.width(), r.center().y() / geometry.height());
m_presenter->setState(ChartPresenter::ZoomOutState,zoomPoint);
m_dataset->zoomOutDomain(r);
m_presenter->setState(ChartPresenter::ShowState,QPointF());
}
void QChartPrivate::scroll(qreal dx, qreal dy)
{
if (dx < 0) m_presenter->setState(ChartPresenter::ScrollLeftState,QPointF());
if (dx > 0) m_presenter->setState(ChartPresenter::ScrollRightState,QPointF());
if (dy < 0) m_presenter->setState(ChartPresenter::ScrollUpState,QPointF());
if (dy > 0) m_presenter->setState(ChartPresenter::ScrollDownState,QPointF());
m_dataset->scrollDomain(dx, dy);
m_presenter->setState(ChartPresenter::ShowState,QPointF());
Michal Klocek
Refactor , move dataset legend presentr connections to one place
r871 }
Tero Ahola
Draft implementation for setting color themes for a chart
r64 #include "moc_qchart.cpp"
Tero Ahola
Resizing of QGraphicItems now possible by resize signal from QChart
r48
Tero Ahola
Renamed to QtCommercialChart
r30 QTCOMMERCIALCHART_END_NAMESPACE