Hello,
My application is plotting graphs with line style and then there is a configuration dialog where the user can add dots on this lines. But when I press the checkbox to create the dots, nothing happens, my graph keeps the same. The part that I plot the graph is:
// Insert new curves
curveArray
[iGraphCounter
].
setAxes(QwtPlot::xBottom,
QwtPlot::yLeft+iGraphCounter
);
curveArray[iGraphCounter].setTitle(object->legend.c_str());
curveArray
[iGraphCounter
].
setRenderHint(QwtPlotItem::RenderAntialiased);
curveArray
[iGraphCounter
].
setLegendAttribute(QwtPlotCurve::LegendShowLine,
true);
curveArray
[iGraphCounter
].
setPen(QColor(iColorMap
[iGraphCounter
][0],iColorMap
[iGraphCounter
][1],iColorMap
[iGraphCounter
][2],iColorMap
[iGraphCounter
][3]));
curveArray[iGraphCounter].setRawSamples(&object->xContent[0],&object->yContent[0],object->xContent.size());
curveArray[iGraphCounter].attach(plot);
// Insert new curves
curveArray[iGraphCounter].setAxes(QwtPlot::xBottom,QwtPlot::yLeft+iGraphCounter);
curveArray[iGraphCounter].setTitle(object->legend.c_str());
curveArray[iGraphCounter].setRenderHint(QwtPlotItem::RenderAntialiased);
curveArray[iGraphCounter].setLegendAttribute(QwtPlotCurve::LegendShowLine, true);
curveArray[iGraphCounter].setPen(QColor(iColorMap[iGraphCounter][0],iColorMap[iGraphCounter][1],iColorMap[iGraphCounter][2],iColorMap[iGraphCounter][3]));
curveArray[iGraphCounter].setStyle(QwtPlotCurve::Lines);
curveArray[iGraphCounter].setRawSamples(&object->xContent[0],&object->yContent[0],object->xContent.size());
curveArray[iGraphCounter].attach(plot);
To copy to clipboard, switch view to plain text mode
When the user press the combox to add the dots, the application goes to this part:
if (dotLinesCheckBox->isChecked())
{
for (int i=0; i<iGraphCounter; i++)
{
curveArray
[iGraphCounter
].
setSymbol(new QwtSymbol ( QwtSymbol::Ellipse ,
QBrush(curveArray
[iGraphCounter
].
pen().
color()),
QPen(curveArray
[iGraphCounter
].
pen().
color()),
QSize(5,
5)));
}
}
else
{
for (int i=0; i<iGraphCounter; i++)
{
curveArray
[iGraphCounter
].
setSymbol(new QwtSymbol ( QwtSymbol::NoSymbol ,
QBrush(curveArray
[iGraphCounter
].
pen().
color()),
QPen(curveArray
[iGraphCounter
].
pen().
color()),
QSize(5,
5)));
}
}
plot->replot();
if (dotLinesCheckBox->isChecked())
{
for (int i=0; i<iGraphCounter; i++)
{
curveArray[iGraphCounter].setSymbol(new QwtSymbol ( QwtSymbol::Ellipse , QBrush(curveArray[iGraphCounter].pen().color()), QPen(curveArray[iGraphCounter].pen().color()), QSize(5,5)));
}
}
else
{
for (int i=0; i<iGraphCounter; i++)
{
curveArray[iGraphCounter].setSymbol(new QwtSymbol ( QwtSymbol::NoSymbol , QBrush(curveArray[iGraphCounter].pen().color()), QPen(curveArray[iGraphCounter].pen().color()), QSize(5,5)));
}
}
plot->replot();
To copy to clipboard, switch view to plain text mode
I think it's because my curves are already attached and then I cannot change. But I'm not sure. And if what I think it's true, how can I make it?
How can I plot a graph with lines and then later add dots to the lines?
Thanks in advance
Best Regards
Bookmarks