Example usage for org.jfree.chart.plot CompassPlot setSeriesNeedle

List of usage examples for org.jfree.chart.plot CompassPlot setSeriesNeedle

Introduction

In this page you can find the example usage for org.jfree.chart.plot CompassPlot setSeriesNeedle.

Prototype

public void setSeriesNeedle(int type) 

Source Link

Document

Sets the needle type.

Usage

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

private static JFreeChart createChart(ValueDataset valuedataset) {
    CompassPlot compassplot = new CompassPlot(valuedataset);
    compassplot.setSeriesNeedle(7);
    compassplot.setSeriesPaint(0, Color.black);
    compassplot.setSeriesOutlinePaint(0, Color.black);
    compassplot.setRosePaint(Color.red);
    compassplot.setRoseHighlightPaint(Color.gray);
    compassplot.setRoseCenterPaint(Color.white);
    compassplot.setDrawBorder(false);//from w  w  w. java 2 s.c  om
    JFreeChart jfreechart = new JFreeChart(compassplot);
    return jfreechart;
}

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

/**
 * Creates a chart.//from   w w  w.  j a  va2s .  com
 * 
 * @param dataset  the dataset.
 * 
 * @return The chart.
 */
private JFreeChart createChart(final ValueDataset dataset) {

    final CompassPlot plot = new CompassPlot(dataset);
    plot.setSeriesNeedle(7);
    plot.setSeriesPaint(0, Color.red);
    plot.setSeriesOutlinePaint(0, Color.red);
    final JFreeChart chart = new JFreeChart(plot);
    return chart;

}

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

/**
 * Creates a chart.// w  w w . j a v  a  2s  . c  o  m
 * 
 * @param dataset  the dataset.
 * 
 * @return The chart.
 */
protected JFreeChart createChart(ValueDataset dataset) {

    CompassPlot plot = new CompassPlot(dataset);
    plot.setSeriesNeedle(7);
    plot.setSeriesPaint(0, Color.red);
    plot.setSeriesOutlinePaint(0, Color.red);
    plot.setRoseHighlightPaint(Color.CYAN);
    JFreeChart chart = new JFreeChart(plot);
    return chart;

}

From source file:edu.ucla.stat.SOCR.chart.SuperValueChart.java

/**
 * Creates a chart./*w  w w . ja  va2  s  .  c  om*/
 * 
 * @param dataset  the dataset.
 * 
 * @return a chart.
 */
protected JFreeChart createChart(ValueDataset dataset) {
    // create the chart...
    // OPTIONAL CUSTOMISATION COMPLETED.
    CompassPlot plot = new CompassPlot(dataset);
    plot.setSeriesNeedle(7);
    plot.setSeriesPaint(0, Color.red);
    plot.setSeriesOutlinePaint(0, Color.red);
    plot.setRoseHighlightPaint(Color.CYAN);
    JFreeChart chart = new JFreeChart(plot);

    return chart;

}

From source file:se.technipelago.weather.chart.Generator.java

private void createWindCompass(int direction, final String filename) throws IOException {
    final ValueDataset dataset = new DefaultValueDataset(direction);
    final CompassPlot plot2 = new CompassPlot(dataset);
    plot2.setSeriesNeedle(7);
    plot2.setSeriesPaint(0, Color.red);
    plot2.setSeriesOutlinePaint(0, Color.red);

    final JFreeChart chart = new JFreeChart(plot2);
    //final TextTitle title = new TextTitle("Vindriktning", new Font("Dialog", Font.BOLD, 12));
    //title.setPaint(Color.DARK_GRAY);
    //chart.setTitle(title);
    chart.setBackgroundPaint(VERY_LIGHT_GRAY);

    OutputStream out = null;//from   w w w  .j av a 2s  .  co  m
    try {
        out = new FileOutputStream(outputDir != null ? outputDir + "/" + filename : filename);
        ChartUtilities.writeChartAsPNG(out, chart, DIAL_WIDTH, DIAL_HEIGHT);
    } finally {
        if (out != null) {
            out.close();
        }
    }
}

From source file:edu.ucla.stat.SOCR.chart.ChartGenerator_JTable.java

