Example usage for java.awt BasicStroke JOIN_MITER

List of usage examples for java.awt BasicStroke JOIN_MITER

Introduction

In this page you can find the example usage for java.awt BasicStroke JOIN_MITER.

Prototype

int JOIN_MITER

To view the source code for java.awt BasicStroke JOIN_MITER.

Click Source Link

Document

Joins path segments by extending their outside edges until they meet.

Usage

From source file:com.rapidminer.gui.new_plotter.engine.jfreechart.renderer.FormattedStatisticalLineAndShapeRenderer.java

@Override
public void renderFormatDelegateChanged(RenderFormatDelegate source) {
    SeriesFormat seriesFormat = source.getSeriesFormat();
    if (seriesFormat != null) {
        setErrorIndicatorStroke(new BasicStroke(Math.round(seriesFormat.getLineWidth() / 2.0),
                BasicStroke.CAP_SQUARE, BasicStroke.JOIN_MITER));
    }/*w  w  w . j  a  va  2 s  .c o m*/
}

From source file:com.orsonpdf.demo.PDFPieChartDemo1.java

/**
 * Creates a chart.//from ww w.  ja v a2s  .  c o m
 *
 * @param dataset  the dataset.
 *
 * @return A chart.
 */
private static JFreeChart createChart(PieDataset dataset) {

    JFreeChart chart = ChartFactory.createPieChart("Smart Phones Manufactured / Q3 2011", dataset, false, false,
            false);

    chart.setBackgroundPaint(
            new GradientPaint(new Point(0, 0), new Color(20, 20, 20), new Point(400, 200), Color.DARK_GRAY));

    // customise the title position and font
    TextTitle t = chart.getTitle();
    t.setHorizontalAlignment(HorizontalAlignment.LEFT);
    t.setPaint(new Color(240, 240, 240));
    t.setFont(new Font("Arial", Font.BOLD, 26));

    PiePlot plot = (PiePlot) chart.getPlot();

    plot.setBackgroundPaint(null);
    plot.setInteriorGap(0.04);
    plot.setOutlineVisible(false);
    plot.setShadowPaint(null);
    plot.setLabelShadowPaint(null);

    // use gradients and white borders for the section colours
    plot.setSectionPaint("Others", createGradientPaint(new Color(200, 200, 255), Color.BLUE));
    plot.setSectionPaint("Samsung", createGradientPaint(new Color(255, 200, 200), Color.RED));
    plot.setSectionPaint("Apple", createGradientPaint(new Color(200, 255, 200), Color.GREEN));
    plot.setSectionPaint("Nokia", createGradientPaint(new Color(200, 255, 200), Color.YELLOW));
    plot.setBaseSectionOutlinePaint(Color.WHITE);
    plot.setSectionOutlinesVisible(true);
    BasicStroke bs = new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_MITER, 1.0f);
    plot.setBaseSectionOutlineStroke(new BasicStroke(2.0f));

    // customise the section label appearance
    plot.setLabelFont(new Font("Courier New", Font.BOLD, 20));
    plot.setLabelLinkPaint(Color.WHITE);
    plot.setLabelLinkStroke(new BasicStroke(2.0f));
    plot.setLabelOutlineStroke(null);
    plot.setLabelPaint(Color.WHITE);
    plot.setLabelBackgroundPaint(null);

    // add a subtitle giving the data source
    TextTitle source = new TextTitle("Source: http://www.bbc.co.uk/news/business-15489523",
            new Font("Courier New", Font.PLAIN, 12));
    source.setPaint(Color.WHITE);
    source.setPosition(RectangleEdge.BOTTOM);
    source.setHorizontalAlignment(HorizontalAlignment.RIGHT);
    chart.addSubtitle(source);
    return chart;

}

From source file:net.sf.jasperreports.chartthemes.spring.ScaledDialRange.java

