本文整理汇总了C++中DataCurve::setData方法的典型用法代码示例。如果您正苦于以下问题:C++ DataCurve::setData方法的具体用法?C++ DataCurve::setData怎么用?C++ DataCurve::setData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataCurve
的用法示例。
在下文中一共展示了DataCurve::setData方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addResultCurve
void Convolution::addResultCurve()
{
ApplicationWindow *app = (ApplicationWindow *)parent();
if (!app)
return;
int cols = d_table->numCols();
int cols2 = cols+1;
d_table->addCol();
d_table->addCol();
#ifdef Q_CC_MSVC
QVarLengthArray<double> x_temp(d_n);
#else
double x_temp[d_n];
#endif
QLocale locale = app->locale();
for (int i = 0; i<d_n; i++){
double x = i+1;
x_temp[i] = x;
d_table->setText(i, cols, QString::number(x));
d_table->setText(i, cols2, locale.toString(d_x[i], 'g', app->d_decimal_digits));
}
QStringList l = d_table->colNames().grep(tr("Index"));
QString id = QString::number((int)l.size()+1);
QString label = objectName() + id;
d_table->setColName(cols, tr("Index") + id);
d_table->setColName(cols2, label);
d_table->setColPlotDesignation(cols, Table::X);
d_table->setHeaderColType();
if (d_graphics_display){
if (!d_output_graph)
createOutputGraph();
DataCurve *c = new DataCurve(d_table, d_table->colName(cols), d_table->colName(cols2));
#ifdef Q_CC_MSVC
c->setData(x_temp.data(), d_x, d_n);
#else
c->setData(x_temp, d_x, d_n);
#endif
c->setPen(QPen(ColorBox::color(d_curveColorIndex), 1));
d_output_graph->insertPlotItem(c, Graph::Line);
d_output_graph->updatePlot();
}
}
示例2: addResultCurve
QwtPlotCurve* Filter::addResultCurve(double *x, double *y)
{
ApplicationWindow *app = (ApplicationWindow *)parent();
QLocale locale = app->locale();
const QString tableName = app->generateUniqueName(QString(objectName()));
QString dataSet;
if (d_curve)
dataSet = d_curve->title().text();
else
dataSet = d_y_col_name;
d_result_table = app->newHiddenTable(tableName, d_explanation + " " + tr("of") + " " + dataSet, d_points, 2);
for (int i=0; i<d_points; i++){
d_result_table->setText(i, 0, locale.toString(x[i], 'e', app->d_decimal_digits));
d_result_table->setText(i, 1, locale.toString(y[i], 'e', app->d_decimal_digits));
}
DataCurve *c = 0;
if (d_graphics_display){
c = new DataCurve(d_result_table, tableName + "_1", tableName + "_2");
c->setData(x, y, d_points);
c->setPen(QPen(ColorBox::color(d_curveColorIndex), 1));
if (!d_output_graph)
d_output_graph = createOutputGraph()->activeGraph();
d_output_graph->insertPlotItem(c, Graph::Line);
d_output_graph->updatePlot();
}
return (QwtPlotCurve*)c;
}
示例3: addResultCurve
void Correlation::addResultCurve()
{
ApplicationWindow *app = dynamic_cast<ApplicationWindow *>(parent());
if (!app)
return;
QLocale locale = app->locale();
if (d_n > d_table->numRows())
d_table->setNumRows(d_n);
int cols = d_table->numCols();
int cols2 = cols+1;
d_table->addCol();
d_table->addCol();
int n = d_n/2;
QVarLengthArray<double> x_temp(d_n), y_temp(d_n);//double x_temp[d_n], y_temp[d_n];
for (int i = 0; i<d_n; i++){
double x = i - n;
x_temp[i] = x;
double y;
if(i < n)
y = d_x[n + i];
else
y = d_x[i - n];
y_temp[i] = y;
d_table->setText(i, cols, QString::number(x));
d_table->setText(i, cols2, locale.toString(y, 'g', app->d_decimal_digits));
}
QStringList l = d_table->colNames().grep(tr("Lag"));
QString id = QString::number((int)l.size()+1);
QString label = objectName() + id;
d_table->setColName(cols, tr("Lag") + id);
d_table->setColName(cols2, label);
d_table->setColPlotDesignation(cols, Table::X);
d_table->setHeaderColType();
if (d_graphics_display){
if (!d_output_graph)
d_output_graph = createOutputGraph()->activeGraph();
DataCurve *c = new DataCurve(d_table, d_table->colName(cols), d_table->colName(cols2));
c->setData(x_temp.data(), y_temp.data(), d_n);//c->setData(x_temp, y_temp, d_n);
c->setPen(QPen(ColorBox::color(d_curveColorIndex), 1));
d_output_graph->insertPlotItem(c, Graph::Line);
d_output_graph->updatePlot();
}
}
示例4: addResultCurve
void Correlation::addResultCurve()
{
ApplicationWindow *app = (ApplicationWindow *)parent();
if (!app)
return;
int rows = d_table->numRows();
int cols = d_table->numCols();
int cols2 = cols+1;
d_table->addCol();
d_table->addCol();
int n = rows/2;
double x_temp[rows], y_temp[rows];
for (int i = 0; i<rows; i++)
{
x_temp[i] = i - n;
if(i < n)
y_temp[i] = d_x[d_n - n + i];
else
y_temp[i] = d_x[i-n];
d_table->column(cols)->setValueAt(i, x_temp[i]);
d_table->column(cols2)->setValueAt(i, y_temp[i]);
}
QStringList l = d_table->colNames().grep(tr("Lag"));
QString id = QString::number((int)l.size()+1);
QString label = name() + id;
d_table->setColName(cols, tr("Lag") + id);
d_table->setColName(cols2, label);
d_table->setColPlotDesignation(cols, SciDAVis::X);
MultiLayer *ml = app->newGraph(name() + tr("Plot"));
if (!ml)
return;
DataCurve *c = new DataCurve(d_table, d_table->colName(cols), d_table->colName(cols2));
c->setData(x_temp, y_temp, rows);
c->setPen(QPen(ColorBox::color(d_curveColorIndex), 1));
ml->activeGraph()->insertPlotItem(c, Graph::Line);
ml->activeGraph()->updatePlot();
}
示例5: generateFitCurve
//.........这里部分代码省略.........
memoryErrorMessage();
free(X);
return;
}
QString tableName = app->generateUniqueName(tr("Fit"));
QString dataSet;
if (d_curve)
dataSet = d_curve->title().text();
else
dataSet = d_y_col_name;
QString label = d_explanation + " " + tr("fit of") + " " + dataSet;
d_result_table = app->newHiddenTable(tableName, label, d_points, peaks_aux + 2);
QStringList header = QStringList() << "1";
for (i = 0; i<peaks_aux; i++)
header << tr("peak") + QString::number(i+1);
header << "2";
d_result_table->setHeader(header);
QLocale locale = app->locale();
for (i = 0; i<d_points; i++){
X[i] = d_x[i];
d_result_table->setText(i, 0, locale.toString(X[i], 'e', d_prec));
double yi=0;
for (j=0; j<d_peaks; j++){
double diff = X[i] - d_results[3*j + 1];
double w = d_results[3*j + 2];
double y_aux = 0;
if (d_profile == Gauss)
y_aux += sqrt(M_2_PI)*d_results[3*j]/w*exp(-2*diff*diff/(w*w));
else
y_aux += M_2_PI*d_results[3*j]*w/(4*diff*diff+w*w);
yi += y_aux;
y_aux += d_results[d_p - 1];
d_result_table->setText(i, j+1, locale.toString(y_aux, 'e', d_prec));
gsl_matrix_set(m, i, j, y_aux);
}
Y[i] = yi + d_results[d_p - 1];//add offset
if (d_peaks > 1)
d_result_table->setText(i, d_peaks+1, locale.toString(Y[i], 'e', d_prec));
}
customizeFitResults();
if (d_graphics_display){
if (!d_output_graph)
createOutputGraph();
label = tableName + "_2";
DataCurve *c = new DataCurve(d_result_table, tableName + "_1", label);
if (d_curve){
c->setCurveType(d_curve->curveType());
c->setAxis(d_curve->xAxis(), d_curve->yAxis());
}
if (d_peaks > 1)
c->setPen(QPen(d_curveColor, 2));
else
c->setPen(QPen(d_curveColor, 1));
if (c->curveType() == QwtPlotCurve::Xfy)
c->setData(Y, X, d_points);
else
c->setData(X, Y, d_points);
d_output_graph->insertPlotItem(c, Graph::Line);
d_output_graph->addFitCurve(c);
if (generate_peak_curves){
for (i=0; i<peaks_aux; i++){//add the peak curves
for (j=0; j<d_points; j++)
Y[j] = gsl_matrix_get (m, j, i);
label = tableName + "_" + tr("peak") + QString::number(i+1);
c = new DataCurve(d_result_table, tableName + "_1", label);
c->setPen(QPen(d_peaks_color, 1));
if (d_curve){
c->setCurveType(d_curve->curveType());
c->setAxis(d_curve->xAxis(), d_curve->yAxis());
}
if (c->curveType() == QwtPlotCurve::Xfy)
c->setData(Y, X, d_points);
else
c->setData(X, Y, d_points);
d_output_graph->insertPlotItem(c, Graph::Line);
d_output_graph->addFitCurve(c);
}
}
d_output_graph->replot();
}
gsl_matrix_free(m);
free(X);
free(Y);
}
}