##// END OF EJS Templates
Refactor documentation...
Michal Klocek -
r331:711d530eb260
parent child
Show More
@@ -1,6 +1,6
1 1 include(compat.qdocconf)
2 2 include(macros.qdocconf)
3 include(qt-html-templates.qdocconf)
3 include(qchart-html-template.qdocconf)
4 4
5 5 project = QtCommercialCharts
6 6 description = Library for creating charts
@@ -10,13 +10,11 sourcedirs = ../src \
10 10 ./src
11 11 headerdirs = ../src \
12 12 ../example
13 exampledirs = ../src \
14 ../example
15
16 HTML.templatedir = .
17 HTML.stylesheets = style/offline.css
18 HTML.headerstyles= "<link rel=\"stylesheet\" type=\"text/css\" href=\"style/offline.css\" />\n"
19 HTML.nobreadcrumbs = true
13 exampledirs = ../ \
14 ../src \
15 ../example
16
17 excludefiles += ../example/linechart/linechart.pro
20 18
21 19 sources.fileextensions = *.cpp *.qdoc *.mm *.qml
22 20 headers.fileextensions = *.h *.ch *.h++ *.hh *.hpp *.hxx
@@ -1,51 +1,12
1 1 /*!
2 2 \page index.html
3 \title QtCommercial Charts
4 \keyword All Classes
5
6 TODO: restructure the document
7
8 QtCommercial Charts introduction...
9 For example, to create a chart with line series using a widget based application:
10 \snippet ../example/chartview/main.cpp 1
11 \image chartview_example.jpg
12
13 Showing a few more series:
14 \snippet ../example/chartview/main.cpp 3
15 \image chartview_example_pie.jpg
16 \snippet ../example/chartview/main.cpp 4
17 \image chartview_example_scatter.jpg
18 \snippet ../example/chartview/main.cpp 5
19 \image chartview_example_bar.jpg
20
21 If you need to give a more professional touch to your chart you can switch to one of the
22 pre-defined themes:
23 \snippet ../example/chartview/main.cpp 2
24 \image chartview_example_theme.jpg
25
26 \raw HTML
27 <table cellpadding="2" cellspacing="1" border="0" width="100%" class="indextable">
28 <tr>
29 <th class="titleheader" width="33%">
30 List of classes
31 </th>
32 </tr>
33 <tr>
34 <td valign="top">
35 <ul>
36 <li><a href="qchart.html">QChart</a></li>
37 <li><a href="qchartview.html">QChartView</a></li>
38 <li><a href="qchartseries.html">QChartSeries</a></li>
39 <li><a href="qlinechartseries.html">QLineChartSeries</a></li>
40 <li><a href="qpieseries.html">QPieSeries</a></li>
41 <li><a href="qbarchartseries.html">QBarChartSeries</a></li>
42 <li><a href="qstackedbarchartseries.html">QStackedBarChartSeries</a></li>
43 <li><a href="qpercentbarchartseries.html">QPercentBarChartSeries</a></li>
44 <li><a href="qscatterseries.html">QScatterSeries</a></li>
45 </ul>
46 </td>
47 </tr>
48 </table>
3 \title About QCharts
4 \keyword About
5
6 \raw HTML
7 <div class="qchart">
8 <img src="images/qt_commercial_logo.png" alt="qtcommercial"/>
9 <p>QCharts is a part of Qt Commercial addons package.</p>
10 </div>
49 11 \endraw
50
51 12 */
@@ -1,6 +1,11
1 1 @media screen
2 2 {
3 3
4 .qchart img
5 {
6 float:left;
7 }
8
4 9 /* basic elements */
5 10 html
6 11 {
@@ -232,25 +237,36
232 237 {
233 238 color: #00732F;
234 239 font-weight: bold;
235 font-size: 130%;
240 font-size: 100%;
241 text-align: center;
236 242 }
237 243
238 244 .header .content
239 245 {
240 margin-bottom: 0.5em
246 /* margin-bottom: 0.5em*/
241 247 }
242 248
249 .header .content img
250 {
251 display: block;
252 margin-left: auto;
253 margin-right: auto;
254 width: 100px;
255 }
256
243 257 .naviNextPrevious
244 258 {
245 259 display: none
246 260 }
247 261 .header .breadcrumb
248 262 {
249 font-size: 90%;
263 font-size: 100%;
250 264 padding: 0.5em 0 0.5em 1em;
251 265 margin: 0;
252 background-color: #fafafa;
253 height: 1.35em;
266 /*background-color: #393735;*/
267 font-weight: bold;
268 background: #ffffff url(../images/bg.png) repeat-x;
269 height: 20px;
254 270 border-bottom: 1px solid #d1d1d1;
255 271 }
256 272
@@ -268,7 +284,7
268 284 .header .breadcrumb ul li
269 285 {
270 286 float: left;
271 background: url(../images/breadcrumb.png) no-repeat 0 3px;
287 /*background: url(../images/breadcrumb.png) no-repeat 0 3px;*/
272 288 padding-left: 1.5em;
273 289 margin-left: 1.5em;
274 290 }
@@ -280,9 +296,15
280 296
281 297 .header .breadcrumb ul li a
282 298 {
283 color: #00732F;
299 color: #ffffff;
284 300 }
285 301
302 .header .breadcrumb ul li a:hover
303 {
304 color: #00732F;
305 text-decoration: none;
306 }
307
286 308 .header .breadcrumb ul li.first
287 309 {
288 310 background-image: none;
@@ -479,7 +501,7
479 501
480 502 .content .toc h3 {
481 503 border-bottom: 0px;
482 margin-top: 0px;
504 margin-top: 10px;
483 505 }
484 506
485 507 .content .toc h3 a:hover {
@@ -7,36 +7,46
7 7
8 8 QTCOMMERCIALCHART_USE_NAMESPACE
9 9
10 #define PI 3.14159265358979
11
12 10 int main(int argc, char *argv[])
13 11 {
14 12 QApplication a(argc, argv);
15 13
16 14 QMainWindow window;
17 15
16 //![1]
17
18 18 QLineChartSeries* series0 = new QLineChartSeries();
19 19 QPen blue(Qt::blue);
20 20 blue.setWidth(3);
21 21 series0->setPen(blue);
22
22 23 QLineChartSeries* series1 = new QLineChartSeries();
23 24 QPen red(Qt::red);
24 25 red.setWidth(3);
25 26 series1->setPen(red);
26
27 int numPoints = 100;
28
29 for (int x = 0; x <= numPoints; ++x) {
30 series0->add(x, fabs(sin(PI/50*x)*100));
31 series1->add(x, fabs(cos(PI/50*x)*100));
32 }
33
27 //![1]
28
29 //![2]
30 series0->add(0, 6);
31 series0->add(2, 4);
32 series0->add(3, 8);
33 series0->add(7, 4);
34 series0->add(10,5);
35
36 series1->add(1, 1);
37 series1->add(3, 3);
38 series1->add(7, 6);
39 series1->add(8, 3);
40 series1->add(10,2);
41 //![2]
42 //![3]
34 43 QChartView* chartView = new QChartView(&window);
35 44
36 45 chartView->setRenderHint(QPainter::Antialiasing);
37 46 chartView->setChartTitle("Basic line chart example");
38 47 chartView->addSeries(series0);
39 48 chartView->addSeries(series1);
49 //![3]
40 50
41 51 window.setCentralWidget(chartView);
42 52 window.resize(400, 300);
@@ -2,15 +2,75
2 2
3 3 QTCOMMERCIALCHART_BEGIN_NAMESPACE
4 4
5 /*!
6 \class QLineChartSeries
7 \brief The QLineChartSeries class is used for making line charts.
8
9 \mainclass
10
11 A line chart is used to show information as a series of data points
12 connected by straight lines.
13
14 \image linechart.png
15
16 To create line charts, users need to first QLineChartSeries object.
17
18 \snippet ../example/linechart/main.cpp 1
19
20 Populate with the data
21
22 \snippet ../example/linechart/main.cpp 2
23
24 Add created series objects to QChartView or QChart instance.
25
26 \snippet ../example/linechart/main.cpp 3
27
28 */
29
30 /*!
31 \fn virtual QChartSeriesType QLineChartSeries::type() const
32 \brief Returns type of series.
33 \sa QChartSeries, QChartSeriesType
34 */
35
36 /*!
37 \fn QPen QLineChartSeries::pen() const
38 \brief Returns the pen used to draw line for this series.
39 \sa setPen()
40 */
41
42 /*!
43 \fn bool isPointsVisible() const
44 \brief Returns if the points are drawn for this series.
45 \sa setPointsVisible()
46 */
47
48
49 /*!
50 \fn void QLineChartSeries::changed(int index)
51 \brief \internal \a index
52 */
53
54 /*!
55 Constructs empty series object which is a child of \a parent.
56 When series object is added to QChartView or QChart instance ownerships is transfered.
57 */
5 58 QLineChartSeries::QLineChartSeries(QObject* parent):QChartSeries(parent),
6 59 m_pointsVisible(false)
7 60 {
8 61 }
9
62 /*!
63 Destroys the object. Series added to QChartView or QChart instances are owned by those,
64 and are deleted when mentioned object are destroyed.
65 */
10 66 QLineChartSeries::~QLineChartSeries()
11 67 {
12 68 }
13 69
70 /*!
71 Adds data point \a x \a y to the series. Points are connected with lines on the chart.
72 Function returns index, which can be used to modify data.
73 */
14 74 int QLineChartSeries::add(qreal x,qreal y)
15 75 {
16 76 m_x<<x;
@@ -18,6 +78,21 int QLineChartSeries::add(qreal x,qreal y)
18 78 return m_x.size()-1;
19 79 }
20 80
81 /*!
82 This is an overloaded function.
83 Adds data \a point to the series. Points are connected with lines on the chart.
84 Function returns index, which can be used to modify data.
85 */
86 int QLineChartSeries::add(const QPointF& point)
87 {
88 m_x<<point.x();
89 m_y<<point.y();
90 return m_x.size()-1;
91 }
92
93 /*!
94 Modifies data within \a index, sets new \a x and \a y values.
95 */
21 96 void QLineChartSeries::set(int index,qreal x,qreal y)
22 97 {
23 98 m_x[index]=x;
@@ -25,22 +100,46 void QLineChartSeries::set(int index,qreal x,qreal y)
25 100 emit changed(index);
26 101 }
27 102
103 /*!
104 This is an overloaded function.
105 Modifies data within \a index, sets new \a point value.
106 */
107 void QLineChartSeries::set(int index,const QPointF& point)
108 {
109 m_x[index]=point.x();
110 m_y[index]=point.y();
111 emit changed(index);
112 }
113
114
115 /*!
116 Clears all the data.
117 */
28 118 void QLineChartSeries::clear()
29 119 {
30 120 m_x.clear();
31 121 m_y.clear();
32 122 }
33 123
124 /*!
125 \internal \a pos
126 */
34 127 qreal QLineChartSeries::x(int pos) const
35 128 {
36 129 return m_x.at(pos);
37 130 }
38 131
132 /*!
133 \internal \a pos
134 */
39 135 qreal QLineChartSeries::y(int pos) const
40 136 {
41 137 return m_y.at(pos);
42 138 }
43 139
140 /*!
141 Returns number of data points within series.
142 */
44 143 int QLineChartSeries::count() const
45 144 {
46 145 Q_ASSERT(m_x.size() == m_y.size());
@@ -49,11 +148,22 int QLineChartSeries::count() const
49 148
50 149 }
51 150
151 /*!
152 Sets \a pen used for drawing given series..
153 */
52 154 void QLineChartSeries::setPen(const QPen& pen)
53 155 {
54 156 m_pen=pen;
55 157 }
56 158
159 /*!
160 Sets if data points are \a visible and should be drawn on line.
161 */
162 void QLineChartSeries::setPointsVisible(bool visible)
163 {
164 m_pointsVisible=visible;
165 }
166
57 167 QDebug operator<< (QDebug debug, const QLineChartSeries series)
58 168 {
59 169 Q_ASSERT(series.m_x.size() == series.m_y.size());
@@ -66,10 +176,7 QDebug operator<< (QDebug debug, const QLineChartSeries series)
66 176 return debug.space();
67 177 }
68 178
69 void QLineChartSeries::setPointsVisible(bool visible)
70 {
71 m_pointsVisible=visible;
72 }
179
73 180 #include "moc_qlinechartseries.cpp"
74 181
75 182 QTCOMMERCIALCHART_END_NAMESPACE
@@ -19,11 +19,13 public:
19 19 public: // from QChartSeries
20 20 virtual QChartSeriesType type() const { return QChartSeries::SeriesTypeLine;}
21 21 int add(qreal x, qreal y);
22 int add(const QPointF& point);
22 23 void set(int index,qreal x,qreal y);
24 void set(int index,const QPointF& point);
23 25 void clear();
24 26
25 27 void setPen(const QPen& pen);
26 const QPen& pen() const { return m_pen;}
28 QPen pen() const { return m_pen;}
27 29
28 30 void setPointsVisible(bool visible);
29 31 bool isPointsVisible() const {return m_pointsVisible;}
@@ -2,6 +2,81
2 2
3 3 QTCOMMERCIALCHART_BEGIN_NAMESPACE
4 4
5 /*!
6 \class QChartAxis
7 \brief The QChartAxis class is used for manipulating chart's axis
8 and for adding optional axes to the chart.
9 \mainclass
10
11 There is only one x Axis, however there can be multiple y axes.
12 Each chart series can be bound to exactly one Y axis and the share common X axis.
13 Axis can be setup to show axis line with ticks, gird lines and shades.
14
15 */
16
17 /*!
18 \fn QPen QChartAxis::axisPen() const
19 \brief Returns pen used to draw axis and ticks.
20 \sa setAxisPen()
21 */
22
23 /*!
24 \fn QPen QChartAxis::gridPen() const
25 \brief Returns pen used to draw grid.
26 \sa setGridPen()
27 */
28
29 /*!
30 \fn QPen QChartAxis::labelsPen() const
31 \brief Returns the pen used to labels.
32 \sa setLabelsPen()
33 */
34
35 /*!
36 \fn QBrush QChartAxis::labelsBrush() const
37 \brief Returns brush used to draw labels.
38 \sa setLabelsBrush()
39 */
40
41 /*!
42 \fn QFont QChartAxis::labelsFont() const
43 \brief Returns font used to draw labels.
44 \sa setLabelsFont()
45 */
46
47 /*!
48 \fn QFont QChartAxis::labelsAngle() const
49 \brief Returns angle used to draw labels.
50 \sa setLabelsAngle()
51 */
52
53 /*!
54 \fn QPen QChartAxis::shadesPen() const
55 \brief Returns pen used to draw shades.
56 \sa setShadesPen()
57 */
58
59 /*!
60 \fn QBrush QChartAxis::shadesBrush() const
61 \brief Returns brush used to draw shades.
62 \sa setShadesBrush()
63 */
64
65 /*!
66 \fn void QChartAxis::update(QChartAxis*)
67 \brief \internal
68 */
69
70 /*!
71 \fn void QChartAxis::ticksChanged(QChartAxis*)
72 \brief \internal
73 */
74
75 /*!
76 Constructs new axis object which is a child of \a parent. Ownership is taken by
77 QChatView or QChart when axis added.
78 */
79
5 80 QChartAxis::QChartAxis(QObject* parent):QObject(parent),
6 81 m_axisVisible(true),
7 82 m_gridVisible(true),
@@ -16,88 +91,134 m_ticksCount(5)
16 91
17 92 }
18 93
94 /*!
95 Destructor of the axis object. When axis is added to chart, chart object takes ownership.
96 */
97
19 98 QChartAxis::~QChartAxis()
20 99 {
21 100 }
22 101
102 /*!
103 Sets \a pen used to draw axis line and ticks.
104 */
23 105 void QChartAxis::setAxisPen(const QPen& pen)
24 106 {
25 107 m_axisPen=pen;
26 108 emit update(this);
27 109 }
28 110
111 /*!
112 Sets if axis and ticks are \a visible.
113 */
29 114 void QChartAxis::setAxisVisible(bool visible)
30 115 {
31 116 m_axisVisible=visible;
32 117 emit update(this);
33 118 }
34 119
120 /*!
121 Sets if grid is \a visible.
122 */
35 123 void QChartAxis::setGridVisible(bool visible)
36 124 {
37 125 m_gridVisible=visible;
38 126 emit update(this);
39 127 }
40 128
129 /*!
130 Sets \a pen used to draw grid.
131 */
41 132 void QChartAxis::setGridPen(const QPen& pen)
42 133 {
43 134 m_gridPen=pen;
44 135 emit update(this);
45 136 }
46 137
138 /*!
139 Sets if axis' labels are \a visible.
140 */
47 141 void QChartAxis::setLabelsVisible(bool visible)
48 142 {
49 143 m_labelsVisible=visible;
50 144 emit update(this);
51 145 }
52 146
147 /*!
148 Sets \a pen used to draw labels.
149 */
53 150 void QChartAxis::setLabelsPen(const QPen& pen)
54 151 {
55 152 m_labelsPen=pen;
56 153 emit update(this);
57 154 }
58 155
156 /*!
157 Sets \a brush used to draw labels.
158 */
59 159 void QChartAxis::setLabelsBrush(const QBrush& brush)
60 160 {
61 161 m_labelsBrush=brush;
62 162 emit update(this);
63 163 }
64 164
165 /*!
166 Sets \a font used to draw labels.
167 */
65 168 void QChartAxis::setLabelsFont(const QFont& font)
66 169 {
67 170 m_labelsFont=font;
68 171 emit update(this);
69 172 }
70 173
174 /*!
175 Sets \a angle for all the labels on given axis.
176 */
71 177 void QChartAxis::setLabelsAngle(int angle)
72 178 {
73 179 m_labelsAngle=angle;
74 180 emit update(this);
75 181 }
76 182
183 /*!
184 Sets if shades are \a visible.
185 */
77 186 void QChartAxis::setShadesVisible(bool visible)
78 187 {
79 188 m_shadesVisible=visible;
80 189 emit update(this);
81 190 }
82 191
192 /*!
193 Sets \a pen used to draw shades.
194 */
83 195 void QChartAxis::setShadesPen(const QPen& pen)
84 196 {
85 197 m_shadesPen=pen;
86 198 emit update(this);
87 199 }
88 200
201 /*!
202 Sets \a brush used to draw shades.
203 */
89 204 void QChartAxis::setShadesBrush(const QBrush& brush)
90 205 {
91 206 m_shadesBrush=brush;
92 207 emit update(this);
93 208 }
94 209
210 /*!
211 Sets \a opacity of the shades.
212 */
95 213 void QChartAxis::setShadesOpacity(qreal opacity)
96 214 {
97 215 m_shadesOpacity=opacity;
98 216 emit update(this);
99 217 }
100 218
219 /*!
220 Sets \a min value on the axis.
221 */
101 222 void QChartAxis::setMin(qreal min)
102 223 {
103 224 if(m_min!=min){
@@ -106,6 +227,9 void QChartAxis::setMin(qreal min)
106 227 }
107 228 }
108 229
230 /*!
231 Sets \a max value on the axis.
232 */
109 233 void QChartAxis::setMax(qreal max)
110 234 {
111 235 if(m_max!=max){
@@ -114,35 +238,53 void QChartAxis::setMax(qreal max)
114 238 }
115 239 }
116 240
241 /*!
242 Sets range from \a min to \a max on the axis.
243 */
117 244 void QChartAxis::setRange(qreal min, qreal max)
118 245 {
119 246 setMin(min);
120 247 setMax(max);
121 248 }
122 249
250 /*!
251 Sets \a count for ticks on the axis.
252 */
123 253 void QChartAxis::setTicksCount(int count)
124 254 {
125 255 m_ticksCount=count;
126 256 emit ticksChanged(this);
127 257 }
128 258
259 /*!
260 TODO: refactor me. Sets string \a label for \a value on the axis.
261 */
129 262 void QChartAxis::addAxisTickLabel(qreal value,const QString& label)
130 263 {
131 264 m_ticks.insert(value,label);
132 265 emit ticksChanged(this);
133 266 }
134 267
268 /*!
269 TODO: refactor me. Removes label for \a value on the axis.
270 */
135 271 void QChartAxis::removeAxisTickLabel(qreal value)
136 272 {
137 273 m_ticks.remove(value);
138 274 emit ticksChanged(this);
139 275 }
140 276
277 /*!
278 TODO: refactor me. Returns label for \a value on the axis.
279 */
141 280 QString QChartAxis::axisTickLabel(qreal value) const
142 281 {
143 282 return m_ticks.value(value);
144 283 }
145 284
285 /*!
286 TODO: refactor me. Removes all the string labels for on the axis.
287 */
146 288 void QChartAxis::clearAxisTickLabels()
147 289 {
148 290 m_ticks.clear();
@@ -20,8 +20,6 public:
20 20 void setAxisVisible(bool visible);
21 21 void setAxisPen(const QPen& pen);
22 22 QPen axisPen() const { return m_axisPen;};
23 void setAxisBrush(const QBrush& brush);
24 QBrush axisBrush() const { return m_axisBrush;};
25 23
26 24 //grid handling
27 25 bool isGridVisible() const { return m_gridVisible;};
@@ -37,7 +35,7 public:
37 35 void setLabelsBrush(const QBrush& brush);
38 36 QBrush labelsBrush() const { return m_labelsBrush;}
39 37 void setLabelsFont(const QFont& font);
40 QFont labelFont() const { return m_labelsFont;}
38 QFont labelsFont() const { return m_labelsFont;}
41 39 void setLabelsAngle(int angle);
42 40 int labelsAngle() const { return m_labelsAngle;};
43 41
1 NO CONTENT: file was removed, binary diff hidden
1 NO CONTENT: file was removed, binary diff hidden
1 NO CONTENT: file was removed, binary diff hidden
1 NO CONTENT: file was removed, binary diff hidden
1 NO CONTENT: file was removed, binary diff hidden
1 NO CONTENT: file was removed, binary diff hidden
1 NO CONTENT: file was removed, binary diff hidden
1 NO CONTENT: file was removed, binary diff hidden
1 NO CONTENT: file was removed, binary diff hidden
1 NO CONTENT: file was removed, binary diff hidden
1 NO CONTENT: file was removed, binary diff hidden
1 NO CONTENT: file was removed, binary diff hidden
1 NO CONTENT: file was removed
1 NO CONTENT: file was removed
1 NO CONTENT: file was removed
General Comments 0
You need to be logged in to leave comments. Login now