private String createScript ( File resultFile ) { String newLine = System . getProperty ( "line.separator" ) ; int sourceFileIdx = 0 ; // terminal options; String script = "set term " + terminalOptions ( Terminal . valueOf ( outputTypeOption . getChosenLabel ( ) ) ) + newLine ; script += "set output '" + resultFile . getAbsolutePath ( ) + "'" + newLine ; script += "set datafile separator ','" + newLine ; script += "set grid" + newLine ; script += "set style line 1 pt 8" + newLine ; script += "set style line 2 lt rgb '#00C000'" + newLine ; script += "set style line 5 lt rgb '#FFD800'" + newLine ; script += "set style line 6 lt rgb '#4E0000'" + newLine ; script += "set format x '%.0s %c" + getAxisUnit ( xUnitOption . getValue ( ) ) + "'" + newLine ; script += "set format y '%.0s %c" + getAxisUnit ( yUnitOption . getValue ( ) ) + "'" + newLine ; script += "set ylabel '" + yTitleOption . getValue ( ) + "'" + newLine ; script += "set xlabel '" + xTitleOption . getValue ( ) + "'" + newLine ; if ( ! legendTypeOption . getChosenLabel ( ) . equals ( LegendType . NONE ) ) { script += "set key " + legendTypeOption . getChosenLabel ( ) . toLowerCase ( ) . replace ( ' ' , ' ' ) + " " + legendLocationOption . getChosenLabel ( ) . toLowerCase ( ) . replace ( ' ' , ' ' ) + newLine ; } // additional commands script += additionalSetOption . getValue ( ) ; // plot command script += "plot " + additionalPlotOption . getValue ( ) + " " ; // plot for each input file for ( int i = 0 ; i < inputFilesOption . getList ( ) . length ; i ++ ) { if ( sourceFileIdx > 0 ) { script += ", " ; } sourceFileIdx ++ ; script += "'" + ( ( StringOption ) inputFilesOption . getList ( ) [ i ] ) . getValue ( ) + "' using " + xColumnOption . getValue ( ) + ":" + yColumnOption . getValue ( ) ; if ( smoothOption . isSet ( ) ) { script += ":(1.0) smooth bezier" ; } script += " with " + plotStyleOption . getChosenLabel ( ) . toLowerCase ( ) + " ls " + sourceFileIdx + " lw " + lineWidthOption . getValue ( ) ; if ( plotStyleOption . getChosenLabel ( ) . equals ( PlotStyle . LINESPOINTS . toString ( ) ) && pointIntervalOption . getValue ( ) > 0 ) { script += " pointinterval " + pointIntervalOption . getValue ( ) ; } script += " title '" + ( ( StringOption ) fileAliasesOption . getList ( ) [ i ] ) . getValue ( ) + "'" ; } script += newLine ; return script ; }
Creates the content of the gnuplot script .