/**
 * Draws the range./*from   ww  w .  ja  va  2  s.co  m*/
 * 
 * @param g2  the graphics target.
 * @param plot  the plot.
 * @param frame  the dial's reference frame (in Java2D space).
 * @param view  the dial's view rectangle (in Java2D space).
 */
@Override
public void draw(Graphics2D g2, DialPlot plot, Rectangle2D frame, Rectangle2D view) {

    Rectangle2D arcRectInner = DialPlot.rectangleByRadius(frame, this.getInnerRadius(), this.getInnerRadius());
    Rectangle2D arcRectOuter = DialPlot.rectangleByRadius(frame, this.getOuterRadius(), this.getOuterRadius());

    DialScale scale = plot.getScale(this.getScaleIndex());
    if (scale == null) {
        throw new RuntimeException("No scale for scaleIndex = " + this.getScaleIndex());
    }
    double angleMin = scale.valueToAngle(this.getLowerBound());
    double angleMax = scale.valueToAngle(this.getUpperBound());

    Arc2D arcInner = new Arc2D.Double(arcRectInner, angleMin, angleMax - angleMin, Arc2D.OPEN);
    Arc2D arcOuter = new Arc2D.Double(arcRectOuter, angleMax, angleMin - angleMax, Arc2D.OPEN);

    g2.setPaint(this.getPaint());
    g2.setStroke(new BasicStroke(this.lineWidth, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER));
    g2.draw(arcInner);
    g2.draw(arcOuter);
}

From source file:net.sf.fspdfs.chartthemes.spring.ScaledDialRange.java

/**
 * Draws the range./*from   w  w w  .  j a v  a  2  s.c o  m*/
 * 
 * @param g2  the graphics target.
 * @param plot  the plot.
 * @param frame  the dial's reference frame (in Java2D space).
 * @param view  the dial's view rectangle (in Java2D space).
 */
public void draw(Graphics2D g2, DialPlot plot, Rectangle2D frame, Rectangle2D view) {

    Rectangle2D arcRectInner = DialPlot.rectangleByRadius(frame, this.getInnerRadius(), this.getInnerRadius());
    Rectangle2D arcRectOuter = DialPlot.rectangleByRadius(frame, this.getOuterRadius(), this.getOuterRadius());

    DialScale scale = plot.getScale(this.getScaleIndex());
    if (scale == null) {
        throw new RuntimeException("No scale for scaleIndex = " + this.getScaleIndex());
    }
    double angleMin = scale.valueToAngle(this.getLowerBound());
    double angleMax = scale.valueToAngle(this.getUpperBound());

    Arc2D arcInner = new Arc2D.Double(arcRectInner, angleMin, angleMax - angleMin, Arc2D.OPEN);
    Arc2D arcOuter = new Arc2D.Double(arcRectOuter, angleMax, angleMin - angleMax, Arc2D.OPEN);

    g2.setPaint(this.getPaint());
    g2.setStroke(new BasicStroke(this.lineWidth, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER));
    g2.draw(arcInner);
    g2.draw(arcOuter);
}

From source file:edu.jhuapl.graphs.jfreechart.TimeSeriesEffectsTest.java

public static JFreeChartGraphSource getSource() throws GraphException {
    Calendar base = Calendar.getInstance();
    base.set(Calendar.WEEK_OF_YEAR, 6);

    Random r = new Random();

    List<TimePoint> ps1 = new LinkedList<TimePoint>();
    List<TimePoint> ps2 = new LinkedList<TimePoint>();
    List<TimePoint> ps3 = new LinkedList<TimePoint>();

    for (int count = 0; count < 4; count += 1) {
        base.set(Calendar.DAY_OF_WEEK, 2);
        addPoint(base.getTime(), ps2, r);

        // now generate five points for ps1 and p23, the daily sets
        addPoint(base.getTime(), ps1, r);
        addPoint(base.getTime(), ps3, r, "showPoint?week=" + count + "&day=0", null);

        for (int i = 1; i < 5; i += 1) {
            base.add(Calendar.DAY_OF_WEEK, 1);
            addPoint(base.getTime(), ps1, r);
            addPoint(base.getTime(), ps3, r, "showPoint?week=" + count + "&day=" + i, null);
        }/*from w w w .j  av  a2s.  c o  m*/

        base.set(Calendar.DAY_OF_WEEK, 1);
        base.add(Calendar.WEEK_OF_YEAR, 1);
    }

    List<DefaultTimeSeries> series = new LinkedList<DefaultTimeSeries>();
    Map<String, Object> s1Md = new HashMap<String, Object>();
    s1Md.put(GraphSource.SERIES_TIME_RESOLUTION, TimeResolution.DAILY);
    s1Md.put(GraphSource.SERIES_SHAPE, new Ellipse2D.Float(-5, -5, 10, 10));
    s1Md.put(GraphSource.SERIES_TITLE, "Frederick County Counts");
    series.add(new DefaultTimeSeries(ps1, s1Md));

    Map<String, Object> s2Md = new HashMap<String, Object>();
    s2Md.put(GraphSource.SERIES_TIME_RESOLUTION, TimeResolution.WEEKLY);
    s2Md.put(GraphSource.SERIES_SHAPE, new Ellipse2D.Float(-7, -7, 14, 14));
    s2Md.put(GraphSource.SERIES_TITLE, "NCR Counts");
    series.add(new DefaultTimeSeries(ps2, s2Md));

    Map<String, Object> s3Md = new HashMap<String, Object>();
    s3Md.put(GraphSource.SERIES_TIME_RESOLUTION, TimeResolution.DAILY);
    s3Md.put(GraphSource.SERIES_SHAPE, new Rectangle2D.Float(-3, -3, 6, 6));
    s3Md.put(GraphSource.SERIES_TITLE, "Carroll County Counts");
    BasicStroke bs = new BasicStroke(1, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 10,
            new float[] { 3F, 2F, 8F }, 1F);
    s3Md.put(GraphSource.SERIES_STROKE, bs);
    series.add(new DefaultTimeSeries(ps3, s3Md));

    Map<String, Object> params = new HashMap<String, Object>();
    params.put(GraphSource.BACKGROUND_COLOR, Color.BLUE);
    params.put(JFreeChartTimeSeriesGraphSource.PLOT_COLOR, Color.WHITE);
    params.put(GraphSource.GRAPH_TITLE, "Counts");
    params.put(GraphSource.GRAPH_X_LABEL, "Time");
    params.put(GraphSource.GRAPH_Y_LABEL, "Total Counts");
    DateAxis customAxis = new RotatedTickDateAxis(60.);
    params.put(JFreeChartTimeSeriesGraphSource.DATE_AXIS, customAxis);

    JFreeChartGraphSource source = new JFreeChartGraphSource();
    source.setData(series);
    source.setParams(params);
    source.initialize();

    return source;
}

From source file:demo.EdgeLabelDemo.java

/**
 * create an instance of a simple graph with controls to
 * demo the label positioning features//w  ww  .  j a  va2s  .  c  o  m
 * 
 */
