Example usage for java.awt Color magenta

List of usage examples for java.awt Color magenta

Introduction

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

Prototype

Color magenta

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

Click Source Link

Document

The color magenta.

Usage

From source file:DashboardInterface.LaunchGraph.java

/**
* Creates a chart.//  w  w  w  .  j  ava  2  s. co m
*
* @param dataset  a dataset.
*
* @return A chart.
*/
private JFreeChart createChart(XYDataset dataset) {

    JFreeChart chart = ChartFactory.createXYLineChart("Speed, Height and Tension v Time:", // title
            "Time", // x-axis label
            "Speed", // y-axis label
            null, // data
            PlotOrientation.VERTICAL, true, // create legend?
            true, // generate tooltips?
            false // generate URLs?
    );

    chart.setBackgroundPaint(Color.white);

    plot = chart.getXYPlot();
    XYSplineRenderer splinerenderer1 = new XYSplineRenderer();
    XYSplineRenderer splinerenderer2 = new XYSplineRenderer();
    XYSplineRenderer splinerenderer3 = new XYSplineRenderer();

    XYDataset dataset1 = createDataset(0L, 130000);
    plot.setDataset(0, dataset1);
    plot.setRenderer(0, splinerenderer1);
    plot.getRenderer().setSeriesPaint(0, Color.MAGENTA);
    NumberAxis domainAxis = new NumberAxis("Time (Seconds from Start of Launch)");
    plot.setDomainAxis(domainAxis);
    //domainAxis.setRange(0, 30);
    NumberAxis heightYAxis = new NumberAxis("Height");
    heightYAxis.setRange(0, 1050);
    plot.setRangeAxis(heightYAxis);
    datasetMap.put("HEIGHT", dataset1);

    XYDataset dataset2 = createDataset2();
    plot.setDataset(1, dataset2);
    plot.setRenderer(1, splinerenderer2);
    plot.getRenderer().setSeriesPaint(1, Color.BLUE);
    NumberAxis speedYAxis = new NumberAxis("Speed");
    speedYAxis.setRange(0, 50);
    plot.setRangeAxis(1, speedYAxis);
    datasetMap.put("SPEED", dataset2);

    XYDataset dataset3 = createDataset3();
    plot.setDataset(2, dataset3);
    plot.setRenderer(2, splinerenderer3);
    NumberAxis tensionYAxis = new NumberAxis("Tension");
    plot.getRenderer().setSeriesPaint(2, Color.RED);
    tensionYAxis.setRange(0, 8000);
    plot.setRangeAxis(2, tensionYAxis);
    datasetMap.put("TENSION", dataset3);

    plot.mapDatasetToRangeAxis(0, 0);//1st dataset to 1st y-axis
    plot.mapDatasetToRangeAxis(1, 1); //2nd dataset to 2nd y-axis
    plot.mapDatasetToRangeAxis(2, 2);

    //float[] dashArray = {1,1,1,0};
    //plot.addRangeMarker(new ValueMarker(maxTensionMarker, Color.YELLOW, new BasicStroke(1, 0, 0, 1, dashArray, 0)));
    //XYTextAnnotation text = new XYTextAnnotation("Max Tension", 10, maxTensionMarker);
    //text.setFont(new Font("SansSerif", Font.PLAIN, 9));
    //plot.addAnnotation(text);

    XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) plot.getRenderer();
    renderer.setBaseShapesVisible(false);
    renderer.setBaseShapesFilled(false);

    XYLineAndShapeRenderer renderer2 = (XYLineAndShapeRenderer) plot.getRendererForDataset(speedDataset);
    renderer2.setBaseShapesVisible(false);
    renderer2.setBaseShapesFilled(false);

    XYLineAndShapeRenderer renderer3 = (XYLineAndShapeRenderer) plot.getRendererForDataset(tensionDataset);
    renderer3.setBaseShapesVisible(false);
    renderer3.setBaseShapesFilled(false);

    return chart;
}

From source file:org.encog.workbench.tabs.visualize.structure.GenomeStructureTab.java

public GenomeStructureTab(NEATGenome genome) {
    super(null);//from ww w .  j a  va  2  s  .  c om
    this.genome = genome;

    // Graph<V, E> where V is the type of the vertices
    // and E is the type of the edges
    Graph<DrawnNeuron, DrawnConnection> g = null;
    g = buildGraph(genome);

    if (g == null) {
        throw new WorkBenchError("Can't visualize genome");
    }

    Transformer<DrawnNeuron, Point2D> staticTranformer = new Transformer<DrawnNeuron, Point2D>() {

        public Point2D transform(DrawnNeuron n) {
            int x = (int) (n.getX() * 600);
            int y = (int) (n.getY() * 300);

            Point2D result = new Point(x + 32, y);
            return result;
        }
    };

    Transformer<DrawnNeuron, Paint> vertexPaint = new Transformer<DrawnNeuron, Paint>() {
        public Paint transform(DrawnNeuron neuron) {
            switch (neuron.getType()) {
            case Bias:
                return Color.yellow;
            case Input:
                return Color.white;
            case Output:
                return Color.green;
            case Context:
                return Color.cyan;
            case Linear:
                return Color.blue;
            case Sigmoid:
                return Color.magenta;
            case Gaussian:
                return Color.cyan;
            case SIN:
                return Color.gray;
            default:
                return Color.red;
            }
        }

    };

    Transformer<DrawnConnection, Paint> edgePaint = new Transformer<DrawnConnection, Paint>() {
        public Paint transform(DrawnConnection connection) {
            if (connection.isContext()) {
                return Color.lightGray;
            } else {
                return Color.black;
            }
        }
    };

    // The Layout<V, E> is parameterized by the vertex and edge types
    StaticLayout<DrawnNeuron, DrawnConnection> layout = new StaticLayout<DrawnNeuron, DrawnConnection>(g,
            staticTranformer);

    layout.setSize(new Dimension(5000, 5000)); // sets the initial size of
    // the space
    // The BasicVisualizationServer<V,E> is parameterized by the edge types
    // BasicVisualizationServer<DrawnNeuron, DrawnConnection> vv = new
    // BasicVisualizationServer<DrawnNeuron, DrawnConnection>(
    // layout);

    // Dimension d = new Dimension(600,600);

    vv = new VisualizationViewer<DrawnNeuron, DrawnConnection>(layout);

    // vv.setPreferredSize(d); //Sets the viewing area size

    vv.getRenderer().getVertexLabelRenderer().setPosition(Renderer.VertexLabel.Position.CNTR);
    vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller());
    vv.getRenderContext().setVertexFillPaintTransformer(vertexPaint);
    vv.getRenderContext().setEdgeDrawPaintTransformer(edgePaint);
    vv.getRenderContext().setArrowDrawPaintTransformer(edgePaint);
    vv.getRenderContext().setArrowFillPaintTransformer(edgePaint);

    vv.setVertexToolTipTransformer(new ToStringLabeller());

    vv.setVertexToolTipTransformer(new Transformer<DrawnNeuron, String>() {
        public String transform(DrawnNeuron edge) {
            return edge.getToolTip();
        }
    });

    vv.setEdgeToolTipTransformer(new Transformer<DrawnConnection, String>() {
        public String transform(DrawnConnection edge) {
            return edge.getToolTip();
        }
    });

    final GraphZoomScrollPane panel = new GraphZoomScrollPane(vv);
    this.setLayout(new BorderLayout());
    add(panel, BorderLayout.CENTER);
    final AbstractModalGraphMouse graphMouse = new DefaultModalGraphMouse();
    vv.setGraphMouse(graphMouse);

    vv.addKeyListener(graphMouse.getModeKeyListener());

    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());
        }
    });

    JButton reset = new JButton("reset");
    reset.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            vv.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.LAYOUT).setToIdentity();
            vv.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.VIEW).setToIdentity();
        }
    });

    JPanel controls = new JPanel();
    controls.setLayout(new FlowLayout(FlowLayout.LEFT));
    controls.add(plus);
    controls.add(minus);
    controls.add(reset);
    Border border = BorderFactory.createEtchedBorder();
    controls.setBorder(border);
    add(controls, BorderLayout.NORTH);
    add(new LegendPanel(true), BorderLayout.SOUTH);

}

From source file:ch.epfl.lis.gnwgui.jungtransformers.EdgeArrowColorTransformer.java

/**
 * Set if the transformer should distinguish each signed connection by a color.
 * @param yes//  ww  w.  j av a 2 s  .  c o m
 */
public void distinguishConnectionByColor(boolean yes) {
    if (yes) {
        enhancerColor_ = new Color(0, 0, 130); //Color.BLACK;
        inhibitoryColor_ = Color.RED;
        dualColor_ = Color.MAGENTA;
        unknownColor_ = Color.LIGHT_GRAY; //new Color(120,120,120);
    } else {
        enhancerColor_ = Color.BLACK;
        inhibitoryColor_ = Color.BLACK;
        dualColor_ = Color.BLACK;
        unknownColor_ = Color.BLACK;
    }
}

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

/**
 * Creates a sample chart.// ww  w.java  2s  . c  om
 * 
 * @param dataset  the dataset.
 * 
 * @return a sample chart.
 */
protected JFreeChart createChart(CategoryDataset dataset) {

    JFreeChart chart = ChartFactory.createBarChart(chartTitle, // chart title
            domainLabel, // domain axis label
            rangeLabel, // range axis label
            dataset, // data
            PlotOrientation.VERTICAL, // the plot orientation
            !legendPanelOn, // include legend
            true, false);

    chart.setBackgroundPaint(Color.lightGray);

    // get a reference to the plot for further customisation...
    CategoryPlot plot = (CategoryPlot) chart.getPlot();
    plot.setNoDataMessage("NO DATA!");

    CategoryItemRenderer renderer = new CustomBarRenderer(new Paint[] { Color.red, Color.blue, Color.green,
            Color.yellow, Color.orange, Color.cyan, Color.magenta, Color.blue });
    renderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator());
    renderer.setBaseItemLabelsVisible(true);
    ItemLabelPosition p = new ItemLabelPosition(ItemLabelAnchor.CENTER, TextAnchor.CENTER, TextAnchor.CENTER,
            45.0);
    renderer.setBasePositiveItemLabelPosition(p);
    plot.setRenderer(renderer);

    CategoryMarker marker = new CategoryMarker("Category 3");
    marker.setLabel("Special");
    marker.setPaint(new Color(0xDD, 0xFF, 0xDD, 0x80));
    marker.setAlpha(0.5f);
    marker.setLabelAnchor(RectangleAnchor.TOP_LEFT);
    marker.setLabelTextAnchor(TextAnchor.TOP_LEFT);
    marker.setLabelOffsetType(LengthAdjustmentType.CONTRACT);
    plot.addDomainMarker(marker, Layer.BACKGROUND);

    // change the margin at the top of the range axis...
    NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    rangeAxis.setLowerMargin(0.15);
    rangeAxis.setUpperMargin(0.15);

    BarRenderer seriesRenderer = (BarRenderer) plot.getRenderer();
    seriesRenderer.setLegendItemLabelGenerator(new SOCRCategorySeriesLabelGenerator());

    setCategorySummary(dataset);
    return chart;

}

From source file:MyLink.java

public JPanel KSGenerate() {
    // create a simple graph for the demo
    graph = new SparseMultigraph<Integer, MyLink>();

    Integer[] v = createVertices(getTermNum());
    createEdges(v);/*from   w w w . j  av  a 2  s.  c  o  m*/

    vv = new VisualizationViewer<Integer, MyLink>(new KKLayout<Integer, MyLink>(graph));
    //vv.setPreferredSize(new Dimension(540,500));
    vv.setPreferredSize(new Dimension(610, 570)); // 570, 640 | 565, 640 | 565, 570

    vv.getRenderContext().setVertexLabelTransformer(new UnicodeVertexStringer<Integer>(v));
    vv.getRenderContext().setVertexLabelRenderer(new DefaultVertexLabelRenderer(Color.magenta));
    vv.getRenderContext().setEdgeLabelRenderer(new DefaultEdgeLabelRenderer(Color.magenta));
    VertexIconShapeTransformer<Integer> vertexIconShapeFunction = new VertexIconShapeTransformer<Integer>(
            new EllipseVertexShapeTransformer<Integer>());
    DefaultVertexIconTransformer<Integer> vertexIconFunction = new DefaultVertexIconTransformer<Integer>();
    vv.getRenderContext().setVertexShapeTransformer(vertexIconShapeFunction);
    vv.getRenderContext().setVertexIconTransformer(vertexIconFunction);
    loadImages(v, vertexIconFunction.getIconMap());
    vertexIconShapeFunction.setIconMap(vertexIconFunction.getIconMap());
    vv.getRenderContext().setVertexFillPaintTransformer(new PickableVertexPaintTransformer<Integer>(
            vv.getPickedVertexState(), new Color(0, 102, 255), Color.red));
    vv.getRenderContext().setEdgeDrawPaintTransformer(
            new PickableEdgePaintTransformer<MyLink>(vv.getPickedEdgeState(), Color.orange, Color.cyan));
    vv.setBackground(Color.white);

    final int maxSize = findMaxSizeNumber();

    File file = new File("./output/DESC_TERM_COUNT.txt");
    String s;

    try {
        BufferedReader fis = new BufferedReader(new InputStreamReader(new FileInputStream(file)));

        s = fis.readLine();
        userSelectedTermsCount = Integer.parseInt(s);
        termIndex = new int[userSelectedTermsCount];

        int i = 0;
        while ((s = fis.readLine()) != null) {
            String[] tmp = s.split("=");
            termIndex[i] = Integer.parseInt(tmp[1].trim());
            i++;
        }

    } catch (IOException e) {
        System.out.println(e.getMessage());
    }

    Transformer<Integer, Shape> vertexSize = new Transformer<Integer, Shape>() {
        public Shape transform(Integer i) {
            double sizeInt = termIndex[i];
            sizeInt = (double) sizeInt / (double) maxSize;
            sizeInt = (double) sizeInt * (double) 30 + 10;
            Ellipse2D circle = new Ellipse2D.Double(sizeInt / 2 * (-1), sizeInt / 2 * (-1), sizeInt, sizeInt);
            return circle;
        }
    };
    vv.getRenderContext().setVertexShapeTransformer(vertexSize);
    vv.getRenderer().getVertexLabelRenderer().setPosition(Position.N);

    // add my listener for ToolTips
    vv.setVertexToolTipTransformer(new ToStringLabeller<Integer>());

    // create a frome to hold the graph
    APanel = new JPanel();
    APanel.setLayout(new BoxLayout(APanel, BoxLayout.Y_AXIS));

    final GraphZoomScrollPane panel = new GraphZoomScrollPane(vv);

    final ModalGraphMouse gm = new DefaultModalGraphMouse<Integer, Number>();
    vv.setGraphMouse(gm);

    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());
        }
    });

    JCheckBox lo = new JCheckBox("Show Labels");
    lo.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            showLabels = e.getStateChange() == ItemEvent.SELECTED;

            vv.repaint();
        }
    });
    lo.setSelected(true);

    JPanel controls = new JPanel();
    controls.add(plus);
    controls.add(minus);
    controls.add(lo);
    controls.add(((DefaultModalGraphMouse<Integer, Number>) gm).getModeComboBox());
    vv.setBorder(KSMapBorder);
    APanel.add(vv);
    APanel.add(controls);

    return APanel;
}

From source file:com.syncleus.dann.graph.jung.BrainPanel.java

@Override
protected void initVis(VisualizationViewer<N, S> vis) {
    vis.getRenderContext().setVertexLabelTransformer(new NeuronLabeller());
    vis.getRenderContext().setEdgeLabelTransformer(new SynapseLabeller());
    vis.getRenderContext().setVertexFillPaintTransformer(new Transformer<N, Paint>() {

        public Paint transform(N n) {
            if (n instanceof InputNeuron) {
                return Color.MAGENTA;
            } else if (n instanceof OutputNeuron) {
                return Color.GREEN;
            } else {
                return Color.GRAY;
            }/*from  www.ja  v a 2  s  . c o  m*/
        }
    });
    vis.getRenderContext().setVertexShapeTransformer(new Transformer<N, Shape>() {

        public Shape transform(N n) {
            float s = 0.5f;
            if (n instanceof OutputNeuron) {
                OutputNeuron aan = (OutputNeuron) n;
                s = (float) Math.abs(aan.getOutput());
            } else if (n instanceof InputNeuron) {
                InputNeuron aan = (InputNeuron) n;
                s = (float) Math.abs(aan.getInput());
            }
            int w = (int) (s * 44.0);
            int h = (int) (s * 44.0);
            int x = -w / 2;
            int y = -h / 2;
            return new Rectangle2D.Float(x, y, w, h);
        }
    });
    vis.getRenderContext().setEdgeStrokeTransformer(new Transformer<S, Stroke>() {

        public Stroke transform(S i) {
            return new BasicStroke((int) ((Math.abs(i.getWeight())) * 8.0));
        }
    });
    vis.getRenderContext().setEdgeDrawPaintTransformer(new Transformer<S, Paint>() {

        public Paint transform(S syn) {
            float b = (float) Math.abs(syn.getWeight());
            float s = 0.8f;
            float h = syn.getWeight() < 0 ? 0.6f : 0.9f;
            return Color.getHSBColor(h, s, b);
        }
    });

}

From source file:sim.app.sugarscape.Charts.java

