Skip to content

Commit

Permalink
Merge pull request #364 from NOAA-OWP/issue360
Browse files Browse the repository at this point in the history
Assert a time system/zone of UTC for the date axes of time-series plo…
  • Loading branch information
james-d-brown authored Nov 21, 2024
2 parents 2425591 + 1a0702e commit e85bfa5
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions wres-vis/src/wres/vis/charts/ChartFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import java.util.Set;
import java.util.SortedSet;
import java.util.StringJoiner;
import java.util.TimeZone;
import java.util.TreeSet;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.ConcurrentSkipListMap;
Expand Down Expand Up @@ -380,8 +381,8 @@ public Map<Object, JFreeChart> getDiagramCharts( List<DiagramStatisticOuter> sta
// The reliability diagram is a special case, combining two plots
if ( metricName == MetricConstants.RELIABILITY_DIAGRAM )
{
// Do NOT set the chart theme for the combined plot because it returns the series renderer to default.
// This is probably a bug in JFreeChart, since the behavior is not seen for other chart types. Instead,
// Do NOT set the chart theme for the combined plot because it returns the series renderer to default.
// This is probably a bug in JFreeChart, since the behavior is not seen for other chart types. Instead,
// set the chart theme components manually for the reliability diagram
chart = this.getReliabilityDiagram( title,
slicedStatistics,
Expand Down Expand Up @@ -478,7 +479,7 @@ else if ( metricName == MetricConstants.HISTOGRAM )
/**
* Creates a chart for one diagram that plots timing error statistics.
*
* @param statistics the metric output to plot
* @param statistics the metric output to plot
* @param durationUnits the duration units
* @return a {@link JFreeChart} instance
* @throws NullPointerException if any input is null
Expand Down Expand Up @@ -546,7 +547,10 @@ public JFreeChart getDurationDiagramChart( List<DurationDiagramStatisticOuter> s
// Set the date/time format
DateAxis dateAxis = ( DateAxis ) chart.getXYPlot()
.getDomainAxis();
dateAxis.setDateFormatOverride( new SimpleDateFormat( "yyyy-MM-dd+HH" ) );
TimeZone timeZone = TimeZone.getTimeZone( "UTC" );
SimpleDateFormat format = new SimpleDateFormat( "yyyy-MM-dd+HH" );
format.setTimeZone( timeZone );
dateAxis.setDateFormatOverride( format );

XYPlot plot = chart.getXYPlot();

Expand Down Expand Up @@ -648,7 +652,7 @@ public JFreeChart getBoxplotChart( List<BoxplotStatisticOuter> statistics,
false,
false );

// To quote the documentation, this setting "usually" improve the appearance of charts. However, experimentation
// To quote the documentation, this setting "usually" improve the appearance of charts. However, experimentation
// indicates that it reduces the quality of the box plots
chart.setAntiAlias( false );

Expand Down Expand Up @@ -839,7 +843,7 @@ private JFreeChart getBoxplotChartPerPool( List<BoxplotStatisticOuter> statistic
false,
false );

// To quote the documentation, this setting "usually" improve the appearance of charts. However, experimentation
// To quote the documentation, this setting "usually" improve the appearance of charts. However, experimentation
// indicates that it reduces the quality of the box plots
chart.setAntiAlias( false );

Expand All @@ -859,7 +863,7 @@ private JFreeChart getBoxplotChartPerPool( List<BoxplotStatisticOuter> statistic
* Creates a chart for one score component.
*
* @param metricName the metric name
* @param statistics the metric output to plot
* @param statistics the metric output to plot
* @param graphicShape the shape of the graphic to plot
* @param durationUnits the duration units
* @return a {@link JFreeChart} instance
Expand Down Expand Up @@ -990,7 +994,10 @@ else if ( chartType == ChartType.POOLING_WINDOW )
// Set the date/time format
DateAxis dateAxis = ( DateAxis ) chart.getXYPlot()
.getDomainAxis();
dateAxis.setDateFormatOverride( new SimpleDateFormat( "yyyy-MM-dd+HH" ) );
TimeZone timeZone = TimeZone.getTimeZone( "UTC" );
SimpleDateFormat format = new SimpleDateFormat( "yyyy-MM-dd+HH" );
format.setTimeZone( timeZone );
dateAxis.setDateFormatOverride( format );
}
else
{
Expand Down Expand Up @@ -2602,4 +2609,4 @@ private record ChartTitleParameters( PoolMetadata metadata,
Objects.requireNonNull( statisticType );
}
}
}
}

0 comments on commit e85bfa5

Please sign in to comment.