@@ -34,17 +34,22 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()); |
|
38 | ||
|
39 | void DeclarativeBarSeries::setBarCategories(QStringList categories) | |||
|
40 | { | |||
|
41 | m_categories = categories; | |||
|
42 | ||||
|
43 | if (m_series) { | |||
|
44 | delete m_series; | |||
|
45 | m_series = 0; | |||
|
46 | } | |||
39 |
|
47 | |||
|
48 | DeclarativeChart *declarativeChart = qobject_cast<DeclarativeChart *>(parent()); | |||
40 |
|
|
49 | if (declarativeChart) { | |
41 |
|
|
50 | QChart *chart = qobject_cast<QChart *>(declarativeChart->m_chart); | |
42 |
|
|
51 | Q_ASSERT(chart); | |
43 |
|
52 | |||
44 | // QStringList categories; |
|
|||
45 | // categories << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "Jun"; |
|
|||
46 | // m_series = new QBarSeries(categories); |
|
|||
47 | // m_series = new QBarSeries(m_categories); |
|
|||
48 |
|
|
53 | m_series = new QBarSeries(m_categories); | |
49 |
|
54 | |||
50 |
|
|
55 | // TODO: use data from model | |
@@ -63,21 +68,6 void DeclarativeBarSeries::componentComplete() | |||||
63 |
|
|
68 | chart->addSeries(m_series); | |
64 |
|
|
69 | } | |
65 | } |
|
70 | } | |
66 | } |
|
|||
67 |
|
||||
68 | void DeclarativeBarSeries::setBarCategories(QStringList /*categories*/) |
|
|||
69 | { |
|
|||
70 | // m_categories = categories; |
|
|||
71 | // if (m_series) { |
|
|||
72 | // // Replace categories of the QBarSeries with the new categories |
|
|||
73 | // for (int i(0); i < m_categories.count(); i++) { |
|
|||
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 | } |
|
|||
81 |
|
71 | |||
82 | QStringList DeclarativeBarSeries::barCategories() |
|
72 | QStringList DeclarativeBarSeries::barCategories() | |
83 | { |
|
73 | { |
General Comments 0
You need to be logged in to leave comments.
Login now