-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
236 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// Copyright (C) 2023 The Qt Company Ltd. | ||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause | ||
|
||
#include "StatistiqueDiagrammeCirculaire.h" | ||
#include "StatistiqueDiagrammeCirculairePartie.h" | ||
|
||
StatistiqueDiagrammeCirculaire::StatistiqueDiagrammeCirculaire(QGraphicsItem* parent, Qt::WindowFlags wFlags) | ||
: QChart(QChart::ChartTypeCartesian, parent, wFlags) | ||
{ | ||
} | ||
|
||
void StatistiqueDiagrammeCirculaire::changeSeries(QAbstractSeries* series) | ||
{ | ||
if (m_currentSeries) | ||
removeSeries(m_currentSeries); | ||
m_currentSeries = series; | ||
addSeries(series); | ||
setTitle(series->name()); | ||
} | ||
|
||
void StatistiqueDiagrammeCirculaire::handleSliceClicked(QPieSlice* slice) | ||
{ | ||
auto* drilldownSlice = static_cast<StatistiqueDiagrammeCirculairePartie*>(slice); | ||
changeSeries(drilldownSlice->drilldownSeries()); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// Copyright (C) 2023 The Qt Company Ltd. | ||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause | ||
|
||
#ifndef PIEDRILLDOWNCHART_H | ||
#define PIEDRILLDOWNCHART_H | ||
|
||
#include <QChart> | ||
|
||
QT_FORWARD_DECLARE_CLASS(QAbstractSeries); | ||
QT_FORWARD_DECLARE_CLASS(QPieSlice); | ||
|
||
class StatistiqueDiagrammeCirculaire : public QChart | ||
{ | ||
Q_OBJECT | ||
public: | ||
explicit StatistiqueDiagrammeCirculaire(QGraphicsItem* parent = nullptr, Qt::WindowFlags wFlags = {}); | ||
void changeSeries(QAbstractSeries* series); | ||
|
||
public slots: | ||
void handleSliceClicked(QPieSlice* slice); | ||
|
||
private: | ||
QAbstractSeries* m_currentSeries = nullptr; | ||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// Copyright (C) 2023 The Qt Company Ltd. | ||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause | ||
|
||
#include "StatistiqueDiagrammeCirculairePartie.h" | ||
#include "AeroDmsTypes.h" | ||
|
||
StatistiqueDiagrammeCirculairePartie::StatistiqueDiagrammeCirculairePartie(qreal value, const QString& prefix, QAbstractSeries* drilldownSeries) | ||
: m_drilldownSeries(drilldownSeries), | ||
m_prefix(prefix) | ||
{ | ||
setValue(value); | ||
updateLabel(); | ||
setLabelFont(QFont("Arial", 8)); | ||
connect(this, &StatistiqueDiagrammeCirculairePartie::percentageChanged, this, &StatistiqueDiagrammeCirculairePartie::updateLabel); | ||
connect(this, &StatistiqueDiagrammeCirculairePartie::hovered, this, &StatistiqueDiagrammeCirculairePartie::showHighlight); | ||
} | ||
|
||
QAbstractSeries* StatistiqueDiagrammeCirculairePartie::drilldownSeries() const | ||
{ | ||
return m_drilldownSeries; | ||
} | ||
|
||
void StatistiqueDiagrammeCirculairePartie::updateLabel() | ||
{ | ||
setLabel(QStringLiteral("%1 : %2, %3%").arg(m_prefix, | ||
AeroDmsTypes::convertirMinutesEnHeuresMinutes(value()), | ||
QString::number(percentage() * 100, 'f', 1))); | ||
} | ||
|
||
void StatistiqueDiagrammeCirculairePartie::showHighlight(bool show) | ||
{ | ||
setLabelVisible(show); | ||
setExploded(show); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// Copyright (C) 2023 The Qt Company Ltd. | ||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause | ||
|
||
#ifndef PIEDRILLDOWNSLICE_H | ||
#define PIEDRILLDOWNSLICE_H | ||
|
||
#include <QPieSlice> | ||
|
||
QT_FORWARD_DECLARE_CLASS(QAbstractSeries); | ||
|
||
class StatistiqueDiagrammeCirculairePartie : public QPieSlice | ||
{ | ||
Q_OBJECT | ||
public: | ||
StatistiqueDiagrammeCirculairePartie(qreal value, const QString& prefix, QAbstractSeries* drilldownSeries); | ||
QAbstractSeries* drilldownSeries() const; | ||
|
||
public slots: | ||
void updateLabel(); | ||
void showHighlight(bool show); | ||
|
||
private: | ||
QAbstractSeries* m_drilldownSeries = nullptr; | ||
QString m_prefix; | ||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// Copyright (C) 2023 The Qt Company Ltd. | ||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause | ||
|
||
#include "StatistiqueDiagrammeCirculaire.h" | ||
#include "StatistiqueDiagrammeCirculairePartie.h" | ||
#include "StatistiqueDiagrammeCirculaireWidget.h" | ||
|
||
#include <QChart> | ||
#include <QLegend> | ||
#include <QPieSeries> | ||
#include <QRandomGenerator> | ||
|
||
StatistiqueDiagrammeCirculaireWidget::StatistiqueDiagrammeCirculaireWidget(ManageDb* p_db, int p_annee, QWidget* parent) | ||
: StatistiqueWidget(parent) | ||
{ | ||
auto* chart = new StatistiqueDiagrammeCirculaire; | ||
chart->setTheme(QChart::ChartThemeBlueNcs); | ||
chart->setAnimationOptions(QChart::AllAnimations); | ||
chart->legend()->setVisible(true); | ||
chart->legend()->setAlignment(Qt::AlignRight); | ||
|
||
AeroDmsTypes::ListeSubventionsParPilotes subventionParPilote = p_db->recupererSubventionsPilotes(p_annee); | ||
|
||
auto donneesTypeDeVolParPilote = new QPieSeries(this); | ||
donneesTypeDeVolParPilote->setName("Temps de vol par pilote (cliquez pour le détail par pilote)"); | ||
|
||
for (int i = 0; i < subventionParPilote.size(); i++) | ||
{ | ||
auto detailParPilote = new QPieSeries(this); | ||
detailParPilote->setName("Vol pour " + subventionParPilote.at(i).prenom +" "+ subventionParPilote.at(i).nom); | ||
*detailParPilote << new StatistiqueDiagrammeCirculairePartie(subventionParPilote.at(i).entrainement.tempsDeVolEnMinutes, "Entrainement", donneesTypeDeVolParPilote); | ||
*detailParPilote << new StatistiqueDiagrammeCirculairePartie(subventionParPilote.at(i).sortie.tempsDeVolEnMinutes, "Sorties", donneesTypeDeVolParPilote); | ||
*detailParPilote << new StatistiqueDiagrammeCirculairePartie(subventionParPilote.at(i).balade.tempsDeVolEnMinutes, "Balades", donneesTypeDeVolParPilote); | ||
|
||
QObject::connect(detailParPilote, &QPieSeries::clicked, chart, &StatistiqueDiagrammeCirculaire::handleSliceClicked); | ||
*donneesTypeDeVolParPilote << new StatistiqueDiagrammeCirculairePartie(detailParPilote->sum(), subventionParPilote.at(i).prenom + " " + subventionParPilote.at(i).nom, detailParPilote); | ||
} | ||
|
||
QObject::connect(donneesTypeDeVolParPilote, &QPieSeries::clicked, chart, &StatistiqueDiagrammeCirculaire::handleSliceClicked); | ||
|
||
chart->changeSeries(donneesTypeDeVolParPilote); | ||
|
||
createDefaultChartView(chart); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// Copyright (C) 2023 The Qt Company Ltd. | ||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause | ||
|
||
#ifndef PIEDRILLDOWNWIDGET_H | ||
#define PIEDRILLDOWNWIDGET_H | ||
|
||
#include "StatistiqueWidget.h" | ||
#include "ManageDb.h" | ||
|
||
class StatistiqueDiagrammeCirculaireWidget : public StatistiqueWidget | ||
{ | ||
Q_OBJECT | ||
public: | ||
explicit StatistiqueDiagrammeCirculaireWidget(ManageDb* p_db, int p_annee, QWidget* parent = nullptr); | ||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters