当前位置: 首页>>代码示例>>C++>>正文


C++ DataCurve::plotAssociation方法代码示例

本文整理汇总了C++中DataCurve::plotAssociation方法的典型用法代码示例。如果您正苦于以下问题:C++ DataCurve::plotAssociation方法的具体用法?C++ DataCurve::plotAssociation怎么用?C++ DataCurve::plotAssociation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DataCurve的用法示例。


在下文中一共展示了DataCurve::plotAssociation方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: changePlotAssociation

void AssociationsDialog::changePlotAssociation(int curve, const QString &text) {
  DataCurve *c =
      dynamic_cast<DataCurve *>(graph->curve(curve)); // c_keys[curve]);
  if (!c)
    return;

  if (c->plotAssociation() == text)
    return;

  QStringList lst = text.split(",", QString::SkipEmptyParts);
  if (lst.count() == 1) {
    c->setTitle(lst[0]);
    if (auto b = dynamic_cast<BoxCurve *>(c))
      b->loadData();
    else if (auto p = dynamic_cast<QwtPieCurve *>(c))
      p->loadData();
  } else if (lst.count() == 2) {
    c->setXColumnName(lst[0].remove("(X)"));
    c->setTitle(lst[1].remove("(Y)"));
    c->loadData();
  } else if (lst.count() == 3) { // curve with error bars
    if (QwtErrorPlotCurve *er = dynamic_cast<QwtErrorPlotCurve *>(c)) {
      QString xColName = lst[0].remove("(X)");
      QString yColName = lst[1].remove("(Y)");
      QString erColName = lst[2].remove("(xErr)").remove("(yErr)");
      DataCurve *master_curve = graph->masterCurve(xColName, yColName);
      if (!master_curve)
        return;

      int type = QwtErrorPlotCurve::Vertical;
      if (text.contains("(xErr)"))
        type = QwtErrorPlotCurve::Horizontal;
      er->setDirection(type);
      er->setTitle(erColName);
      if (master_curve != er->masterCurve())
        er->setMasterCurve(master_curve);
      else
        er->loadData();
    }
  } else if (lst.count() == 4) {
    if (VectorCurve *v = dynamic_cast<VectorCurve *>(c)) {
      v->setXColumnName(lst[0].remove("(X)"));
      v->setTitle(lst[1].remove("(Y)"));

      QString xEndCol = lst[2].remove("(X)").remove("(A)");
      QString yEndCol = lst[3].remove("(Y)").remove("(M)");
      if (v->vectorEndXAColName() != xEndCol ||
          v->vectorEndYMColName() != yEndCol)
        v->setVectorEnd(xEndCol, yEndCol);
      else
        v->loadData();
    }
  }
  graph->notifyChanges();
}
开发者ID:liyulun,项目名称:mantid,代码行数:55,代码来源:AssociationsDialog.cpp

示例2: changePlotAssociation

void AssociationsDialog::changePlotAssociation(int curve, const QStringList& ass)
{
	DataCurve *c = (DataCurve *)graph->dataCurve(curvesIndicesList[curve]);
	if (!c)
		return;

	if (c->plotAssociation() == ass)
		return;

	QStringList lst = ass;
	if (lst.count() == 1){
		c->setTitle(lst[0]);
		if (c->type() == Graph::Box)
			((BoxCurve*)c)->loadData();
		else if (c->type() == Graph::Pie)
			((PieCurve*)c)->loadData();
		else if (c->type() == Graph::Histogram)
			((QwtHistogram*)c)->loadData();
	} else if (lst.count() == 2){
		c->setXColumnName(lst[0].remove("(X)"));
		c->setTitle(lst[1].remove("(Y)"));
		c->loadData();
	} else if (lst.count() == 3){//curve with error bars
		ErrorBarsCurve *er = (ErrorBarsCurve *)c;
		QString xColName = lst[0].remove("(X)");
		QString yColName = lst[1].remove("(Y)");
		QString erColName = lst[2].remove("(xErr)").remove("(yErr)");
		DataCurve *master_curve = graph->masterCurve(xColName, yColName);
		if (!master_curve)
			return;

		int type = ErrorBarsCurve::Vertical;
		if (ass.join(",").contains("(xErr)"))
			type = ErrorBarsCurve::Horizontal;
		er->setDirection(type);
		er->setTitle(erColName);
		if (master_curve != er->masterCurve())
			er->setMasterCurve(master_curve);
		else
			er->loadData();
	} else if (lst.count() == 4){
		VectorCurve *v = (VectorCurve *)c;
		v->setXColumnName(lst[0].remove("(X)"));
		v->setTitle(lst[1].remove("(Y)"));

		QString xEndCol = lst[2].remove("(X)").remove("(A)");
		QString yEndCol = lst[3].remove("(Y)").remove("(M)");
		if (v->vectorEndXAColName() != xEndCol || v->vectorEndYMColName() != yEndCol)
			v->setVectorEnd(xEndCol, yEndCol);
		else
			v->loadData();
	}
	graph->notifyChanges();
}
开发者ID:kuzavas,项目名称:qtiplot,代码行数:54,代码来源:AssociationsDialog.cpp


注:本文中的DataCurve::plotAssociation方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。