##// END OF EJS Templates
Enabled dummy bar chart impl in QML again
Tero Ahola -
r1004:5a2832f9c305
parent child
Show More
@@ -34,49 +34,39 DeclarativeBarSeries::DeclarativeBarSeries(QDeclarativeItem *parent) :
34
34
35 void DeclarativeBarSeries::componentComplete()
35 void DeclarativeBarSeries::componentComplete()
36 {
36 {
37 if (!m_series) {
37 }
38 DeclarativeChart *declarativeChart = qobject_cast<DeclarativeChart *>(parent());
39
38
40 if (declarativeChart) {
39 void DeclarativeBarSeries::setBarCategories(QStringList categories)
41 QChart *chart = qobject_cast<QChart *>(declarativeChart->m_chart);
40 {
42 Q_ASSERT(chart);
41 m_categories = categories;
43
42
44 // QStringList categories;
43 if (m_series) {
45 // categories << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "Jun";
44 delete m_series;
46 // m_series = new QBarSeries(categories);
45 m_series = 0;
47 // m_series = new QBarSeries(m_categories);
46 }
48 m_series = new QBarSeries(m_categories);
49
47
50 // TODO: use data from model
48 DeclarativeChart *declarativeChart = qobject_cast<DeclarativeChart *>(parent());
51 QBarSet *set0 = new QBarSet("Bub");
49 if (declarativeChart) {
52 QBarSet *set1 = new QBarSet("Bob");
50 QChart *chart = qobject_cast<QChart *>(declarativeChart->m_chart);
53 QBarSet *set2 = new QBarSet("Guybrush");
51 Q_ASSERT(chart);
54
52
55 *set0 << 1 << 2 << 3 << 4 << 5 << 6;
53 m_series = new QBarSeries(m_categories);
56 *set1 << 5 << 1 << 2 << 4 << 1 << 7;
57 *set2 << 3 << 5 << 8 << 13 << 8 << 5;
58
54
59 m_series->appendBarSet(set0);
55 // TODO: use data from model
60 m_series->appendBarSet(set1);
56 QBarSet *set0 = new QBarSet("Bub");
61 m_series->appendBarSet(set2);
57 QBarSet *set1 = new QBarSet("Bob");
58 QBarSet *set2 = new QBarSet("Guybrush");
62
59
63 chart->addSeries(m_series);
60 *set0 << 1 << 2 << 3 << 4 << 5 << 6;
64 }
61 *set1 << 5 << 1 << 2 << 4 << 1 << 7;
65 }
62 *set2 << 3 << 5 << 8 << 13 << 8 << 5;
66 }
67
63
68 void DeclarativeBarSeries::setBarCategories(QStringList /*categories*/)
64 m_series->appendBarSet(set0);
69 {
65 m_series->appendBarSet(set1);
70 // m_categories = categories;
66 m_series->appendBarSet(set2);
71 // if (m_series) {
67
72 // // Replace categories of the QBarSeries with the new categories
68 chart->addSeries(m_series);
73 // for (int i(0); i < m_categories.count(); i++) {
69 }
74 // if (m_series->categories().at(i) != m_categories.at(i))
75 // m_series->insertCategory(m_series->categoryCount(), m_categories.at(i));
76 // }
77 // while (m_series->categoryCount() > m_categories.count())
78 // m_series->removeCategory(m_series->categoryCount() - 1);
79 // }
80 }
70 }
81
71
82 QStringList DeclarativeBarSeries::barCategories()
72 QStringList DeclarativeBarSeries::barCategories()
General Comments 0
You need to be logged in to leave comments. Login now