Changeset 477b694


Ignore:
Timestamp:
May 25, 2010, 2:14:08 PM (10 years ago)
Author:
Michael Seifert <mseifert@…>
Branches:
master
Children:
89e7936
Parents:
79c0d2f
Message:

Updated to new version of GRAL;

Beautified APMChart

Location:
src/main/java/de/erichseifert/warp/gui
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/main/java/de/erichseifert/warp/gui/APMChart.java

    r79c0d2f r477b694  
    2323
    2424import java.awt.BorderLayout;
     25import java.awt.Color;
    2526import java.awt.Dimension;
     27import java.awt.GradientPaint;
     28import java.awt.Paint;
     29import java.awt.geom.Point2D;
    2630import java.util.List;
    2731
     
    4347import de.erichseifert.gral.data.statistics.Histogram;
    4448import de.erichseifert.gral.plots.XYPlot;
     49import de.erichseifert.gral.plots.areas.AreaRenderer2D;
     50import de.erichseifert.gral.plots.areas.DefaultAreaRenderer2D;
    4551import de.erichseifert.gral.plots.axes.Axis;
    4652import de.erichseifert.gral.plots.axes.AxisRenderer2D;
     
    5864        public APMChart(Player... players) {
    5965                super(new BorderLayout());
    60 
    6166
    6267                DataSeries[] playerData = new DataSeries[players.length];
     
    111116                XYPlot plot = new XYPlot(playerData);
    112117                // Configure plot
    113                 plot.setSetting(XYPlot.KEY_TITLE, "Actions per minute (Smoothed)");
     118                plot.setSetting(XYPlot.TITLE, "Actions per minute (Smoothed)");
    114119                plot.setInsets(new Insets2D.Double(20.0, 60.0, 80.0, 40.0));
    115120                // Configure legend
    116                 plot.setSetting(XYPlot.KEY_LEGEND, true);
    117                 plot.setSetting(XYPlot.KEY_LEGEND_LOCATION, Location.NORTH_EAST);
    118                 plot.setSetting(XYPlot.KEY_LEGEND_MARGIN, new Insets2D.Double(10.0));
     121                plot.setSetting(XYPlot.LEGEND, true);
     122                plot.setSetting(XYPlot.LEGEND_LOCATION, Location.NORTH_EAST);
     123                plot.setSetting(XYPlot.LEGEND_MARGIN, new Insets2D.Double(10.0));
    119124                plot.getLegend().setInsets(new Insets2D.Double(5.0));
    120                 plot.getLegend().setSetting(Legend.KEY_ORIENTATION, DrawableConstants.Orientation.HORIZONTAL);
    121                 // Configure line and shape renderers
     125                plot.getLegend().setSetting(Legend.ORIENTATION, DrawableConstants.Orientation.HORIZONTAL);
     126                // Configure line, shape, and area renderers
    122127                for (int playerIndex = 0; playerIndex < players.length; playerIndex++) {
    123128                        DataSeries playerSeries = playerData[playerIndex];
     129                        Color playerColor = players[playerIndex].getColor();
    124130                        plot.setPointRenderer(playerSeries, null);
    125131                        LineRenderer2D lineRenderer = new DefaultLineRenderer2D();
    126                         lineRenderer.setSetting(LineRenderer2D.KEY_COLOR, players[playerIndex].getColor());
     132                        lineRenderer.setSetting(LineRenderer2D.COLOR, playerColor);
    127133                        plot.setLineRenderer(playerSeries, lineRenderer);
     134                        AreaRenderer2D areaRenderer = new DefaultAreaRenderer2D();
     135                        Paint areaPaint = new GradientPaint(
     136                                        new Point2D.Float(0f, 0f), new Color(playerColor.getRed(), playerColor.getGreen(), playerColor.getBlue(), 200),
     137                                        new Point2D.Float(0f, 1f), new Color(playerColor.getRed(), playerColor.getGreen(), playerColor.getBlue(), 31));
     138                        areaRenderer.setSetting(AreaRenderer2D.COLOR, areaPaint);
     139                        plot.setAreaRenderer(playerSeries, areaRenderer);
    128140                }
    129141                // Configure axes
    130                 AxisRenderer2D axisXRenderer = plot.getSetting(XYPlot.KEY_AXIS_X_RENDERER);
    131                 axisXRenderer.setSetting(AxisRenderer2D.KEY_LABEL, "Time [s]");
    132                 axisXRenderer.setSetting(AxisRenderer2D.KEY_TICKS_SPACING, 30.0);
    133                 axisXRenderer.setSetting(AxisRenderer2D.KEY_TICKS_MINOR_COUNT, 0);
    134                 AxisRenderer2D axisYRenderer = plot.getSetting(XYPlot.KEY_AXIS_Y_RENDERER);
    135                 axisYRenderer.setSetting(AxisRenderer2D.KEY_LABEL, "APM");
    136                 axisYRenderer.setSetting(AxisRenderer2D.KEY_LABEL_DISTANCE, 2.0);
    137                 axisYRenderer.setSetting(AxisRenderer2D.KEY_TICKS_SPACING, 10.0);
    138                 axisYRenderer.setSetting(AxisRenderer2D.KEY_TICKS_MINOR_COUNT, 0);
     142                AxisRenderer2D axisXRenderer = plot.getSetting(XYPlot.AXIS_X_RENDERER);
     143                axisXRenderer.setSetting(AxisRenderer2D.LABEL, "Time [s]");
     144                axisXRenderer.setSetting(AxisRenderer2D.TICKS_SPACING, 30.0);
     145                axisXRenderer.setSetting(AxisRenderer2D.TICKS_MINOR_COUNT, 0);
     146                AxisRenderer2D axisYRenderer = plot.getSetting(XYPlot.AXIS_Y_RENDERER);
     147                axisYRenderer.setSetting(AxisRenderer2D.LABEL, "APM");
     148                axisYRenderer.setSetting(AxisRenderer2D.LABEL_DISTANCE, 2.0);
     149                axisYRenderer.setSetting(AxisRenderer2D.TICKS_SPACING, 10.0);
     150                axisYRenderer.setSetting(AxisRenderer2D.TICKS_MINOR_COUNT, 0);
    139151                Axis axisX = plot.getAxis(Axis.X);
    140152                axisX.setMin(0);
    141153                Axis axisY = plot.getAxis(Axis.Y);
    142154                axisY.setMin(0);
    143                 double maxY = plot.getAxis(Axis.Y).getMax().doubleValue() + 2.0*axisYRenderer.<Double>getSetting(AxisRenderer2D.KEY_TICKS_SPACING);
     155                double maxY = plot.getAxis(Axis.Y).getMax().doubleValue() + 2.0*axisYRenderer.<Double>getSetting(AxisRenderer2D.TICKS_SPACING);
    144156                axisY.setMax(maxY);
    145157
  • src/main/java/de/erichseifert/warp/gui/ReplayParserGUI.java

    r79c0d2f r477b694  
    165165                DefaultComboBoxModel filterModeModel = new DefaultComboBoxModel(FilterMode.values());
    166166                final JComboBox filterMode = new JComboBox(filterModeModel);
     167                filterMode.setEnabled(false);
    167168                filterMode.addActionListener(new ActionListener() {
    168169                        @Override
     
    176177
    177178                final JTextField filterField = new JTextField();
     179                filterField.setEnabled(false);
    178180                filterField.addActionListener(new ActionListener() {
    179181                        @Override
Note: See TracChangeset for help on using the changeset viewer.