// plot the standard curve
private int plott(){
int returnFlag = 1;
double[][] plotData = new double[4][];
PlotGraph pg = null;
switch(this.plotOptions){
case 0: plotData[0] = this.analyteConcns;
plotData[1] = this.responses;
plotData[2] = this.interpolationConcns;
plotData[3] = this.calculatedResponses;
pg = new PlotGraph(plotData);
pg.setXaxisLegend("Analyte concentration (a)");
pg.setYaxisLegend("Assay response (r) ");
break;
case 1: int nLen1 = this.nAnalyteConcns;
int nLen2 = this.nInterp;
if(nLen1!=this.nPlot){
nLen1=this.nPlot;
nLen2=this.nInterp-1;
}
plotData[0] = new double[nLen1];
plotData[1] = new double[nLen1];
plotData[2] = new double[nLen2];
plotData[3] = new double[nLen2];
if(nLen1!=this.nAnalyteConcns){
for(int i=1; i<this.nAnalyteConcns; i++){
plotData[0][i-1] = this.log10AnalyteConcns[i];
plotData[1][i-1] = this.responses[i];
}
for(int i=1; i<this.nInterp; i++){
plotData[2][i-1] = Math.log10(this.interpolationConcns[i]);
plotData[3][i-1] = this.calculatedResponses[i];
}
}
else{
plotData[0] = this.log10AnalyteConcns;
plotData[1] = this.responses;
plotData[3] = this.calculatedResponses;
plotData[2] = new double[this.nInterp];
for(int i=0; i<this.nInterp; i++){
plotData[2][i] = Math.log10(this.interpolationConcns[i]);
}
}
pg = new PlotGraph(plotData);
pg.setXaxisLegend("Log10[ Analyte concentration (a) ]");
pg.setYaxisLegend("Assay response (r) ");
break;
case 2: nLen1 = this.nAnalyteConcns;
nLen2 = this.nInterp;
if(nLen1!=this.nPlot){
nLen1=this.nPlot;
nLen2=this.nInterp-1;
}
plotData[0] = new double[nLen1];
plotData[1] = new double[nLen1];
plotData[2] = new double[nLen2];
plotData[3] = new double[nLen2];
if(nLen1!=this.nAnalyteConcns){
for(int i=1; i<this.nAnalyteConcns; i++){
plotData[0][i-1] = this.logeAnalyteConcns[i];
plotData[1][i-1] = this.responses[i];
}
for(int i=1; i<this.nInterp; i++){
plotData[2][i-1] = Math.log(this.interpolationConcns[i]);
plotData[3][i-1] = this.calculatedResponses[i];
}
}
else{
plotData[0] = this.logeAnalyteConcns;
plotData[1] = this.responses;
plotData[3] = this.calculatedResponses;
plotData[2] = new double[this.nInterp];
for(int i=0; i<this.nInterp; i++){
plotData[2][i] = Math.log(this.interpolationConcns[i]);
}
}
pg = new PlotGraph(plotData);
pg.setXaxisLegend("Loge[ Analyte concentration (a) ]");
pg.setYaxisLegend("Assay response (r) ");
break;
case 3: if(!this.responsesPlot){
System.out.println("A log(concentration) v. log(responses) plot is not possible; zero or negative responses");
return -1;
}
nLen1 = this.nAnalyteConcns;
nLen2 = this.nInterp;
if(nLen1!=this.nPlot){
nLen1=this.nPlot;
nLen2=this.nInterp-1;
}
plotData[0] = new double[nLen1];
plotData[1] = new double[nLen1];
plotData[2] = new double[nLen2];
plotData[3] = new double[nLen2];
if(nLen1!=this.nAnalyteConcns){
for(int i=1; i<this.nAnalyteConcns; i++){
plotData[0][i-1] = this.log10AnalyteConcns[i];
plotData[1][i-1] = this.log10Responses[i];
}
for(int i=1; i<this.nInterp; i++){
plotData[2][i-1] = Math.log10(this.interpolationConcns[i]);
plotData[3][i-1] = Math.log10(this.calculatedResponses[i]);
}
}
else{
plotData[0] = this.log10AnalyteConcns;
plotData[1] = this.log10Responses;
plotData[2] = new double[this.nInterp];
plotData[3] = new double[this.nInterp];
for(int i=0; i<this.nInterp; i++){
plotData[2][i] = Math.log10(this.interpolationConcns[i]);
plotData[3][i] = Math.log10(this.calculatedResponses[i]);
}
}
pg = new PlotGraph(plotData);
pg.setXaxisLegend("Log10[ Analyte concentration (a) ]");
pg.setYaxisLegend("Log10[ Assay response (r) ]");
break;
case 4: if(!this.responsesPlot){
System.out.println("A log(concentration) v. log(responses) plot is not possible; zero or negative responses");
return -1;
}
nLen1 = this.nAnalyteConcns;
nLen2 = this.nInterp;
if(nLen1!=this.nPlot){
nLen1=this.nPlot;
nLen2=this.nInterp-1;
}
plotData[0] = new double[nLen1];
plotData[1] = new double[nLen1];
plotData[2] = new double[nLen2];
plotData[3] = new double[nLen2];
if(nLen1!=this.nAnalyteConcns){
for(int i=1; i<this.nAnalyteConcns; i++){
plotData[0][i-1] = this.logeAnalyteConcns[i];
plotData[1][i-1] = this.logeResponses[i];
}
for(int i=1; i<this.nInterp; i++){
plotData[2][i-1] = Math.log(this.interpolationConcns[i]);
plotData[3][i-1] = Math.log(this.calculatedResponses[i]);
}
}
else{
plotData[0] = this.logeAnalyteConcns;
plotData[1] = this.logeResponses;
plotData[2] = new double[this.nInterp];
plotData[3] = new double[this.nInterp];
for(int i=0; i<this.nInterp; i++){
plotData[2][i] = Math.log(this.interpolationConcns[i]);
plotData[3][i] = Math.log(this.calculatedResponses[i]);
}
}
pg = new PlotGraph(plotData);
pg.setXaxisLegend("Loge[ Analyte concentration (a) ]");
pg.setYaxisLegend("Loge[ Assay response (r) ]");
break;
}
int[] points = {1, 0};
pg.setPoint(points);
int[] lines = {0, 3};
pg.setLine(lines);
pg.setGraphTitle(this.titleZero);
pg.setGraphTitle2(this.titleOne);
pg.plot();
return returnFlag;
}