-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPieChart.cpp
More file actions
31 lines (26 loc) · 735 Bytes
/
Copy pathPieChart.cpp
File metadata and controls
31 lines (26 loc) · 735 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include "PieChart.h"
#include<QTableView>
pieChart::pieChart(chartModel * chart) : chartDrawable(chart)
{
}
pieChart::~pieChart(){
removeAllSeries();
}
void pieChart::draw(){
updateTitle();
legend()->setVisible(true);
legend()->setAlignment(Qt::AlignBottom);
updateSeries();
}
void pieChart::updateSeries()
{
removeAllSeries();
QPieSeries * canvasSeries = new QPieSeries(this);
for(int it = 0; it < getModel()->rowCount();it++)
{
QPieSlice * setP = new QPieSlice(getModel()->headerData(it,Qt::Vertical).toString(),getModel()->obtainTotal(it),canvasSeries);
setP->setLabelVisible();
canvasSeries->append(setP);
}
addSeries(canvasSeries);
}