@SuppressWarnings("serial")
public EdgeLabelDemo() {

    // create a simple graph for the demo
    graph = new SparseMultigraph<Integer, Number>();
    Integer[] v = createVertices(3);
    createEdges(v);

    Layout<Integer, Number> layout = new CircleLayout<Integer, Number>(graph);
    vv = new VisualizationViewer<Integer, Number>(layout, new Dimension(600, 400));
    vv.setBackground(Color.white);

    vertexLabelRenderer = vv.getRenderContext().getVertexLabelRenderer();
    edgeLabelRenderer = vv.getRenderContext().getEdgeLabelRenderer();

    Transformer<Number, String> stringer = new Transformer<Number, String>() {
        public String transform(Number e) {
            return "Edge:" + graph.getEndpoints(e).toString();
        }
    };
    vv.getRenderContext().setEdgeLabelTransformer(stringer);

    float dash[] = { 10.0f };
    final Stroke edgeStroke2 = new BasicStroke();
    final Stroke edgeStroke = new BasicStroke(1.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 10.0f, dash,
            0.0f);
    Transformer<Number, Stroke> edgeStrokeTransformer = new Transformer<Number, Stroke>() {
        public Stroke transform(Number s) {
            return edgeStroke;
        }
    };
    vv.getRenderContext().setEdgeStrokeTransformer(edgeStrokeTransformer);

    vv.getRenderContext().setEdgeShapeTransformer(new EdgeShape.Line<Integer, Number>());
    //vv.getRenderContext().setEdgeDrawPaintTransformer(new PickableEdgePaintTransformer<Number>(vv.getPickedEdgeState(), Color.black, Color.cyan));
    //vv.getRenderContext().setVertexFillPaintTransformer(new PickableVertexPaintTransformer<Integer>(vv.getPickedVertexState(), Color.red, Color.yellow));

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

    // create a frome to hold the graph
    final GraphZoomScrollPane panel = new GraphZoomScrollPane(vv);
    Container content = getContentPane();
    content.add(panel);
    /*
      final DefaultModalGraphMouse<Integer,Number> graphMouse = new DefaultModalGraphMouse<Integer,Number>();
      vv.setGraphMouse(graphMouse);
            
      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());
    }
      });
            
      ButtonGroup radio = new ButtonGroup();
      JRadioButton lineButton = new JRadioButton("Line");
      lineButton.addItemListener(new ItemListener(){
    public void itemStateChanged(ItemEvent e) {
        if(e.getStateChange() == ItemEvent.SELECTED) {
            vv.getRenderContext().setEdgeShapeTransformer(new EdgeShape.Line<Integer,Number>());
            vv.repaint();
        }
    }
      });
            
      JRadioButton quadButton = new JRadioButton("QuadCurve");
      quadButton.addItemListener(new ItemListener(){
    public void itemStateChanged(ItemEvent e) {
        if(e.getStateChange() == ItemEvent.SELECTED) {
            vv.getRenderContext().setEdgeShapeTransformer(new EdgeShape.QuadCurve<Integer,Number>());
            vv.repaint();
        }
    }
      });
            
      JRadioButton cubicButton = new JRadioButton("CubicCurve");
      cubicButton.addItemListener(new ItemListener(){
    public void itemStateChanged(ItemEvent e) {
        if(e.getStateChange() == ItemEvent.SELECTED) {
            vv.getRenderContext().setEdgeShapeTransformer(new EdgeShape.CubicCurve<Integer,Number>());
            vv.repaint();
        }
    }
      });
      radio.add(lineButton);
      radio.add(quadButton);
      radio.add(cubicButton);
            
      graphMouse.setMode(ModalGraphMouse.Mode.TRANSFORMING);
            
      JCheckBox rotate = new JCheckBox("<html><center>EdgeType<p>Parallel</center></html>");
      rotate.addItemListener(new ItemListener(){
    public void itemStateChanged(ItemEvent e) {
        AbstractButton b = (AbstractButton)e.getSource();
        edgeLabelRenderer.setRotateEdgeLabels(b.isSelected());
        vv.repaint();
    }
      });
      rotate.setSelected(true);
      MutableDirectionalEdgeValue mv = new MutableDirectionalEdgeValue(.5, .7);
      vv.getRenderContext().setEdgeLabelClosenessTransformer(mv);
      JSlider directedSlider = new JSlider(mv.getDirectedModel()) {
    public Dimension getPreferredSize() {
        Dimension d = super.getPreferredSize();
        d.width /= 2;
        return d;
    }
      };
      JSlider undirectedSlider = new JSlider(mv.getUndirectedModel()) {
    public Dimension getPreferredSize() {
        Dimension d = super.getPreferredSize();
        d.width /= 2;
        return d;
    }
      };
            
      JSlider edgeOffsetSlider = new JSlider(0,50) {
    public Dimension getPreferredSize() {
        Dimension d = super.getPreferredSize();
        d.width /= 2;
        return d;
    }
      };
      edgeOffsetSlider.addChangeListener(new ChangeListener() {
            
    public void stateChanged(ChangeEvent e) {
        JSlider s = (JSlider)e.getSource();
        AbstractEdgeShapeTransformer<Integer,Number> aesf = 
            (AbstractEdgeShapeTransformer<Integer,Number>)vv.getRenderContext().getEdgeShapeTransformer();
        aesf.setControlOffsetIncrement(s.getValue());
        vv.repaint();
    }
            
      });
            
      Box controls = Box.createHorizontalBox();
            
      JPanel zoomPanel = new JPanel(new GridLayout(0,1));
      zoomPanel.setBorder(BorderFactory.createTitledBorder("Scale"));
      zoomPanel.add(plus);
      zoomPanel.add(minus);
            
      JPanel edgePanel = new JPanel(new GridLayout(0,1));
      edgePanel.setBorder(BorderFactory.createTitledBorder("EdgeType Type"));
      edgePanel.add(lineButton);
      edgePanel.add(quadButton);
      edgePanel.add(cubicButton);
            
      JPanel rotatePanel = new JPanel();
      rotatePanel.setBorder(BorderFactory.createTitledBorder("Alignment"));
      rotatePanel.add(rotate);
            
      JPanel labelPanel = new JPanel(new BorderLayout());
      JPanel sliderPanel = new JPanel(new GridLayout(3,1));
      JPanel sliderLabelPanel = new JPanel(new GridLayout(3,1));
      JPanel offsetPanel = new JPanel(new BorderLayout());
      offsetPanel.setBorder(BorderFactory.createTitledBorder("Offset"));
      sliderPanel.add(directedSlider);
      sliderPanel.add(undirectedSlider);
      sliderPanel.add(edgeOffsetSlider);
      sliderLabelPanel.add(new JLabel("Directed", JLabel.RIGHT));
      sliderLabelPanel.add(new JLabel("Undirected", JLabel.RIGHT));
      sliderLabelPanel.add(new JLabel("Edges", JLabel.RIGHT));
      offsetPanel.add(sliderLabelPanel, BorderLayout.WEST);
      offsetPanel.add(sliderPanel);
      labelPanel.add(offsetPanel);
      labelPanel.add(rotatePanel, BorderLayout.WEST);
            
      JPanel modePanel = new JPanel(new GridLayout(2,1));
      modePanel.setBorder(BorderFactory.createTitledBorder("Mouse Mode"));
      modePanel.add(graphMouse.getModeComboBox());
            
      controls.add(zoomPanel);
      controls.add(edgePanel);
      controls.add(labelPanel);
      controls.add(modePanel);
      content.add(controls, BorderLayout.SOUTH);
      quadButton.setSelected(true);
     */
}