JFreeChart createChart4() {
    JFreeChart chart4 = ChartFactory.createHistogram("Wealth Distribution", "Wealth", "Count", model.dataset,
            PlotOrientation.VERTICAL, true, true, false);
    model.chart4 = chart4;//  w  ww .  j ava2s. c  om
    NumberAxis rangeAxis1 = new NumberAxis("Wealth");
    rangeAxis1.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    org.jfree.chart.axis.NumberAxis domainAxis = new NumberAxis("Bins");
    XYPlot plot = chart4.getXYPlot();
    XYItemRenderer renderer1 = plot.getRenderer();
    renderer1.setSeriesPaint(0, Color.MAGENTA);
    return chart4;
}

From source file:de.fub.maps.project.plugins.tasks.eval.OverviewChart.java

private void initRenderer(CategoryItemRenderer renderer) {
    Color[] colors = new Color[] { Color.red, Color.blue, Color.orange, Color.cyan, Color.yellow, Color.magenta,
            Color.green, Color.pink, Color.black, Color.gray };

    if (!this.roadNetworkStatisticsList.isEmpty()) {
        for (int i = 0; i < this.roadNetworkStatisticsList.size(); i++) {
            renderer.setSeriesPaint(i, colors[i % colors.length]);
        }//from  w w w  .j  a  v a2 s  . com
    }
}

From source file:ui.Graph.java

/**
 * Creates a chart./*from  w  ww . j av a 2 s.  c o  m*/
 *
 * @param dataset
 *            the data for the chart.
 *
 * @return a chart.
 */
private JFreeChart createChart(ArrayList<Setpoint> setpoints, ArrayList<Setpoint> traj) {
    trajectory = traj;

    XYSeries posSeries = new XYSeries("Position");
    XYSeries trajSeries = new XYSeries("Trajectory");
    XYSeries velSeries = new XYSeries("Velocity");
    for (int i = 0; i < setpoints.size(); i++) {

        Setpoint p = setpoints.get(i);
        posSeries.add(p.time, p.position);
        velSeries.add(p.time, p.velocity);
    }

    for (int i = 0; i < trajectory.size(); i++) {

        Setpoint p = trajectory.get(i);
        trajSeries.add(p.time, p.position);

    }

    XYSeriesCollection posDataset = new XYSeriesCollection();
    XYSeriesCollection trajDataset = new XYSeriesCollection();
    XYSeriesCollection velDataset = new XYSeriesCollection();

    posDataset.addSeries(posSeries);
    velDataset.addSeries(velSeries);
    trajDataset.addSeries(trajSeries);
    // create the chart...
    final JFreeChart chart = ChartFactory.createScatterPlot("System output", // chart title
            "X", // x axis label
            "Y", // y axis label
            posDataset, // data
            PlotOrientation.VERTICAL, true, // include legend
            true, // tooltips
            false // urls
    );

    // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART...
    chart.setBackgroundPaint(Color.white);

    // final StandardLegend legend = (StandardLegend) chart.getLegend();
    // legend.setDisplaySeriesShapes(true);
    // get a reference to the plot for further customisation...
    final XYPlot plot = chart.getXYPlot();

    plot.setDataset(0, posDataset);
    plot.setDataset(1, trajDataset);
    plot.setDataset(2, velDataset);
    plot.setBackgroundPaint(Color.white);
    // plot.setAxisOffset(new Spacer(Spacer.ABSOLUTE, 5.0, 5.0, 5.0, 5.0));
    plot.setDomainGridlinePaint(Color.lightGray);
    plot.setRangeGridlinePaint(Color.lightGray);

    XYLineAndShapeRenderer posRenderer = new XYLineAndShapeRenderer();
    // renderer.setSeriesShape(0, new Ellipse2D.Float(1.0f, 1.0f, 1.0f,
    // 1.0f));
    posRenderer.setSeriesPaint(0, Color.BLUE);
    posRenderer.setSeriesLinesVisible(0, true);
    posRenderer.setSeriesShapesVisible(0, false);
    XYStepRenderer trajRenderer = new XYStepRenderer();
    trajRenderer.setSeriesPaint(1, Color.RED);
    trajRenderer.setSeriesStroke(1, new BasicStroke(10));
    trajRenderer.setSeriesLinesVisible(1, true);
    trajRenderer.setSeriesShapesVisible(1, false);

    XYLineAndShapeRenderer velRenderer = new XYLineAndShapeRenderer();
    velRenderer.setSeriesPaint(0, Color.MAGENTA);
    velRenderer.setSeriesLinesVisible(0, true);
    velRenderer.setSeriesShapesVisible(0, false);
    // renderer.setSeriesStroke(1, new BasicStroke(0.01f));
    plot.setRenderer(0, posRenderer);
    plot.setRenderer(1, trajRenderer);
    plot.setRenderer(2, velRenderer);

    for (Setpoint s : trajectory) {
        Marker marker = new ValueMarker(s.time);
        marker.setPaint(Color.DARK_GRAY);
        marker.setLabel(Float.toString((float) s.position));
        marker.setLabelAnchor(RectangleAnchor.TOP_LEFT);
        marker.setLabelTextAnchor(TextAnchor.TOP_RIGHT);
        plot.addDomainMarker(marker);
    }

    XYTextAnnotation p = new XYTextAnnotation("kP = " + gains.kP, plot.getDomainAxis().getUpperBound() * 0.125,
            plot.getRangeAxis().getUpperBound() * .75);
    p.setFont(new Font("Dialog", Font.PLAIN, 12));
    plot.addAnnotation(p);
    XYTextAnnotation i = new XYTextAnnotation("kI = " + gains.kI, plot.getDomainAxis().getUpperBound() * 0.125,
            plot.getRangeAxis().getUpperBound() * .7);
    i.setFont(new Font("Dialog", Font.PLAIN, 12));
    plot.addAnnotation(i);
    XYTextAnnotation d = new XYTextAnnotation("kD = " + gains.kD, plot.getDomainAxis().getUpperBound() * 0.125,
            plot.getRangeAxis().getUpperBound() * .65);
    d.setFont(new Font("Dialog", Font.PLAIN, 12));
    plot.addAnnotation(d);

    // change the auto tick unit selection to integer units only...
    final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    rangeAxis.setAutoRange(true);
    // OPTIONAL CUSTOMISATION COMPLETED.

    return chart;

}

