Example usage for java.awt Color lightGray

List of usage examples for java.awt Color lightGray

Introduction

In this page you can find the example usage for java.awt Color lightGray.

Prototype

Color lightGray

To view the source code for java.awt Color lightGray.

Click Source Link

Document

The color light gray.

Usage

From source file:edu.ucla.stat.SOCR.chart.demo.HistogramChartDemo7.java

/**
 * Returns the chart./*from w w  w. j  av a  2 s .co  m*/
 * 
 * @param dataset  the dataset.
 *
 * @return The chart.
 */
protected JFreeChart createChart(CategoryDataset dataset) {

    JFreeChart chart = ChartFactory.createBarChart(chartTitle, domainLabel, rangeLabel, dataset,
            PlotOrientation.VERTICAL, false, //!legendPanelOn,
            true, false);
    chart.setBackgroundPaint(Color.white);

    CategoryPlot plot = chart.getCategoryPlot();
    plot.setBackgroundPaint(Color.lightGray);
    plot.setRangeGridlinePaint(Color.white);
    plot.setRangeGridlinesVisible(true);
    plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0));

    ValueAxis rangeAxis = plot.getRangeAxis();

    BarRenderer renderer = (BarRenderer) plot.getRenderer();
    renderer.setDrawBarOutline(false);
    renderer.setLegendItemLabelGenerator(new SOCRCategorySeriesLabelGenerator());

    DecimalFormat labelFormatter = new DecimalFormat("##,###.##");
    labelFormatter.setNegativePrefix("(");
    labelFormatter.setNegativeSuffix(")");
    renderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator("{2}", labelFormatter));
    renderer.setBaseItemLabelsVisible(true);

    //setCategorySummary(dataset);
    return chart;
}

From source file:Client.Gui.BarChart.java

/**
* Creates a sample chart./*  w  w w.jav a  2 s. c  om*/
* 
* @param dataset  the dataset.
* 
* @return The chart.
*/
private JFreeChart createChart(final CategoryDataset dataset) {

    // create the chart...
    final JFreeChart chart = ChartFactory.createBarChart("Distribution of Trainging", // chart title
            "", // domain axis label
            "", // range axis label
            dataset, // data
            PlotOrientation.VERTICAL, // orientation
            true, // include legend
            true, // tooltips?
            false // URLs?
    );

    // set the background color for the chart...
    chart.setBackgroundPaint(Color.white);

    // get a reference to the plot for further customisation...
    final CategoryPlot plot = chart.getCategoryPlot();
    plot.setBackgroundPaint(Color.lightGray);
    plot.setDomainGridlinePaint(Color.white);
    plot.setRangeGridlinePaint(Color.white);

    // set the range axis to display integers only...
    final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());

    // disable bar outlines...
    final BarRenderer renderer = (BarRenderer) plot.getRenderer();
    renderer.setDrawBarOutline(false);

    // set up gradient paints for series...
    final GradientPaint gp0 = new GradientPaint(0.0f, 0.0f, Color.blue, 0.0f, 0.0f, Color.lightGray);
    final GradientPaint gp1 = new GradientPaint(0.0f, 0.0f, Color.green, 0.0f, 0.0f, Color.lightGray);
    final GradientPaint gp2 = new GradientPaint(0.0f, 0.0f, Color.red, 0.0f, 0.0f, Color.lightGray);
    final GradientPaint gp3 = new GradientPaint(0.0f, 0.0f, Color.magenta, 0.0f, 0.0f, Color.lightGray);
    renderer.setSeriesPaint(0, gp0);
    renderer.setSeriesPaint(1, gp1);
    renderer.setSeriesPaint(2, gp2);
    renderer.setSeriesPaint(3, gp3);
    final CategoryAxis domainAxis = plot.getDomainAxis();
    domainAxis.setCategoryLabelPositions(CategoryLabelPositions.createUpRotationLabelPositions(Math.PI / 6.0));

    return chart;

}

From source file:TreeColapse.java

