Skip to content
Snippets Groups Projects
Commit 64df851a authored by Giacomo Strangolino's avatar Giacomo Strangolino
Browse files

fix: lambda curve color and style linked to lambda 1,2,3... number

parent f79539c3
No related branches found
No related tags found
No related merge requests found
...@@ -5,7 +5,7 @@ include($${CUMBIA_ROOT}/include/quapps/quapps.pri) ...@@ -5,7 +5,7 @@ include($${CUMBIA_ROOT}/include/quapps/quapps.pri)
CONFIG += debug CONFIG += debug
# DEFINES -= QT_NO_DEBUG_OUTPUT DEFINES -= QT_NO_DEBUG_OUTPUT
# RESOURCES += # RESOURCES +=
......
...@@ -75,6 +75,7 @@ bool I0MMonPlot::yAutoScale() const { ...@@ -75,6 +75,7 @@ bool I0MMonPlot::yAutoScale() const {
} }
void I0MMonPlot::setSources(const QString &x, const QString &y, const QMap<int, double> lambdamap, int nsamples) void I0MMonPlot::setSources(const QString &x, const QString &y, const QMap<int, double> lambdamap, int nsamples)
{ {
qDebug() << __PRETTY_FUNCTION__ << lambdamap;
m_multiread_plu_i->unsetSources(); m_multiread_plu_i->unsetSources();
foreach(const QString& cn, m_curvesymap.keys()) foreach(const QString& cn, m_curvesymap.keys())
removeCurve(cn); removeCurve(cn);
...@@ -84,21 +85,20 @@ void I0MMonPlot::setSources(const QString &x, const QString &y, const QMap<int, ...@@ -84,21 +85,20 @@ void I0MMonPlot::setSources(const QString &x, const QString &y, const QMap<int,
m_lambdas = lambdamap; m_lambdas = lambdamap;
m_time_mode = (x == "time"); m_time_mode = (x == "time");
m_reset_scales(); m_reset_scales();
int la = 1, cc = 0;;
foreach(double l, lambdamap.values()) { foreach(double l, lambdamap.values()) {
QString cuna = QString("lambda %1").arg(l); QString cuna = QString("lambda %1").arg(l);
QuPlotCurve *crv = curve(cuna); QuPlotCurve *crv = curve(cuna);
const int lambdai = lambdamap.key(l) + 1; // from 1
if(!crv) { if(!crv) {
crv = new QuPlotCurve(cuna); crv = new QuPlotCurve(cuna);
addCurve(cuna, crv); addCurve(cuna, crv);
QPen p = crv->pen(); QPen p = crv->pen();
p.setColor(m_colormap[cc % m_colormap.size()]); p.setColor(m_colormap[(lambdai - 1) % m_colormap.size()]); // colormap lambdai - 1, from 0
p.setWidthF(2.5); p.setWidthF(2.5);
crv->setPen(p); crv->setPen(p);
crv->setTitle(QString("λ %1").arg(la++)); crv->setTitle(QString("λ %1").arg(lambdai));
cc++;
} }
m_curvesymap[cuna] = m_symstyles[m_curvesymap.size() % m_symstyles.size()]; m_curvesymap[cuna] = m_symstyles[(lambdai-1) % m_symstyles.size()];
} }
qDebug() << __PRETTY_FUNCTION__ << "settings sources: x " << x << " y " << y << "time mode" << m_time_mode; qDebug() << __PRETTY_FUNCTION__ << "settings sources: x " << x << " y " << y << "time mode" << m_time_mode;
if(m_time_mode) { if(m_time_mode) {
...@@ -114,6 +114,9 @@ void I0MMonPlot::setSources(const QString &x, const QString &y, const QMap<int, ...@@ -114,6 +114,9 @@ void I0MMonPlot::setSources(const QString &x, const QString &y, const QMap<int,
} }
} }
updateLegend(); updateLegend();
printf("I0MMonPlot::setSources curvesSize %d\n", curves().size());
foreach(QwtPlotCurve *c, curves())
printf("- %s\n", qstoc(c->title().text()));
} }
void I0MMonPlot::setYBounds(double ymi, double yma) { void I0MMonPlot::setYBounds(double ymi, double yma) {
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment