Displaying differences for changeset
 
display as  

src/java/cfa/Graphing.java

@@ -16,11 +16,8 @@
 import org.jfree.chart.plot.XYPlot;
 import org.jfree.chart.renderer.xy.XYItemRenderer;
 import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer;
-import org.jfree.data.time.Day;
-import org.jfree.data.time.Month;
 import org.jfree.data.time.TimeSeries;
 import org.jfree.data.time.TimeSeriesCollection;
-import org.jfree.data.time.Year;
 import org.jfree.data.xy.XYDataset;
 import org.jfree.data.xy.XYSeries;
 import org.jfree.data.xy.XYSeriesCollection;
@@ -29,7 +26,7 @@
 import org.jfree.ui.TextAnchor;
 
 /**
-* Last Updated: 16-December-2014
+* Last Updated: 9-November-2015
 * @author Tyler Wible
 * @since 3-February-2014
 */
@@ -224,7 +221,7 @@
      * @param seriesIndex  the graph index of the series to be plotted
      * @return the provided XYPlot with the series added to it with the above properties
      */
-    public XYPlot graphSeries(XYPlot plot, double[][] series, Color lineColor, int seriesIndex){
+    public XYPlot addXYSeries(XYPlot plot, double[][] series, Color lineColor, int seriesIndex){
         XYSeries xySeries = new XYSeries("");
         for(int i=0; i<series.length; i++){
             double y = series[i][1];
@@ -249,104 +246,28 @@
         return plot;
     }
     /**
-     * Graphs the provided "series" as an XY series with x as the first column y as the second column in the provided color
-     * on the provided XYPlot, this series is not visible in the legend
-     * @param plot  the XYPlot to add the "series" to
-     * @param series  a String[][] array with series[all][0] =  dates in yyyy-MM-dd format, series[all][1] = y-values
-     * @param timeStep  a flag for what data is being graphed ("Daily", "Monthly", or "Yearly")
-     * @param seriesName  the name of the series to appear in the legend (if showInLegend is true)
-     * @param lineColor  the color of the line to be graphed
-     * @param seriesIndex  the graph index of the series to be plotted
-     * @param showInLegend  a flag to show this series in the legend (true) or not (false)
-     * @param leapYearTF  a flag to check if the main dataset is a leap year or not so that if graphing data repeatedly for one year (see timeseries envelope graph) Feb. 29th does or doesnot get plotted
-     * @return the provided XYPlot with the series added to it with the above properties
-     */
-    public XYPlot graphSeries(XYPlot plot,
-                              String[][] series,
-                              String timeStep,
-                              String seriesName,
-                              Color lineColor,
-                              int seriesIndex,
-                              boolean showInLegend,
-                              boolean leapYearTF){
-        TimeSeries timeSeries = new TimeSeries(seriesName);
-        for(int i=0; i<series.length; i++){
-            String tmpStr = series[i][0];
-            double value = Double.parseDouble(series[i][1]);
-            
-            if(timeStep.equalsIgnoreCase("daily")){
-                double d = Double.parseDouble(tmpStr.substring(8));
-                double m = Double.parseDouble(tmpStr.substring(5,7));
-                double y = Double.parseDouble(tmpStr.substring(0,4));
-                int day =  (int)d;
-                int month = (int)m;
-                int year = (int)y;
-                try{
-                    Day date = new Day(day,month,year);//day,month,year
-                    timeSeries.add(date, value);
-                }catch(IllegalArgumentException e){
-                    //If there is an error with the date and it is not due to trying 
-                    //to plot Feb. 29th in a non-leap year then throw the error
-                    if(!leapYearTF && month!=2 && day!=29){
-                        throw new IllegalArgumentException (e);
-                    }
-                }
-                
-            }else if(timeStep.equalsIgnoreCase("monthly")){
-                double m = Double.parseDouble(tmpStr.substring(5,7));
-                double y = Double.parseDouble(tmpStr.substring(0,4));
-                int month = (int)m;
-                int year = (int)y;
-                Month date = new Month(month,year);//month,year
-                timeSeries.add(date, value);
-                
-            }else if(timeStep.equalsIgnoreCase("yearly")){
-                double y = Double.parseDouble(tmpStr.substring(0,4));
-                int year = (int)y;
-                Year date = new Year(year);//year
-                timeSeries.add(date, value);
-            }
-        }
-
-        //Create a graph with the line
-        TimeSeriesCollection currentDataset = new TimeSeriesCollection(timeSeries);
-        XYItemRenderer renderer = new XYLineAndShapeRenderer(true, false);
-        renderer.setSeriesPaint(0, lineColor);
-        renderer.setSeriesVisibleInLegend(0, showInLegend);
-
-        //Set the line data, renderer, and axis into plot
-        plot.setDataset(seriesIndex, currentDataset);
-        plot.setRenderer(seriesIndex, renderer);
-
-        //Map the line to the first Domain and first Range
-        plot.mapDatasetToDomainAxis(0, 0);
-        plot.mapDatasetToRangeAxis(0, 0);
-
-        return plot;
-    }
-    /**
      * Graphs the TimeSeries on to the provided plot with the below properties for rendering, color, series index
      * @param plot  The XYPlot to graph the XYSeries on
      * @param currentLine  the XYSeries containing the x,y points of the current line series
      * @param lineTrue  a boolean, true if the series is to have lines connecting the points, otherwise no line
      * @param seriesColor  The desired color of the series (Java.Color)
-     * @param dashedLine  if true then the XYSeries will have a dashed line instead of a solid one, if false it will be the normal solid line
-     * @param shortDash  if true a dashed line like the major grid lines will be drawn, otherwise a long dashed line will be used
-     * @param thickLine  if true the line will have a thicker stroke, if false it will be left to the defaults
-     * @param visibleInLegend  if true then the XYSeries' name will be visible in the legend, if false this XYSeries' name will not be visible in the legend
+     * @param dashedLine_TF  if true then the XYSeries will have a dashed line instead of a solid one, if false it will be the normal solid line
+     * @param shortDash_TF  if true a dashed line like the major grid lines will be drawn, otherwise a long dashed line will be used
+     * @param thickLine_TF  if true the line will have a thicker stroke (this overwrites any changes due to dash size), if false it will be left to the defaults
+     * @param visibleInLegend_TF  if true then the XYSeries' name will be visible in the legend, if false this XYSeries' name will not be visible in the legend
      * @param graphIndex  the series index for the current line, this should be incrementally increased 
      * each time this function is call so that the new dataset does not replace the old one
      * @return the XYPlot with the added TimeSeries
      */
-    public XYPlot graphTimeData(XYPlot plot, 
-                                TimeSeries currentLine, 
-                                boolean lineTrue, 
-                                Color seriesColor, 
-                                boolean dashedLine,
-                                boolean shortDash,
-                                boolean thickLine,
-                                boolean visibleInLegend,
-                                int graphIndex){
+    public XYPlot addTimeseriesData(XYPlot plot, 
+                                    TimeSeries currentLine, 
+                                    boolean lineTrue, 
+                                    Color seriesColor, 
+                                    boolean dashedLine_TF,
+                                    boolean shortDash_TF,
+                                    boolean thickLine_TF,
+                                    boolean visibleInLegend_TF,
+                                    int graphIndex){        
         //Create Line Data and renderer
         TimeSeriesCollection currentDataset = new TimeSeriesCollection(currentLine);
 
@@ -354,34 +275,29 @@
 
         XYItemRenderer currentRenderer = new XYLineAndShapeRenderer(lineTrue, !lineTrue);
         currentRenderer.setSeriesPaint(0, seriesColor);
-        currentRenderer.setSeriesVisibleInLegend(0, visibleInLegend);
-
+        currentRenderer.setSeriesVisibleInLegend(0, visibleInLegend_TF);
+        
         //Check if this series should have a dashed line, if so change the renderer
-        if(dashedLine){
-            if(shortDash){
-                //Change the renderer's stroke to a short dashed line
-                currentRenderer.setSeriesStroke(0, 
-                    new BasicStroke(
-                        1.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND,
-                        1.0f, new float[] {1.0f, 2.0f}, 0.0f
-                ));
-            }else{
-                //Change the renderer's stroke to a long dashed line
-                currentRenderer.setSeriesStroke(0, 
-                    new BasicStroke(
-                        1.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND,
-                        1.0f, new float[] {6.0f, 6.0f}, 0.0f
-                    ));
-            }
+        if(dashedLine_TF && shortDash_TF){
+            //Change the renderer's stroke to a short dashed line
+            currentRenderer.setSeriesStroke(0, new BasicStroke(
+                1.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND,
+                1.0f, new float[] {1.0f, 2.0f}, 0.0f)
+            );
+        }else if(dashedLine_TF){
+            //Change the renderer's stroke to a long dashed line
+            currentRenderer.setSeriesStroke(0, new BasicStroke(
+                1.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND,
+                1.0f, new float[] {6.0f, 6.0f}, 0.0f)
+            );
         }
         
         //Check if the series should have a thicker line
-        if(thickLine){
-            currentRenderer.setSeriesStroke(0, 
-                new BasicStroke(
-                    3.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND,
-                    1.0f, new float[] {6.0f, 0.0f}, 0.0f
-                ));
+        if(thickLine_TF){
+            currentRenderer.setSeriesStroke(0, new BasicStroke(
+                3.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND,
+                1.0f, new float[] {6.0f, 0.0f}, 0.0f)
+            );
         }
         
         //Put the line data, renderer, and axis into plot

src/java/cfa/gui15minTimeseries_Model.java

@@ -24,7 +24,7 @@
 import org.jfree.data.time.TimeSeries;
 
 /**
-* Last Updated: 21-January-2015
+* Last Updated: 9-November-2015
 * @author Tyler Wible
 * @since 23-June-2014
 */
@@ -309,11 +309,11 @@
         
         //Create user data points
         if(sortedData_user.length != 0){//only show user points if it is not zero
-            plotTime = graphing.graphTimeData(plotTime, series, true, Color.blue, false, false, false, true, 0);
-            plotTime = graphing.graphTimeData(plotTime, series2, true, Color.darkGray, false, false, false, true, 1);
+            plotTime = graphing.addTimeseriesData(plotTime, series, true, Color.blue, false, false, false, true, 0);
+            plotTime = graphing.addTimeseriesData(plotTime, series2, true, Color.darkGray, false, false, false, true, 1);
             showLegend = true;
         }else{
-            plotTime = graphing.graphTimeData(plotTime, series, true, Color.blue, false, false, false, true, 0);
+            plotTime = graphing.addTimeseriesData(plotTime, series, true, Color.blue, false, false, false, true, 0);
         }
         
 //        //Create period analysis average lines

src/java/cfa/guiBaseflow_Model.java

@@ -26,7 +26,7 @@
 import org.jfree.data.time.TimeSeries;
 
 /**
- * Last Updated: 23-March-2015
+ * Last Updated: 9-November-2015
  * @author Tyler Wible
  * @since 15-June-2012
  */
@@ -365,22 +365,22 @@
         XYPlot plotTime = new XYPlot();
 
         if(sortedData_user.length != 0){//only show user points if it is not zero
-            plotTime = graphing.graphTimeData(plotTime, streamflow_series, true, Color.lightGray, false, false, false, true, 7);
-            plotTime = graphing.graphTimeData(plotTime, baseflow1_series, true, Color.gray, true, true, false, true, 6);
-            plotTime = graphing.graphTimeData(plotTime, baseflow2_series, true, Color.darkGray, false, false, false, true, 5);
-            plotTime = graphing.graphTimeData(plotTime, baseflow3_series, true, Color.black, true, true, false, true, 4);
+            plotTime = graphing.addTimeseriesData(plotTime, streamflow_series, true, Color.lightGray, false, false, false, true, 7);
+            plotTime = graphing.addTimeseriesData(plotTime, baseflow1_series, true, Color.gray, true, true, false, true, 6);
+            plotTime = graphing.addTimeseriesData(plotTime, baseflow2_series, true, Color.darkGray, false, false, false, true, 5);
+            plotTime = graphing.addTimeseriesData(plotTime, baseflow3_series, true, Color.black, true, true, false, true, 4);
             
             //Create user data points
-            plotTime = graphing.graphTimeData(plotTime, streamflow_series_user, false, Color.lightGray, false, false, false, true, 3);
-            plotTime = graphing.graphTimeData(plotTime, baseflow1_series_user, false, Color.gray, false, false, false, true, 2);
-            plotTime = graphing.graphTimeData(plotTime, baseflow2_series_user, false, Color.darkGray, false, false, false, true, 1);
-            plotTime = graphing.graphTimeData(plotTime, baseflow3_series_user, false, Color.black, false, false, false, true, 0);
+            plotTime = graphing.addTimeseriesData(plotTime, streamflow_series_user, false, Color.lightGray, false, false, false, true, 3);
+            plotTime = graphing.addTimeseriesData(plotTime, baseflow1_series_user, false, Color.gray, false, false, false, true, 2);
+            plotTime = graphing.addTimeseriesData(plotTime, baseflow2_series_user, false, Color.darkGray, false, false, false, true, 1);
+            plotTime = graphing.addTimeseriesData(plotTime, baseflow3_series_user, false, Color.black, false, false, false, true, 0);
         }else{
             //Create data points
-            plotTime = graphing.graphTimeData(plotTime, streamflow_series, true, Color.lightGray, false, false, false, true, 3);
-            plotTime = graphing.graphTimeData(plotTime, baseflow1_series, true, Color.gray, true, true, false, true, 2);
-            plotTime = graphing.graphTimeData(plotTime, baseflow2_series, true, Color.darkGray, false, false, false, true, 1);
-            plotTime = graphing.graphTimeData(plotTime, baseflow3_series, true, Color.black, true, true, false, true, 0);
+            plotTime = graphing.addTimeseriesData(plotTime, streamflow_series, true, Color.lightGray, false, false, false, true, 3);
+            plotTime = graphing.addTimeseriesData(plotTime, baseflow1_series, true, Color.gray, true, true, false, true, 2);
+            plotTime = graphing.addTimeseriesData(plotTime, baseflow2_series, true, Color.darkGray, false, false, false, true, 1);
+            plotTime = graphing.addTimeseriesData(plotTime, baseflow3_series, true, Color.black, true, true, false, true, 0);
         }
         
         //Define Y Axis
@@ -820,9 +820,9 @@
 
         //Graph the baseflow on a timeseries axis
         XYPlot plotTime = new XYPlot();
-        plotTime = graphing.graphTimeData(plotTime, totalFlow_series, true, Color.black, false, false, false, true, 2);
+        plotTime = graphing.addTimeseriesData(plotTime, totalFlow_series, true, Color.black, false, false, false, true, 2);
 //      plotTime = graphTimeData(plotTime, streamflow_series, true, Color.lightGray, false, false, true, 1);
-        plotTime = graphing.graphTimeData(plotTime, baseflow_series, true, Color.gray, false, false, false, true, 0);
+        plotTime = graphing.addTimeseriesData(plotTime, baseflow_series, true, Color.gray, false, false, false, true, 0);
 
         //Define Y Axis
         ValueAxis rangeTime = new NumberAxis("Flow [cfs]");

src/java/cfa/guiDC_Model.java

@@ -26,7 +26,7 @@
 import org.jfree.data.xy.XYSeriesCollection;
 
 /**
-* Last Updated: 24-February-2015
+* Last Updated: 9-November-2015
 * @author Tyler Wible
 * @since 12-June-2011
 */
@@ -527,7 +527,7 @@
             //Get current year's data and graph it
             String[][] partialData = doubleArray.getYearsData(sortedData_combined, currentYear);
             double[][] partialRanks = doubleArray.weibullPlottingPosition(partialData);
-            graphing.graphSeries(plot, partialRanks, Color.lightGray, seriesIndex);
+            graphing.addXYSeries(plot, partialRanks, Color.lightGray, seriesIndex);
             seriesIndex++;
             
             //Save results for output for JHighCharts
@@ -1267,7 +1267,7 @@
             for(int i=0; i<partialRanks.length; i++){
                 partialRanks[i][1] = partialRanks[i][1] * conversion * wqTarget;
             }
-            graphing.graphSeries(plot, partialRanks, Color.lightGray, seriesIndex);
+            graphing.addXYSeries(plot, partialRanks, Color.lightGray, seriesIndex);
             seriesIndex++;
             
             //Save results for output for JHighCharts

src/java/cfa/guiDrought_Model.java

@@ -44,7 +44,7 @@
 import org.jfree.ui.TextAnchor;
 
 /**
-* Last Updated: 24-March-2015
+* Last Updated: 9-November-2015
 * @author Tyler Wible
 * @since 10-July-2012
 */
@@ -556,8 +556,8 @@
 
         //Graph data
         XYPlot plotTime = new XYPlot();
-        plotTime = graphing.graphTimeData(plotTime, series, true, Color.blue, false, false, false, true, 0);
-        plotTime = graphing.graphTimeData(plotTime, averageSeries, true, Color.black, false, false, true, true, 1);
+        plotTime = graphing.addTimeseriesData(plotTime, series, true, Color.blue, false, false, false, true, 0);
+        plotTime = graphing.addTimeseriesData(plotTime, averageSeries, true, Color.black, false, false, true, true, 1);
 
         //Create Y axis
         ValueAxis rangeTime = new NumberAxis("Annual Flow Rate [acre-ft]");

src/java/cfa/guiFlood_Model.java

@@ -11,7 +11,7 @@
 import org.apache.commons.math.ArgumentOutsideDomainException;
 
 /**
-* Last Updated: 23-January-2015
+* Last Updated: 9-November-2015
 * @author Tyler Wible
 * @since 13-June-2012
 */
@@ -139,7 +139,6 @@
                 }
             }
             print_line.printf("%s" + "\r\n", currentLine);//Separate the rows with $$ to make substrings easier later in the interface
-            System.out.println(currentLine);
         }
         print_line.close();
         writer.close();

src/java/cfa/guiStageDischarge_Model.java

@@ -15,7 +15,7 @@
 import org.jfree.chart.plot.XYPlot;
 
 /**
-* Last Updated: 15-September-2014
+* Last Updated: 9-November-2015
 * @author Tyler Wible
 * @since 24-June-2014
 */
@@ -64,7 +64,7 @@
         //Graph ratingCurveData
         Graphing graphing = new Graphing();
         XYPlot plot = new XYPlot();
-        graphing.graphSeries(plot, ratingCurveData, Color.darkGray, 0);
+        graphing.addXYSeries(plot, ratingCurveData, Color.darkGray, 0);
         
         //Create Y Axis
         ValueAxis rangeAxis = new NumberAxis("Stage [ft]");

src/java/cfa/guiTimeseries_Model.java

@@ -40,7 +40,7 @@
 import org.jfree.data.xy.XYSeriesCollection;
 
 /**
-* Last Updated: 29-May-2015
+* Last Updated: 9-November-2015
 * @author Tyler Wible
 * @since 24-June-2011
 */
@@ -713,16 +713,16 @@
         Graphing graphing = new Graphing();
         XYPlot plotTime = new XYPlot();
         boolean showLegend = false;
-        TimeSeries series = createTimeSeriesFromData(sortedData, stationID + ": Data");
-        TimeSeries series2 = createTimeSeriesFromData(sortedData_user, stationID + ": User Data");
+        TimeSeries series = createTimeSeriesFromData(sortedData, stationID + ": Data", timeStep);
+        TimeSeries series2 = createTimeSeriesFromData(sortedData_user, stationID + ": User Data", timeStep);
         
         //Create user data points
         if(sortedData_user.length != 0){//only show user points if it is not zero
-            plotTime = graphing.graphTimeData(plotTime, series, showLine, color, false, false, false, true, 0);
-            plotTime = graphing.graphTimeData(plotTime, series2, showLine, color2, false, false, false, true, 1);
+            plotTime = graphing.addTimeseriesData(plotTime, series, showLine, color, false, false, false, true, 0);
+            plotTime = graphing.addTimeseriesData(plotTime, series2, showLine, color2, false, false, false, true, 1);
             showLegend = true;
         }else{
-            plotTime = graphing.graphTimeData(plotTime, series, showLine, color, false, false, false, true, 0);
+            plotTime = graphing.addTimeseriesData(plotTime, series, showLine, color, false, false, false, true, 0);
         }
         
         //Create period analysis average lines
@@ -760,7 +760,7 @@
                 periodSeries.add(date, value);
             }
             
-            plotTime = graphing.graphTimeData(plotTime, periodSeries, true, Color.red, false, false, true, true, 2);
+            plotTime = graphing.addTimeseriesData(plotTime, periodSeries, true, Color.red, false, false, true, true, 2);
             showLegend = true;
         }
         if(period2Data.length > 0){
@@ -797,7 +797,7 @@
                 periodSeries.add(date, value);
             }
             
-            plotTime = graphing.graphTimeData(plotTime, periodSeries, true, new Color(255, 135, 0), false, false, true, true, 3);//gold
+            plotTime = graphing.addTimeseriesData(plotTime, periodSeries, true, new Color(255, 135, 0), false, false, true, true, 3);//gold
             showLegend = true;
         }
         if(period3Data.length > 0){
@@ -834,7 +834,7 @@
                 periodSeries.add(date, value);
             }
             
-            plotTime = graphing.graphTimeData(plotTime, periodSeries, true, Color.green, false, false, true, true, 4);
+            plotTime = graphing.addTimeseriesData(plotTime, periodSeries, true, Color.green, false, false, true, true, 4);
             showLegend = true;
         }
       
@@ -879,7 +879,7 @@
      * @param title  the title of the TimeSeries to appear in the legend
      * @return a JFreeChart TimeSeries
      */
-    private TimeSeries createTimeSeriesFromData(String[][] data, String title){
+    private TimeSeries createTimeSeriesFromData(String[][] data, String title, String timeStep){
         //Create TimeSeries graph of merged data
         TimeSeries series = new TimeSeries(title);
         for(int i=0; i < data.length; i++) {
@@ -1275,7 +1275,8 @@
      * @param yAxisTitle  the String label for the y axis of the graph
      */
     private void createTimeseriesEnvelopeGraph(String[][] sortedData,
-                                               String yAxisTitle) throws IOException {
+                                               String yAxisTitle,
+                                               boolean logYaxis_TF) throws IOException {
         DoubleArray doubleArray = new DoubleArray();
         DoubleMath doubleMath = new DoubleMath();
         Graphing graphing = new Graphing();
@@ -1292,7 +1293,7 @@
         XYPlot plot = new XYPlot();
         String longTermSeriesName = "Average";
         if(medianTF) longTermSeriesName = "Median";
-        TimeSeries timeSeries = new TimeSeries(longTermSeriesName);
+        TimeSeries average_TS = new TimeSeries(longTermSeriesName);
         for(int j=1; j<=366; j++){
             ArrayList<Double> dateData = new ArrayList<Double>();
             dayList[j-1] = String.valueOf(j);
@@ -1311,52 +1312,23 @@
                 }
             }
             //Calculate average/median
-            double dayValue = 0;
+            double dayValue = doubleMath.meanArithmetic(dateData);
             if(medianTF){
                 dayValue = doubleMath.median(dateData);
-            }else{
-                dayValue = doubleMath.meanArithmetic(dateData);
             }
             
-            //Save the results for this day of the year
-            if(leapYearTF){
-                Calendar currentDate = new GregorianCalendar(2000, 0, 1);
-                currentDate.set(Calendar.DAY_OF_YEAR, j);
-                Day graphDay = new Day(currentDate.get(Calendar.DAY_OF_MONTH), currentDate.get(Calendar.MONTH) + 1, Integer.parseInt(finalYear));
-                timeSeries.add(graphDay, dayValue);
-                graphData[j-1][0] = String.valueOf(j);
-                graphData[j-1][1] = String.valueOf(dayValue);
-            }else{
-                if(j !=366){
-                    Calendar currentDate = new GregorianCalendar(2001, 0, 1);
-                    currentDate.set(Calendar.DAY_OF_YEAR, j);
-                    Day graphDay = new Day(currentDate.get(Calendar.DAY_OF_MONTH), currentDate.get(Calendar.MONTH) + 1, Integer.parseInt(finalYear));
-                    timeSeries.add(graphDay, dayValue);
-                    graphData[j-1][0] = String.valueOf(j);
-                    graphData[j-1][1] = String.valueOf(dayValue);
-                }
-            }
+            Calendar currentDate = new GregorianCalendar(2000, 0, 1);
+            currentDate.set(Calendar.DAY_OF_YEAR, j);
+            Day graphDay = new Day(currentDate.get(Calendar.DAY_OF_MONTH), currentDate.get(Calendar.MONTH) + 1, 2000);
+            average_TS.add(graphDay, dayValue);
+            graphData[j-1][0] = String.valueOf(j);
+            graphData[j-1][1] = String.valueOf(dayValue);
         }
         
         //Create renderer, and axis for timeseries graph
-        TimeSeriesCollection currentDataset = new TimeSeriesCollection(timeSeries);
-        XYItemRenderer renderer = new XYLineAndShapeRenderer(true, false);
-        renderer.setSeriesPaint(seriesIndex, Color.black);
-        renderer.setSeriesStroke(seriesIndex, 
-                new BasicStroke(
-                    3.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND,
-                    1.0f, new float[] {6.0f, 0.0f}, 0.0f
-                ));
-        
-        //Set the line data, renderer, and axis into plot
-        plot.setDataset(seriesIndex, currentDataset);
-        plot.setRenderer(seriesIndex, renderer);
+        graphing.addTimeseriesData(plot, average_TS, true, Color.gray, false, false, true, true, seriesIndex);
         seriesIndex++;
         seriesIndex++;//Increase series so the most recent month can be plotted second
-
-        //Map the line to the first Domain and first Range
-        plot.mapDatasetToDomainAxis(0, 0);
-        plot.mapDatasetToRangeAxis(0, 0);
         
         //Graph a line for each year of monthly data in time period
         boolean moreYears = sortedData.length > 0;
@@ -1365,9 +1337,10 @@
             String[][] partialData = doubleArray.getYearsData(sortedData, currentYear);
             for(int i=0; i<partialData.length; i++){
                 String month_day = partialData[i][0].substring(5);
-                partialData[i][0] = finalYear + "-" + month_day;
+                partialData[i][0] = "2000-" + month_day;
             }
-            graphing.graphSeries(plot, partialData, "daily", "", Color.lightGray, seriesIndex, false, leapYearTF);
+            TimeSeries currentYear_TS = createTimeSeriesFromData(partialData, "temp", "daily");
+            graphing.addTimeseriesData(plot, currentYear_TS, true, Color.lightGray, false, false, false, false, seriesIndex);
             seriesIndex++;
             
             //Save results for output for JHighCharts
@@ -1400,7 +1373,8 @@
                 currentYear = String.valueOf(nextYear);
             }else{
                 //Re-add the most recent year to the graph so it renders on top
-                graphing.graphSeries(plot, partialData, "daily", finalYear, Color.red, 1, true, leapYearTF);
+                TimeSeries finalYear_TS = createTimeSeriesFromData(partialData, finalYear, "daily");
+                graphing.addTimeseriesData(plot, finalYear_TS, true, Color.red, false, false, true, true, 1);
                 moreYears = false;
             }
         }