@SuppressWarnings("unchecked")
public TreeColapse() throws IOException {

    // create a simple graph for the demo
    graph = new DelegateForest<Node, Integer>();

    createTree();/*  w w  w  .ja v a2  s.c o m*/

    layout = new TreeLayout<Node, Integer>(graph);
    collapser = new TreeCollapser();

    radialLayout = new RadialTreeLayout<Node, Integer>(graph);
    radialLayout.setSize(new Dimension(600, 600));
    vv = new VisualizationViewer<Node, Integer>(layout, new Dimension(600, 600));
    vv.setBackground(Color.white);
    vv.getRenderContext().setEdgeShapeTransformer(new EdgeShape.Line());
    //vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller<Node>());
    vv.getRenderContext().setVertexLabelTransformer(new Transformer<Node, String>() {
        public String transform(Node e) {
            return (e.getName());
        }
    });

    vv.getRenderContext().setVertexShapeTransformer(new ClusterVertexShapeFunction());
    // add a listener for ToolTips
    vv.setVertexToolTipTransformer(new ToStringLabeller());
    vv.getRenderContext().setArrowFillPaintTransformer(new ConstantTransformer(Color.lightGray));
    rings = new Rings();

    Container content = getContentPane();
    final GraphZoomScrollPane panel = new GraphZoomScrollPane(vv);
    content.add(panel);

    final DefaultModalGraphMouse graphMouse = new DefaultModalGraphMouse();

    vv.setGraphMouse(graphMouse);

    JComboBox modeBox = graphMouse.getModeComboBox();
    modeBox.addItemListener(graphMouse.getModeListener());
    graphMouse.setMode(ModalGraphMouse.Mode.TRANSFORMING);

    final ScalingControl scaler = new CrossoverScalingControl();

    JButton plus = new JButton("+");
    plus.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            scaler.scale(vv, 1.1f, vv.getCenter());
        }
    });
    JButton minus = new JButton("-");
    minus.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            scaler.scale(vv, 1 / 1.1f, vv.getCenter());
        }
    });

    JToggleButton radial = new JToggleButton("Radial");
    radial.addItemListener(new ItemListener() {

        public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED) {
                // layout.setRadial(true);
                vv.setGraphLayout(radialLayout);
                vv.getRenderContext().getMultiLayerTransformer().setToIdentity();
                vv.addPreRenderPaintable(rings);
            } else {
                // layout.setRadial(false);
                vv.setGraphLayout(layout);
                vv.getRenderContext().getMultiLayerTransformer().setToIdentity();
                vv.removePreRenderPaintable(rings);
            }
            vv.repaint();
        }
    });

    JButton collapse = new JButton("Collapse");
    collapse.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            Collection picked = new HashSet(vv.getPickedVertexState().getPicked());
            if (picked.size() == 1) {
                Object root = picked.iterator().next();
                Forest inGraph = (Forest) layout.getGraph();

                try {
                    collapser.collapse(vv.getGraphLayout(), inGraph, root);
                } catch (InstantiationException e1) {
                    // TODO Auto-generated catch block
                    e1.printStackTrace();
                } catch (IllegalAccessException e1) {
                    // TODO Auto-generated catch block
                    e1.printStackTrace();
                }

                vv.getPickedVertexState().clear();
                vv.repaint();
            }
        }
    });

    JButton expand = new JButton("Expand");
    expand.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            Collection picked = vv.getPickedVertexState().getPicked();
            for (Object v : picked) {
                if (v instanceof Forest) {
                    Forest inGraph = (Forest) layout.getGraph();
                    collapser.expand(inGraph, (Forest) v);
                }
                vv.getPickedVertexState().clear();
                vv.repaint();
            }
        }
    });

    JPanel scaleGrid = new JPanel(new GridLayout(1, 0));
    scaleGrid.setBorder(BorderFactory.createTitledBorder("Zoom"));

    JPanel controls = new JPanel();
    scaleGrid.add(plus);
    scaleGrid.add(minus);
    controls.add(radial);
    controls.add(scaleGrid);
    controls.add(modeBox);
    controls.add(collapse);
    controls.add(expand);
    content.add(controls, BorderLayout.SOUTH);
}

