本文整理汇总了C++中PlotCurve::addYAxisValue方法的典型用法代码示例。如果您正苦于以下问题:C++ PlotCurve::addYAxisValue方法的具体用法?C++ PlotCurve::addYAxisValue怎么用?C++ PlotCurve::addYAxisValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlotCurve
的用法示例。
在下文中一共展示了PlotCurve::addYAxisValue方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: traverseGraphCell
void XMLParser::traverseGraphCell( Cell *parent, QDomElement &element )
{
// Get the style value
QString style = element.attribute( XML_STYLE, "Graph" );
// create inputcell with the saved style
Cell *graphcell = factory_->createCell( style, parent );
graphcell->setStyle(QString("Input"));
// graphcell->setStyle(style);
// go through all children in input cell/element
QString text;
QDomNode node = element.firstChild();
while( !node.isNull() )
{
QDomElement e = node.toElement();
if( !e.isNull() )
{
if( e.tagName() == XML_INPUTPART )
{
text = e.text();
GraphCell *gCell = dynamic_cast<GraphCell*>(graphcell);
gCell->setText(text);
}
else if( e.tagName() == XML_OUTPUTPART )
{
GraphCell *iCell = dynamic_cast<GraphCell*>(graphcell);
iCell->setTextOutput( e.text() );
}
else if( e.tagName() == XML_IMAGE )
{
addImage( graphcell, e );
}
else if( e.tagName() == XML_RULE )
{
graphcell->addRule(
new Rule( e.attribute( XML_NAME, "" ), e.text() ));
}
else if( e.tagName() == XML_GRAPHCELL_DATA ) {}
else if( e.tagName() == XML_GRAPHCELL_GRAPH ) {}
else if( e.tagName() == XML_GRAPHCELL_SHAPE ) {}
else if( e.tagName() == XML_GRAPHCELL_OMCPLOT )
{
GraphCell *gCell = dynamic_cast<GraphCell*>(graphcell);
// read attributes and set the plotwindow values
gCell->mpPlotWindow->setTitle(e.attribute(XML_GRAPHCELL_TITLE));
gCell->mpPlotWindow->setGrid(e.attribute(XML_GRAPHCELL_GRID));
int type = e.attribute(XML_GRAPHCELL_PLOTTYPE).toInt();
if (type == 1)
gCell->mpPlotWindow->setPlotType(PlotWindow::PLOTALL);
else if (type == 2)
gCell->mpPlotWindow->setPlotType(PlotWindow::PLOTPARAMETRIC);
else
gCell->mpPlotWindow->setPlotType(PlotWindow::PLOT);
gCell->mpPlotWindow->setLogX((e.attribute(XML_GRAPHCELL_LOGX) == XML_TRUE) ? true : false);
gCell->mpPlotWindow->setLogY((e.attribute(XML_GRAPHCELL_LOGY) == XML_TRUE) ? true : false);
gCell->mpPlotWindow->setXRange(e.attribute(XML_GRAPHCELL_XRANGE_MIN).toDouble(), e.attribute(XML_GRAPHCELL_XRANGE_MAX).toDouble());
gCell->mpPlotWindow->setYRange(e.attribute(XML_GRAPHCELL_YRANGE_MIN).toDouble(), e.attribute(XML_GRAPHCELL_YRANGE_MAX).toDouble());
gCell->mpPlotWindow->setXLabel(e.attribute(XML_GRAPHCELL_XLABEL));
gCell->mpPlotWindow->setYLabel(e.attribute(XML_GRAPHCELL_YLABEL));
gCell->mpPlotWindow->setCurveWidth(e.attribute(XML_GRAPHCELL_CURVE_WIDTH).toDouble());
gCell->mpPlotWindow->setCurveStyle(e.attribute(XML_GRAPHCELL_CURVE_STYLE).toDouble());
gCell->mpPlotWindow->setLegendPosition(e.attribute(XML_GRAPHCELL_LEGENDPOSITION));
gCell->mpPlotWindow->setFooter(e.attribute(XML_GRAPHCELL_FOOTER));
gCell->mpPlotWindow->setAutoScale((e.attribute(XML_GRAPHCELL_AUTOSCALE) == XML_TRUE) ? true : false);
// read curves
for (QDomNode n = e.firstChild(); !n.isNull(); n = n.nextSibling())
{
QDomElement curveElement = n.toElement();
if (curveElement.tagName() == XML_GRAPHCELL_CURVE)
{
PlotCurve *pPlotCurve = new PlotCurve("", curveElement.attribute(XML_GRAPHCELL_TITLE), "", gCell->mpPlotWindow->getPlot());
// read the curve data
if (curveElement.hasAttribute(XML_GRAPHCELL_XDATA) && curveElement.hasAttribute(XML_GRAPHCELL_YDATA))
{
QByteArray xByteArray = QByteArray::fromBase64(curveElement.attribute(XML_GRAPHCELL_XDATA).toStdString().c_str());
QDataStream xInStream(xByteArray);
while (!xInStream.atEnd())
{
double d;
xInStream >> d;
pPlotCurve->addXAxisValue(d);
}
QByteArray yByteArray = QByteArray::fromBase64(curveElement.attribute(XML_GRAPHCELL_YDATA).toStdString().c_str());
QDataStream yInStream(yByteArray);
while (!yInStream.atEnd())
{
double d;
yInStream >> d;
pPlotCurve->addYAxisValue(d);
}
// set the curve data
pPlotCurve->setData(pPlotCurve->getXAxisVector(), pPlotCurve->getYAxisVector(), pPlotCurve->getSize());
}
gCell->mpPlotWindow->getPlot()->addPlotCurve(pPlotCurve);
pPlotCurve->attach(gCell->mpPlotWindow->getPlot());
// read the curve attributes
//.........这里部分代码省略.........