All,
Ive successfully integrated the QPolarPlot into my application, however im only able to add data at the object creation. I have a database that im successfully pulling plotted data from, that is working (via qDebug i can see that data), however when i try to add points to the plot, they dont show up..
code used to create the chart..
const qreal angularMin = 0;
const qreal angularMax = 360;
const qreal radialMin = 0;
const qreal radialMax = 100;
sat_plot = new QScatterSeries();
sat_plot
->setColor
(QColor(Qt
::blue));
sat_plot->setName("scatter");
sat_plot->setMarkerSize(10);
//sat_plot->append(20, 300); //<--- i can add these plots here, but not later in other function...
//sat_plot->append(40, 100);
//sat_plot->append(50, 0);
QPolarChart *sat_chart = new QPolarChart();
sat_chart->addSeries(sat_plot);
qreal polar_w = 1000;
qreal polar_h = 1000;
sat_chart->setPreferredSize(polar_h,polar_h);
QValueAxis *angularAxis = new QValueAxis();
angularAxis->setTickCount(17);
angularAxis->setLabelFormat("%d");
angularAxis->setShadesVisible(true);
QFont axFont
("Helvetica [Cronyx]",
8);
angularAxis->setLabelsFont(axFont);
sat_chart->addAxis(angularAxis, QPolarChart::PolarOrientationAngular);
sat_chart->setMargins(QMargins::QMargins(0,0,0,0));
sat_chart->legend()->setVisible(false);
QValueAxis *radialAxis = new QValueAxis();
radialAxis->setTickCount(10);
radialAxis->setLabelFormat("");
sat_chart->addAxis(radialAxis, QPolarChart::PolarOrientationRadial);
radialAxis->setRange(radialMin, radialMax);
angularAxis->setRange(angularMin, angularMax);
QChartView *chartView = new QtCharts::QChartView();
chartView->setChart(sat_chart);
chartView
->setRenderHint
(QPainter::Antialiasing);
const qreal angularMin = 0;
const qreal angularMax = 360;
const qreal radialMin = 0;
const qreal radialMax = 100;
sat_plot = new QScatterSeries();
sat_plot->setColor(QColor(Qt::blue));
sat_plot->setName("scatter");
sat_plot->setMarkerSize(10);
//sat_plot->append(20, 300); //<--- i can add these plots here, but not later in other function...
//sat_plot->append(40, 100);
//sat_plot->append(50, 0);
QPolarChart *sat_chart = new QPolarChart();
sat_chart->addSeries(sat_plot);
qreal polar_w = 1000;
qreal polar_h = 1000;
sat_chart->setPreferredSize(polar_h,polar_h);
QValueAxis *angularAxis = new QValueAxis();
angularAxis->setTickCount(17);
angularAxis->setLabelFormat("%d");
angularAxis->setShadesVisible(true);
QFont axFont("Helvetica [Cronyx]", 8);
angularAxis->setLabelsFont(axFont);
angularAxis->setShadesBrush(QBrush(QColor(249, 249, 255)));
sat_chart->addAxis(angularAxis, QPolarChart::PolarOrientationAngular);
sat_chart->setMargins(QMargins::QMargins(0,0,0,0));
sat_chart->legend()->setVisible(false);
QValueAxis *radialAxis = new QValueAxis();
radialAxis->setTickCount(10);
radialAxis->setLabelFormat("");
sat_chart->addAxis(radialAxis, QPolarChart::PolarOrientationRadial);
radialAxis->setRange(radialMin, radialMax);
angularAxis->setRange(angularMin, angularMax);
QChartView *chartView = new QtCharts::QChartView();
chartView->setChart(sat_chart);
chartView->setRenderHint(QPainter::Antialiasing);
To copy to clipboard, switch view to plain text mode
I tried to use both
sat_plot->append(100,56);
sat_plot->append(100,56);
To copy to clipboard, switch view to plain text mode
and
sat_plot->insert(0,P)
QPoint p(23,43);
sat_plot->insert(0,P)
To copy to clipboard, switch view to plain text mode
I know i'm able to access the object from another function, because i can call
sat_plot->clear();
sat_plot->clear();
To copy to clipboard, switch view to plain text mode
and it clears the chart, also i can see that i am actually adding points to the chart with
sat_plot->points().size();
sat_plot->points().size();
To copy to clipboard, switch view to plain text mode
in qDebug which is incrementing.. i also checked
sat_plot->pointsVisible();
sat_plot->pointsVisible();
To copy to clipboard, switch view to plain text mode
and it is true..
any ideas?
Bookmarks