private JFreeChart createCompassChart(String title, ValueDataset dataset) {
    // create the chart...
    CompassPlot plot = new CompassPlot(dataset);
    plot.setSeriesNeedle(7);
    plot.setSeriesPaint(0, Color.red);
    plot.setSeriesOutlinePaint(0, Color.red);
    plot.setRoseHighlightPaint(Color.CYAN);
    JFreeChart chart = new JFreeChart(plot);

    return chart;

}

From source file:ucar.unidata.idv.flythrough.Flythrough.java

/**
 * _more_/*from  w w  w. j a va  2  s . c o  m*/
 *
 * @param g _more_
 * @param comp _more_
 */
public void paintDashboardAfter(Graphics g, JComponent comp) {

    Graphics2D g2 = (Graphics2D) g;
    AffineTransform oldTransform = g2.getTransform();
    Rectangle b = dashboardLbl.getBounds();
    int w = dashboardImage.getWidth(null);
    int h = dashboardImage.getHeight(null);
    Point ul = new Point(b.width / 2 - w / 2, b.height - h);
    int ptsIdx = 0;

    try {
        pipPanel.setPreferredSize(new Dimension(dialPts[ptsIdx][2], dialPts[ptsIdx][3]));
        pipFrame.setSize(dialPts[ptsIdx][2], dialPts[ptsIdx][3]);
        pipPanel.doLayout();
        pipPanel.validate();
        pipFrame.pack();
        pipPanel.resetDrawBounds();
        pipPanel.redraw();
    } catch (Exception ignore) {
    }

    JLabel locLbl = null;

    if (lastLocation != null) {
        try {
            locLbl = new JLabel("<html><table width=100%><tr><td align=right>&nbsp;Lat:</td></td>"
                    + getIdv().getDisplayConventions().formatLatLon(getLat(lastLocation)) + "</td></tr>"
                    + "<tr><td align=right>&nbsp;Lon:</td></td>"
                    + getIdv().getDisplayConventions().formatLatLon(getLon(lastLocation)) + "</td></tr>"
                    + "<tr><td align=right>&nbsp;Alt:</td></td>"
                    + getIdv().getDisplayConventions().formatDistance(getAlt(lastLocation)) + "</table>");
        } catch (Exception ignore) {
        }
    }
    if (locLbl == null) {
        locLbl = new JLabel(
                "<html><table width=100%><tr><td align=right>&nbsp;Lat:</td></td>N/A </td></tr><tr><td align=right>&nbsp;Lon:</td></td>N/A </td></tr><tr><td align=right>&nbsp;Alt:</td></td>N/A </table>");
    }
    locLbl.setOpaque(true);
    locLbl.setBackground(Color.white);

    DefaultValueDataset headingDataset = new DefaultValueDataset(new Double(currentHeading));

    CompassPlot plot = new CompassPlot(headingDataset);
    plot.setSeriesNeedle(0);
    plot.setSeriesPaint(0, Color.red);
    plot.setSeriesOutlinePaint(0, Color.red);
    JFreeChart chart = new JFreeChart("", plot);
    ChartPanel compassPanel = new ChartPanel(chart);

    plot.setBackgroundPaint(new Color(255, 255, 255, 0));
    plot.setBackgroundImageAlpha(0.0f);
    chart.setBackgroundPaint(new Color(255, 255, 255, 0));
    compassPanel.setBackground(new Color(255, 255, 255, 0));
    compassPanel.setPreferredSize(dialDimension);
    //        compassPanel.setSize(new Dimension(100,100));

    g2.setTransform(oldTransform);
    pipRect = drawDial(g2, pipPanel, ptsIdx++, ul);

    JFrame dummyFrame = new JFrame("");
    dummyFrame.setContentPane(compassPanel);
    dummyFrame.pack();

    g2.setTransform(oldTransform);
    drawDial(g2, compassPanel, ptsIdx++, ul);

    g2.setTransform(oldTransform);
    dummyFrame.setContentPane(locLbl);
    dummyFrame.pack();
    drawDial(g2, locLbl, ptsIdx++, ul);

    if (showReadout) {
        for (JComponent dial : dials) {
            dummyFrame.setContentPane(dial);
            dummyFrame.pack();

            g2.setTransform(oldTransform);
            drawDial(g2, dial, ptsIdx++, ul);
        }
    }

    g2.setTransform(oldTransform);

}