From source file:ancat.visualizers.UndirectedModelVisualizer.java

private void produce(String fileName) {
    _currentLayout.setSize(new Dimension(600, 600));

    VisualizationImageServer<V, E> vv = new VisualizationImageServer<V, E>(_currentLayout,
            new Dimension(600, 600));

    vv.setPreferredSize(new Dimension(600, 600));

    // Setup up a new vertex to paint transformer...
    Transformer<V, Paint> vertexPaint = new Transformer<V, Paint>() {
        public Paint transform(V v) {
            //return Color.GREEN;
            ancat.common.Vertex vertex = (Vertex) v;

            if (vertex instanceof ancat.common.ExecutableFile)
                return Color.BLUE;

            if (vertex instanceof ancat.common.DynamicLibrary)
                return Color.YELLOW;

            if (vertex instanceof ancat.common.ConfigurationFile)
                return Color.ORANGE;

            if (vertex instanceof ancat.common.Unspecified)
                return Color.RED;

            return Color.darkGray;
        }/*w ww. j a  va2  s.  c  om*/
    };
    // Set up a new stroke Transformer for the edges
    float dash[] = { 10.0f };

    final Stroke edgeStroke = new BasicStroke(1.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 10.0f, dash,
            0.0f);

    Transformer<E, Stroke> edgeStrokeTransformer = new Transformer<E, Stroke>() {
        public Stroke transform(E s) {
            return edgeStroke;
        }
    };

    Transformer<E, Font> edgeFontTransformer = new Transformer<E, Font>() {
        public Font transform(E e) {
            return new Font("Dialog", Font.PLAIN, 10);
        }
    };

    Transformer<E, String> lblTransformer = new Transformer<E, String>() {
        public String transform(E e) {
            Edge edge = (Edge) e;
            //return edge.getXMLId();
            return edge.getXMLId() != null ? edge.getXMLId() : "";
        }
    };

    Transformer<V, Font> vertexFontTransformer = new Transformer<V, Font>() {
        public Font transform(V v) {
            return new Font("Dialog", Font.PLAIN, 10);
        }
    };

    Transformer<V, String> vLblTransformer = new Transformer<V, String>() {
        public String transform(V v) {
            Vertex vertex = (Vertex) v;
            return vertex.getElementID();
        }
    };

    vv.getRenderContext().setVertexFillPaintTransformer(vertexPaint);
    vv.getRenderContext().setEdgeStrokeTransformer(edgeStrokeTransformer);
    vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller<V>());
    vv.getRenderContext().setEdgeLabelTransformer(new ToStringLabeller<E>());
    // ---->
    vv.getRenderContext().setEdgeFontTransformer(edgeFontTransformer);
    vv.getRenderContext().setLabelOffset(20);
    vv.getRenderContext().setEdgeLabelTransformer(lblTransformer);

    vv.getRenderContext().setVertexFontTransformer(vertexFontTransformer);
    vv.getRenderContext().setVertexLabelTransformer(vLblTransformer);

    vv.getRenderer().getVertexLabelRenderer().setPosition(Position.N);

    BufferedImage img = new BufferedImage((int) _currentLayout.getSize().getWidth(),
            (int) _currentLayout.getSize().getHeight(), BufferedImage.TYPE_INT_ARGB);

    vv.getImage(new Point(0, 0), new Dimension(700, 700));

    Graphics2D g2d = (Graphics2D) img.getGraphics();

    vv.paint(g2d);

    setDisclaimer(g2d);

    g2d.dispose();

    try {
        File file = new File(fileName);

        ImageIO.write(img, "png", file);
    } catch (IOException e) {
        e.printStackTrace();
    }
}

