#include <QApplication>
#include <QtCharts>
QT_CHARTS_USE_NAMESPACE
struct Data{
qreal r;
qreal a;
qreal s;
};
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QChartView view;
QPolarChart *chart = new QPolarChart;
std::vector<Data> data;
for(int i=0; i <= 360; i+=30){
data.push_back(Data{i*1.0, i*1.0, 2*qAbs(sin(i*3.14159265358979323846/360))});
}
view.setChart(chart);
QScatterSeries *series = new QScatterSeries;
for(const Data & d: data){
*series << QPointF(d.a, d.r);
}
chart->addSeries(series);
chart->createDefaultAxes();
view.show();
for(int index= 0; index < series->count(); index++){
QPointF p = chart->mapToPosition(series->at(index) , series);
QGraphicsItem *it = view.itemAt(view.mapFromScene(p));
it->setTransformOriginPoint(it->boundingRect().center());
it->setScale(data[index].s);
}
return a.exec();
}
2020년 3월 11일 수요일
QT : a individual marker size for each point in a QScatterSeries
피드 구독하기:
댓글 (Atom)
댓글 없음:
댓글 쓰기