From source file:net.sf.dynamicreports.test.jasper.chart.DifferenceChartTest.java

@Override
public void test() {
    super.test();

    numberOfPagesTest(1);// www .  ja v a2 s. c  om

    JFreeChart chart = getChart("summary.chart1", 0);
    XYItemRenderer renderer = chart.getXYPlot().getRenderer();
    Assert.assertEquals("renderer", XYDifferenceRenderer.class, renderer.getClass());
    Assert.assertFalse("show shapes", ((XYDifferenceRenderer) renderer).getShapesVisible());
    Assert.assertEquals("positive paint", Color.BLUE, ((XYDifferenceRenderer) renderer).getPositivePaint());
    Assert.assertEquals("negative paint", Color.MAGENTA, ((XYDifferenceRenderer) renderer).getNegativePaint());

    chart = getChart("summary.chart2", 0);
    Axis axis = chart.getXYPlot().getDomainAxis();
    Assert.assertEquals("category label", "time", axis.getLabel());
    Assert.assertEquals("category label color", Color.BLUE, axis.getLabelPaint());
    Assert.assertEquals("category label font", new Font("Arial", Font.BOLD, 10), axis.getLabelFont());
    Assert.assertEquals("tick label color", Color.CYAN, axis.getTickLabelPaint());
    Assert.assertEquals("tick label font", new Font("Arial", Font.ITALIC, 10), axis.getTickLabelFont());
    Assert.assertEquals("line color", Color.LIGHT_GRAY, axis.getAxisLinePaint());
    Assert.assertTrue("vertical tick labels", ((ValueAxis) axis).isVerticalTickLabels());

    chart = getChart("summary.chart3", 0);
    axis = chart.getXYPlot().getRangeAxis();
    Assert.assertEquals("value label", "value", axis.getLabel());
    Assert.assertEquals("value label color", Color.BLUE, axis.getLabelPaint());
    Assert.assertEquals("value label font", new Font("Arial", Font.BOLD, 10), axis.getLabelFont());
    Assert.assertEquals("tick label color", Color.CYAN, axis.getTickLabelPaint());
    Assert.assertEquals("tick label font", new Font("Arial", Font.ITALIC, 10), axis.getTickLabelFont());
    Assert.assertEquals("tick label mask", "10.00", ((NumberAxis) axis).getNumberFormatOverride().format(10));
    //Assert.assertEquals("line color", Color.LIGHT_GRAY, axis.getAxisLinePaint());
    Assert.assertEquals("range min value", 1d, ((ValueAxis) axis).getLowerBound());
    Assert.assertEquals("range max value", 15d, ((ValueAxis) axis).getUpperBound());
    Assert.assertTrue("vertical tick labels", ((ValueAxis) axis).isVerticalTickLabels());
}