import hep.aida.*;
import java.util.Random;
public class Example6 {

   public static void main(String[] argv) {

      IAnalysisFactory     af     = IAnalysisFactory.create();
      IDataPointSetFactory dpsf   = af.createDataPointSetFactory(null);
      IDataPointSet dataPointSet = dpsf.create("dummy","Simulacia linearnej zavislosti",2);

      Random r = new Random(1234567);
      for ( int i = 0; i<10; i++ ) {
        double x = 0.2*(i+1);
        double y = (1+0.05*r.nextGaussian()) * (3.5*x);
        double error =0.05*Math.abs(y);
        dataPointSet.addPoint();
        dataPointSet.point(i).coordinate(0).setValue(x);
        dataPointSet.point(i).coordinate(1).setValue(y);
        dataPointSet.point(i).coordinate(1).setErrorPlus(error);
      }

      IPlotter plotter = af.createPlotterFactory().create("Plot IDataPointSets");
      plotter.region(0).setXLimits(0.,2.2);
      plotter.region(0).plot(dataPointSet);
      plotter.show();
   }
}