From source file:org.jfree.chart.demo.TimeSeriesDemo11.java

/**
 * Creates the demo chart./*from www .  ja va  2s . c  o m*/
 * 
 * @param title  the title.
 * @param dataset  the dataset.
 * 
 * @return The chart.
 */
private JFreeChart createChart(final String title, final XYDataset dataset) {

    final JFreeChart chart = ChartFactory.createTimeSeriesChart(title, "Date", "Price", dataset, true, true,
            false);

    chart.setBackgroundPaint(Color.white);
    final XYPlot plot = chart.getXYPlot();
    plot.setOrientation(PlotOrientation.VERTICAL);
    plot.setBackgroundPaint(Color.lightGray);
    plot.setDomainGridlinePaint(Color.white);
    plot.setRangeGridlinePaint(Color.white);
    //        plot.setAxisOffset(new Spacer(Spacer.ABSOLUTE, 5.0, 5.0, 5.0, 5.0));

    final StandardXYItemRenderer renderer = (StandardXYItemRenderer) plot.getRenderer();
    renderer.setPaint(Color.blue);

    return chart;

}

From source file:ancat.visualizers.VertexTransformers.java

/**
 * Prepares the default colour configuration that is used by the rendering
 * engine/*from  www  .  j  a v a 2 s .c  o  m*/
 */
private void colorConfig() {
    Map<String, String> nodeConfig = _renderConfig.nodeConfiguration();

    if (nodeConfig.containsKey("node:default-color")) {

        try {
            Color c = Color.decode(nodeConfig.get("node:default-color"));

            if (c != null)
                _defaultColor = c;
            else
                _defaultColor = Color.darkGray;
        } catch (NumberFormatException e) {
            _logger.error("Cannot process color value for node object", e);
            _defaultColor = Color.darkGray;
        }
    }

    if (nodeConfig.containsKey("node:default-pcolor")) {

        try {
            Color c = Color.decode(nodeConfig.get("node:default-pcolor"));

            if (c != null)
                _defaultpColor = c;
            else
                _defaultpColor = Color.lightGray;
        } catch (NumberFormatException e) {
            _logger.error("Cannot process color value for node object", e);
            _defaultpColor = Color.darkGray;
        }
    }
}

From source file:edu.ucla.stat.SOCR.chart.demo.BarChartDemo1.java

/**
 * Creates a sample chart.// w  ww . ja v a  2s  . c o  m
 * 
 * @param dataset  the dataset.
 * 
 * @return The chart.
 */
