qscatterseries.cpp
30 lines
| 817 B
| text/x-c
|
CppLexer
Tero Ahola
|
r8 | #include "qscatterseries.h" | ||
Tero Ahola
|
r13 | #include "qseriespointgraphicsitem.h" | ||
Tero Ahola
|
r8 | #include <QPainter> | ||
Tero Ahola
|
r13 | #include <QGraphicsScene> | ||
Tero Ahola
|
r8 | |||
QScatterSeries::QScatterSeries(QGraphicsItem *parent) : | ||||
QGraphicsItem(parent) | ||||
{ | ||||
} | ||||
QRectF QScatterSeries::boundingRect() const | ||||
{ | ||||
Tero Ahola
|
r13 | return QRectF(0, 50, 100, 100); | ||
Tero Ahola
|
r8 | } | ||
void QScatterSeries::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) | ||||
{ | ||||
Tero Ahola
|
r13 | // painter->drawRect(boundingRect()); | ||
} | ||||
void QScatterSeries::setData(QList<QChartDataPoint> data) | ||||
//void QScatterSeries::setData(QList<int> data) | ||||
{ | ||||
foreach(QChartDataPoint point, data) { | ||||
// TODO: ownership? | ||||
// TODO: position | ||||
QSeriesPointGraphicsItem *item = new QSeriesPointGraphicsItem( | ||||
point[0].toReal(), 100-point[1].toReal(), this); | ||||
} | ||||
Tero Ahola
|
r8 | } | ||