@@ -1409,10 +1383,14 @@
         doubleArray.writeXYseries(mainFolder, graphData, getTimeseriesEnvelopeOutput().getName());
         
         //Create Y Axis
-//        ValueAxis rangeAxis = new NumberAxis(yAxisTitle);
-        LogarithmicAxis rangeAxis = new LogarithmicAxis("Discharge [cfs]");
-        rangeAxis.setAllowNegativesFlag(true); 
-        plot.setRangeAxis(0, rangeAxis);
+        if(logYaxis_TF){
+            LogarithmicAxis rangeAxis = new LogarithmicAxis(yAxisTitle);
+            rangeAxis.setAllowNegativesFlag(true); 
+            plot.setRangeAxis(0, rangeAxis);
+        }else{
+            ValueAxis rangeAxis = new NumberAxis(yAxisTitle);
+            plot.setRangeAxis(0, rangeAxis);
+        }
         
         //Create X Axis
         DateAxis domainTime = new DateAxis("Date");
@@ -1645,7 +1623,7 @@
                 currentYearData[i][0] = Double.parseDouble(partialData[i][0].substring(5));//month
                 currentYearData[i][1] = Double.parseDouble(partialData[i][1]);//value
             }
-            graphing.graphSeries(plot, currentYearData, Color.lightGray, seriesIndex);
+            graphing.addXYSeries(plot, currentYearData, Color.lightGray, seriesIndex);
             seriesIndex++;
             
             //Save results for output for JHighCharts
@@ -2020,7 +1998,7 @@
         
         //Perform operations on daily data before it is converted to the user desired timeStep
         createTimeseriesMonthlyGraph(sortedData_combined, period1Data, period2Data, period3Data, monthlyYaxisTitle);
-        //createTimeseriesEnvelopeGraph(sortedData_combined, yAxisTitle);
+        //createTimeseriesEnvelopeGraph(sortedData_combined, yAxisTitle, true);
         
         FlowStatistics flowStats = new FlowStatistics();
         if(wqTest.equalsIgnoreCase("flow")){