protected JFreeChart createChart(CategoryDataset dataset) {
    domainLabel = "Category";
    rangeLabel = "Value";
    // create the chart...
    JFreeChart chart = ChartFactory.createBarChart(chartTitle, // chart title
            domainLabel, // domain axis label
            rangeLabel, // range axis label
            dataset, // data
            PlotOrientation.VERTICAL, // orientation
            !legendPanelOn, // include legend
            true, // tooltips?
            false // URLs?
    );

    // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART...

    // set the background color for the chart...
    chart.setBackgroundPaint(Color.white);

    // get a reference to the plot for further customisation...
    CategoryPlot plot = chart.getCategoryPlot();
    plot.setBackgroundPaint(Color.lightGray);
    plot.setDomainGridlinePaint(Color.white);
    plot.setDomainGridlinesVisible(true);
    plot.setRangeGridlinePaint(Color.white);

    // set the range axis to display integers only...
    NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());

    // disable bar outlines...
    BarRenderer renderer = (BarRenderer) plot.getRenderer();
    renderer.setDrawBarOutline(false);

    // set up gradient paints for series...
    GradientPaint gp0 = new GradientPaint(0.0f, 0.0f, Color.blue, 0.0f, 0.0f, new Color(0, 0, 64));
    GradientPaint gp1 = new GradientPaint(0.0f, 0.0f, Color.green, 0.0f, 0.0f, new Color(0, 64, 0));
    GradientPaint gp2 = new GradientPaint(0.0f, 0.0f, Color.red, 0.0f, 0.0f, new Color(64, 0, 0));
    renderer.setSeriesPaint(0, gp0);
    renderer.setSeriesPaint(1, gp1);
    renderer.setSeriesPaint(2, gp2);
    renderer.setLegendItemLabelGenerator(new SOCRCategorySeriesLabelGenerator());

    CategoryAxis domainAxis = plot.getDomainAxis();
    domainAxis.setCategoryLabelPositions(CategoryLabelPositions.createUpRotationLabelPositions(Math.PI / 6.0));
    // OPTIONAL CUSTOMISATION COMPLETED.

    /*Summary s = new Summary(dataset);
            
            
            
      LegendTitle legend = new LegendTitle(chart.getPlot());
              
      BlockContainer wrapper = new BlockContainer(new BorderArrangement());
      wrapper.setBorder(new BlockBorder(1.0, 1.0, 1.0, 1.0));
            
    LegendItemSource[] legendSource= legend.getSources();
    LegendItemCollection old_legendItems = legendSource[0].getLegendItems();
    LegendItemCollection new_legendItems = new LegendItemCollection();
            
    int legendCount  = old_legendItems.getItemCount();
    for (int i=0; i<legendCount; i++){
       LegendItem old_legendItem = old_legendItems.get(i);
            
       String legendLabel = old_legendItem.getLabel();
       System.out.println("legendLabel="+old_legendLabel);
       LegendItem new_legendItem = new LegendItem(
                                  old_legendItem.getLabel()+s.getSummary(i),
                                  old_legendItem.getDescription(),
                                  old_legendItem.getToolTipText(),
                                  old_legendItem.getURLText(),
                                  old_legendItem.isShapeVisible(),
                                  old_legendItem.getShape(),
                                  old_legendItem.isShapeFilled(),
                                  old_legendItem.getFillPaint(),
                                  old_legendItem.isShapeOutlineVisible(),
                                  old_legendItem.getOutlinePaint(),
                                  old_legendItem.getOutlineStroke(),
                                  old_legendItem.isLineVisible(),
                                  old_legendItem.getLine(),
                                  old_legendItem.getLineStroke(),
                                  old_legendItem.getlinePaint()
                                  );
       new_legendItems.add(new_legendItem);
       }
              
            
      // *** this is important - you need to add the item container to
      // the wrapper, otherwise the legend items won't be displayed when
      // the wrapper is drawn... ***
      BlockContainer items = legend.getItemContainer();
      items.setPadding(2, 10, 5, 2);
      wrapper.add(items);
      legend.setWrapper(wrapper);
              
      legend.setPosition(RectangleEdge.BOTTOM);
      legend.setHorizontalAlignment(HorizontalAlignment.LEFT);
      chart.addSubtitle(legend);*/

    setCategorySummary(dataset);
    return chart;

}

From source file:fitmon.WorkoutChart.java

/**
 * Creates a sample chart.//w ww  .jav a  2 s.  c  o  m
 * 
 * @param dataset  the dataset.
 * 
 * @return The chart.
 */