From source file:de.bfs.radon.omsimulation.gui.data.OMCharts.java

/**
 * Creates a chart displaying the radon concentration of a single room. Uses
 * red for normal rooms, blue for cellar rooms and green for misc rooms.
 * //  w  w  w. j ava 2s . c  o m
 * @param title
 *          The headline of the chart. Will be hidden if set to null.
 * @param room
 *          The room object containing the radon data.
 * @param preview
 *          Will hide annotations, labels and headlines if true.
 * @return A chart displaying the radon concentration of a single room.
 */
public static JFreeChart createRoomChart(String title, OMRoom room, boolean preview) {
    Color lineColor = new Color(0, 0, 0, 128);
    Color rangeColor = new Color(222, 222, 222, 128);
    if (room.getType() == OMRoomType.Room) {
        lineColor = new Color(255, 0, 0, 128);
        rangeColor = new Color(255, 222, 222, 128);
    } else {
        if (room.getType() == OMRoomType.Cellar) {
            lineColor = new Color(0, 0, 255, 128);
            rangeColor = new Color(222, 222, 255, 128);
        } else {
            lineColor = new Color(0, 128, 0, 255);
            rangeColor = new Color(222, 255, 222, 128);
        }
    }
    double[] values = room.getValues();
    XYSeriesCollection dataSet = new XYSeriesCollection();
    XYSeries series = new XYSeries("Radon");
    int count = room.getCount();
    double maxPointerKey = 0;
    for (int i = 0; i < count; i++) {
        series.add(i, values[i]);
        if (values[i] == room.getMaximum()) {
            maxPointerKey = i;
        }
    }
    dataSet.addSeries(series);
    title = title + ": " + room.getType().toString() + " " + room.getId();
    JFreeChart chart = ChartFactory.createXYLineChart(title, "T [h]", "Rn [Bq/m\u00B3]", dataSet,
            PlotOrientation.VERTICAL, false, true, false);
    XYPlot plot = (XYPlot) chart.getPlot();
    double positiveDeviation = room.getAverage() + room.getDeviation();
    double negativeDeviation = room.getAverage() - room.getDeviation();
    IntervalMarker deviation = new IntervalMarker(negativeDeviation, positiveDeviation);
    float[] dash = { 5, 3 };
    deviation.setPaint(rangeColor);
    deviation.setStroke(new BasicStroke(2, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 1, dash, 0));
    plot.addRangeMarker(deviation, Layer.BACKGROUND);
    ValueMarker arithMarker = new ValueMarker(room.getAverage(), lineColor,
            new BasicStroke(1, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 1, dash, 0));
    plot.addRangeMarker(arithMarker);
    ValueMarker maxiMarker = new ValueMarker(room.getMaximum(), lineColor,
            new BasicStroke(1, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 1, dash, 0));
    plot.addRangeMarker(maxiMarker);
    XYTextAnnotation amLabel = new XYTextAnnotation("AM=" + (int) room.getAverage(), count,
            room.getAverage() * 1.01);
    plot.addAnnotation(amLabel);
    XYTextAnnotation sdLabel = new XYTextAnnotation("SD=" + (int) room.getDeviation(), count,
            (room.getAverage() + room.getDeviation()) * 1.01);
    plot.addAnnotation(sdLabel);
    XYTextAnnotation maxLabel = new XYTextAnnotation("MAX=" + (int) room.getMaximum(), count,
            room.getMaximum() * 1.01);
    plot.addAnnotation(maxLabel);
    XYPointerAnnotation maxPointer = new XYPointerAnnotation("", maxPointerKey, room.getMaximum(),
            Math.PI * 1.1);
    plot.addAnnotation(maxPointer);
    XYItemRenderer renderer = plot.getRenderer();
    renderer.setSeriesPaint(0, lineColor);
    if (preview) {
        chart.setTitle("");
        plot.clearAnnotations();
    }
    return chart;
}

From source file:com.github.errantlinguist.latticevisualiser.EdgeStrokeTransformer.java

@Override
public Stroke transform(final Edge edge) {
    // Edges are negative log probabilities
    final double probability = Math.pow(10, -edge.getWeight());
    final float weight = (float) probability * WEIGHT_FACTOR;
    // System.out.println(Float.toString(weight));
    Stroke stroke;//from ww w . j a v  a  2  s.co  m
    if (nonwords != null && nonwords.contains(edge.getOutputSymbol())) {
        stroke = new BasicStroke(weight, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 10.0f, STROKE_DASH,
                0.0f);
    } else {
        stroke = new BasicStroke(weight);
    }

    return stroke;
}

From source file:org.sonar.server.charts.deprecated.BaseChart.java

protected BasicStroke getDashedStroke(float width) {
    return new BasicStroke(width, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 10.0f, new float[] { 5.0f },
            0.0f);// w  w  w .  ja v a  2s . co m
}