Example #1
0
void Histogram_gui::update_all() {
/*
  std::vector<float> frequencies = histogram_->histogram_frequencies();
  unsigned int size = frequencies.size();
  std::pair<float,float> min_max = histogram_->clipping_values();

  double* x = new double[size+1];
  double* y = new double[size+1];
  for( unsigned int i= 0 ; i < size ; i++ ) {
    x[i] = min_max.first + 
            double(i) * (min_max.second - min_max.first) / double( size );
    y[i] = frequencies[i];
  }
  x[size] = min_max.second;
  y[size] = y[size-1];

  refresh_plot( std::make_pair( x,y ), size+1);
  refresh_stats();
  
  delete [] x;
  delete [] y;
*/	

  changeCurve(control_panel_->whatPlot());

  if (curve_id_->minXValue() <= 0) {
    x_logscale_checkbox_->setText("Remove zeros from data first!");
    x_logscale_checkbox_->setEnabled( false );
  }
  else{
    x_logscale_checkbox_->setText("Logarithmic Scale");
    x_logscale_checkbox_->setEnabled( true );
  }
}
void polynomFitDialog::fit()
{
QString curve = boxName->currentText();
QStringList curvesList = graph->curvesList();
if (curvesList.contains(curve) <= 0)
	{
	QMessageBox::critical(this,tr("QtiPlot - Warning"),
		tr("The curve <b> %1 </b> doesn't exist anymore! Operation aborted!").arg(curve));
	boxName->clear();
	boxName->insertStringList(curvesList);
	return;
	}

int index = boxName->currentItem();
QwtPlotCurve *c = graph->curve(index);
if (!c || c->dataSize()<2)
	{
	QString s= tr("You can not fit curve:");
	s+="<p><b>'"+boxName->text(index)+"'</b><p>";
	s+=tr("because it has less than 2 points!");
	QMessageBox::warning(0,tr("QtiPlot - Warning"),s);

	changeCurve(index);
	}
else
	{
	ApplicationWindow *app = (ApplicationWindow *)this->parent();
	app->fitNumber++;
	graph->setFitID(app->fitNumber);

	QString result = graph->fitPolynomial(boxName->currentText(),boxOrder->value(),
			boxPoints->value(), boxStart->text().toDouble(),
			boxEnd->text().toDouble(), boxShowFormula->isChecked(), 
			boxColor->currentItem());

	app->updateLog(result);
	}
}