public JFreeChart createChart(CategoryDataset dataset) {

    // create the chart...
    JFreeChart chart = ChartFactory.createBarChart("weekly workout", // chart title
            "Date", // domain axis label
            "Performance", // range axis label
            dataset, // data
            PlotOrientation.VERTICAL, // orientation
            true, // include legend
            true, // tooltips?
            false // URLs?
    );

    // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART...

    // set the background color for the chart...
    chart.setBackgroundPaint(Color.white);

    // get a reference to the plot for further customisation...
    CategoryPlot plot = chart.getCategoryPlot();
    plot.setBackgroundPaint(Color.lightGray);
    plot.setDomainGridlinePaint(Color.white);
    plot.setRangeGridlinePaint(Color.white);

    // set the range axis to display integers only...
    NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    rangeAxis.setRange(25, 200);

    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());

    // disable bar outlines...
    BarRenderer renderer = (BarRenderer) plot.getRenderer();
    renderer.setDrawBarOutline(false);

    // set up gradient paints for series...
    GradientPaint gp0 = new GradientPaint(0.0f, 0.0f, Color.ORANGE, 0.0f, 0.0f, Color.lightGray);
    GradientPaint gp1 = new GradientPaint(0.0f, 0.0f, Color.PINK, 0.0f, 0.0f, Color.lightGray);
    GradientPaint gp2 = new GradientPaint(0.0f, 0.0f, Color.red, 0.0f, 0.0f, Color.lightGray);
    renderer.setSeriesPaint(0, gp0);
    renderer.setSeriesPaint(1, gp1);
    renderer.setSeriesPaint(2, gp2);

    CategoryAxis domainAxis = plot.getDomainAxis();
    domainAxis.setCategoryLabelPositions(CategoryLabelPositions.createUpRotationLabelPositions(Math.PI / 6.0));
    // OPTIONAL CUSTOMISATION COMPLETED.

    return chart;

}

From source file:scrum.server.common.BurndownChart.java

private static JFreeChart createSprintBurndownChart(List<BurndownSnapshot> snapshots, Date firstDay,
        Date lastDay, Date originallyLastDay, WeekdaySelector freeDays, int dateMarkTickUnit,
        float widthPerDay) {
    DefaultXYDataset data = createSprintBurndownChartDataset(snapshots, firstDay, lastDay, originallyLastDay,
            freeDays);/* ww w. j  ava2  s.  com*/

    double tick = 1.0;
    double max = BurndownChart.getMaximum(data);

    while (max / tick > 25) {
        tick *= 2;
        if (max / tick <= 25)
            break;
        tick *= 2.5;
        if (max / tick <= 25)
            break;
        tick *= 2;
    }
    double valueLabelTickUnit = tick;
    double upperBoundary = Math.min(max * 1.1f, max + 3);

    if (!Sys.isHeadless())
        LOG.warn("GraphicsEnvironment is not headless");
    JFreeChart chart = ChartFactory.createXYLineChart("", "", "", data, PlotOrientation.VERTICAL, false, true,
            false);

    chart.setBackgroundPaint(Color.WHITE);

    XYPlot plot = chart.getXYPlot();
    // plot.setInsets(new RectangleInsets(0, 0, 0, 0));
    plot.setAxisOffset(RectangleInsets.ZERO_INSETS);
    // plot.setOutlineVisible(false);

    plot.setBackgroundPaint(Color.white);
    plot.setRangeGridlinePaint(Color.lightGray);
    plot.setDomainGridlinePaint(Color.lightGray);
    // plot.setRangeCrosshairPaint(Color.lightGray);
    // plot.setRangeMinorGridlinePaint(Color.lightGray);
    // plot.setDomainCrosshairPaint(Color.blue);
    // plot.setDomainMinorGridlinePaint(Color.green);
    // plot.setDomainTickBandPaint(Color.green);

    XYItemRenderer renderer = plot.getRenderer();
    renderer.setBaseStroke(new BasicStroke(2f));

    renderer.setSeriesPaint(0, COLOR_PAST_LINE);
    renderer.setSeriesStroke(0, new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL));
    renderer.setSeriesPaint(1, COLOR_PROJECTION_LINE);
    renderer.setSeriesStroke(1,
            new BasicStroke(1.5f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL, 1.0f, new float[] { 3f }, 0));
    renderer.setSeriesPaint(2, COLOR_OPTIMUM_LINE);
    renderer.setSeriesStroke(2, new BasicStroke(2f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL));

    DateAxis domainAxis1 = new DateAxis();
    String dateFormat = "d.";
    widthPerDay -= 5;
    if (widthPerDay > 40) {
        dateFormat = "EE " + dateFormat;
    }
    if (widthPerDay > 10) {
        float spaces = widthPerDay / 2.7f;
        dateFormat = Str.multiply(" ", (int) spaces) + dateFormat;
    }
    domainAxis1.setDateFormatOverride(new SimpleDateFormat(dateFormat, Locale.US));
    domainAxis1.setTickUnit(new DateTickUnit(DateTickUnit.DAY, dateMarkTickUnit));
    domainAxis1.setAxisLineVisible(false);
    Range range = new Range(firstDay.toMillis(), lastDay.nextDay().toMillis());
    domainAxis1.setRange(range);

    DateAxis domainAxis2 = new DateAxis();
    domainAxis2.setTickUnit(new DateTickUnit(DateTickUnit.DAY, 1));
    domainAxis2.setTickMarksVisible(false);
    domainAxis2.setTickLabelsVisible(false);
    domainAxis2.setRange(range);

    plot.setDomainAxis(0, domainAxis2);
    plot.setDomainAxis(1, domainAxis1);
    plot.setDomainAxisLocation(1, AxisLocation.BOTTOM_OR_RIGHT);

    NumberAxis rangeAxis = new NumberAxis();
    rangeAxis.setNumberFormatOverride(NumberFormat.getIntegerInstance());
    rangeAxis.setTickUnit(new NumberTickUnit(valueLabelTickUnit));

    rangeAxis.setLowerBound(0);
    rangeAxis.setUpperBound(upperBoundary);

    plot.setRangeAxis(rangeAxis);

    return chart;
}

From source file:Chart.JFreeChartDemo.java

/**
 * Create a chart.//from  w w w.ja v  a 2s.co m
 *
 * @param dataset the dataset
 * @return the chart
 */
private JFreeChart createChart(XYDataset dataset) {

    //       WHAT IS THIS LINE???
    // JFreeChart chart = ChartFactory.createTimeSeriesChart(null, null, null, dataset, rootPaneCheckingEnabled, rootPaneCheckingEnabled, rootPaneCheckingEnabled)

    // create the chart...
    JFreeChart chart = ChartFactory.createXYLineChart("", // chart title
            "Time", // domain axis label
            "Range", // range axis label
            dataset, // initial series
            PlotOrientation.VERTICAL, // orientation
            true, // include legend
            true, // tooltips?
            false // URLs?
    );

    // set chart background
    chart.setBackgroundPaint(Color.white);

    // set a few custom plot features
    XYPlot plot = (XYPlot) chart.getPlot();
    plot.setBackgroundPaint(new Color(0xffffe0));
    plot.setDomainGridlinesVisible(true);
    plot.setDomainGridlinePaint(Color.lightGray);
    plot.setRangeGridlinePaint(Color.lightGray);

    // set the plot's axes to display integers
    TickUnitSource ticks = NumberAxis.createIntegerTickUnits();
    NumberAxis domain = (NumberAxis) plot.getDomainAxis();
    domain.setStandardTickUnits(ticks);
    NumberAxis range = (NumberAxis) plot.getRangeAxis();
    range.setStandardTickUnits(ticks);

    // render shapes and lines
    //        XYLineAndShapeRenderer renderer =
    //                new XYLineAndShapeRenderer(true, true);
    //        plot.setRenderer(renderer);
    //        renderer.setBaseShapesVisible(true);
    //        renderer.setBaseShapesFilled(true);
    //
    //        // set the renderer's stroke
    //        Stroke stroke = new BasicStroke(
    //                3f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL);
    //        
    //        renderer.setBaseOutlineStroke(stroke);
    //       
    //Shape theshape = ShapeUtilities.createDiamond(1);
    //renderer.setSeriesShape(5, theshape);

    // label the points
    //        NumberFormat format = NumberFormat.getNumberInstance();
    //        format.setMaximumFractionDigits(2);
    //        XYItemLabelGenerator generator =
    //                new StandardXYItemLabelGenerator(
    //                StandardXYItemLabelGenerator.DEFAULT_ITEM_LABEL_FORMAT,
    //                format, format);
    //        renderer.setBaseItemLabelGenerator(generator);
    //        renderer.setBaseItemLabelsVisible(true);

    return chart;
}

From source file:edu.cuny.cat.ui.ClockPanel.java

@Override
public void setup(final ParameterDatabase parameters, final Parameter base) {
    clock = GameController.getInstance().getClock();

    dataset = new DefaultValueDataset();

    meterplot = new MyMeterPlot(dataset) {
        /**/*w w w .java  2s  . c  o m*/
         * 
         */
        private static final long serialVersionUID = 1L;

        @Override
        protected void drawValueLabel(final Graphics2D g2, final Rectangle2D area) {
            g2.setFont(getValueFont());
            g2.setPaint(getValuePaint());
            String valueStr = "No value";
            if (dataset != null) {
                final Number n = dataset.getValue();
                if (n != null) {
                    if (n.intValue() == 0) {
                        valueStr = "to start";
                    } else if (n.intValue() == clock.getGameLen() * clock.getDayLen()) {
                        valueStr = "done";
                    } else {
                        valueStr = "day " + (n.intValue() / clock.getDayLen()) + ", round "
                                + (n.intValue() % clock.getDayLen());
                    }
                }
            }
            final float x = (float) area.getCenterX();
            final float y = (float) area.getCenterY() + MeterPlot.DEFAULT_CIRCLE_SIZE;
            TextUtilities.drawAlignedString(valueStr, g2, x, y, TextAnchor.TOP_CENTER);
        }

    };
    meterplot.setRange(new Range(0, clock.getDayLen() * clock.getGameLen()));

    meterplot.setNeedlePaint(
            parameters.getColorWithDefault(base.push(ClockPanel.P_NEEDLE), null, Color.darkGray));

    meterplot.setDialBackgroundPaint(new Color(0, 255, 0, 64));
    meterplot.setDialOutlinePaint(Color.gray);
    meterplot.setDialShape(DialShape.CHORD);

    meterplot.setMeterAngle(parameters.getIntWithDefault(base.push(ClockPanel.P_ANGLE), null, 260));

    meterplot.setTickLabelsVisible(true);
    meterplot.setTickLabelFont(new Font("Dialog", 1, 10));
    meterplot.setTickLabelPaint(Color.darkGray);
    meterplot.setTickSize(clock.getDayLen());
    meterplot.setTickPaint(Color.lightGray);

    meterplot.setValuePaint(Color.black);
    meterplot.setValueFont(new Font("Dialog", 1, 14));
    meterplot.setUnits("");
    meterplot.setTickLabelFormat(new NumberFormat() {

        /**
         * 
         */
        private static final long serialVersionUID = 1L;

        @Override
        public StringBuffer format(final double number, final StringBuffer toAppendTo,
                final FieldPosition pos) {
            return format((long) number, toAppendTo, pos);
        }

        @Override
        public StringBuffer format(final long number, final StringBuffer toAppendTo, final FieldPosition pos) {

            if (number % clock.getDayLen() == 0) {
                toAppendTo.append(String.valueOf(number / clock.getDayLen()));
            }
            return toAppendTo;
        }

        @Override
        public Number parse(final String source, final ParsePosition parsePosition) {
            return null;
        }

    });

    final JFreeChart chart = new JFreeChart("", JFreeChart.DEFAULT_TITLE_FONT, meterplot, false);

    final ChartPanel panel = new ChartPanel(chart);
    panel.setPreferredSize(new Dimension(parameters.getIntWithDefault(base.push(ClockPanel.P_WIDTH), null, 200),
            parameters.getIntWithDefault(base.push(ClockPanel.P_HEIGHT), null, 200)));

    add(panel, BorderLayout.CENTER);

    initIterationLabel();

    initScoreReport();
}