Example usage for org.jfree.chart.plot Marker setLabelPaint

List of usage examples for org.jfree.chart.plot Marker setLabelPaint

Introduction

In this page you can find the example usage for org.jfree.chart.plot Marker setLabelPaint.

Prototype

public void setLabelPaint(Paint paint) 

Source Link

Document

Sets the label paint and sends a MarkerChangeEvent to all registered listeners.

Usage

From source file:org.sonar.server.charts.jruby.TrendsChart.java

public void addLabel(Date date, String label, boolean lower) throws ParseException {
    Day d = new Day(date);
    double millis = d.getFirstMillisecond();
    Marker marker = new ValueMarker(millis);
    marker.setLabel(label);// www  .  j a  va2  s.  c om
    marker.setLabelAnchor(RectangleAnchor.TOP_RIGHT);
    marker.setLabelTextAnchor(TextAnchor.TOP_LEFT);
    Color c = new Color(17, 40, 95);
    marker.setLabelPaint(c);
    marker.setPaint(c);
    marker.setStroke(new BasicStroke(1.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 3.0f,
            new float[] { 5f, 5f, 5f, 5f }, 2.0f));
    if (lower) {
        marker.setLabelOffset(new RectangleInsets(18, 0, 0, 5));
    }
    plot.addDomainMarker(marker);
}

From source file:com.appnativa.rare.ui.chart.jfreechart.ChartHelper.java

public static void updateMarker(Marker marker, ChartDataItem item) {
    if (item.getFont() != null) {
        marker.setLabelFont(item.getFont());
    } else {/*from w w w. java  2 s .  c o  m*/
        UIFont f = Platform.getUIDefaults().getFont("Rare.Chart.markerFont");

        if (f != null) {
            marker.setLabelFont(f);
        }
    }

    if (item.getForeground() != null) {
        marker.setLabelPaint(item.getForeground());
    } else {
        UIColor c = Platform.getUIDefaults().getColor("Rare.Chart.markerForeground");

        if (c != null) {
            marker.setLabelPaint(c.getPaint());
        }
    }

    if (item.getBackground() != null) {
        marker.setPaint(item.getBackground());
    } else {
        UIColor c = Platform.getUIDefaults().getColor("Rare.Chart.markerBackground");

        if (c != null) {
            marker.setPaint(c.getPaint());
        }
    }
}

From source file:net.liuxuan.device.VACVBS.JIF_DrawChart_vacvbs.java

private void chartDrawHerizonLine(VACVBSMetaData data, Color color, String Labelstr) {
    XYPlot plot = (XYPlot) chartPanel.getChart().getPlot();
    final Marker start = new ValueMarker(0);
    start.setPaint(color);/*w w w .ja  v a 2s . c o  m*/
    start.setLabel(Labelstr);
    start.setLabelAnchor(RectangleAnchor.BOTTOM_LEFT);
    start.setLabelTextAnchor(TextAnchor.TOP_LEFT);
    start.setLabelPaint(color);
    plot.addRangeMarker(start);
}

From source file:net.liuxuan.device.VACVBS.JIF_DrawChart_vacvbs.java

private void chartDrawVerticalLine(VACVBSMetaData data, Color color, String Labelstr) {
    XYPlot plot = (XYPlot) chartPanel.getChart().getPlot();
    final Marker start = new ValueMarker(data.date1.getTime());
    start.setPaint(color);//from  ww w .java2 s . c  o  m
    start.setLabel(Labelstr);
    start.setLabelAnchor(RectangleAnchor.TOP_LEFT);
    start.setLabelTextAnchor(TextAnchor.TOP_LEFT);
    start.setLabelPaint(color);
    plot.addDomainMarker(start);
}

From source file:net.liuxuan.device.w3330.JIF_DrawChart_w3330.java

private void chartDrawHerizonLine(W3330MetaData data, Color color, String Labelstr) {
    XYPlot plot = (XYPlot) chartPanel.getChart().getPlot();
    final Marker start = new ValueMarker(data.zero);
    start.setPaint(color);/* w  ww .j a v  a  2 s. c om*/
    start.setLabel(Labelstr);
    start.setLabelAnchor(RectangleAnchor.BOTTOM_LEFT);
    start.setLabelTextAnchor(TextAnchor.TOP_LEFT);
    start.setLabelPaint(color);
    plot.addRangeMarker(start);
}

From source file:net.liuxuan.device.w3330.JIF_DrawChart_w3330.java

private void chartDrawVerticalLine(W3330MetaData data, Color color, String Labelstr) {
    XYPlot plot = (XYPlot) chartPanel.getChart().getPlot();
    final Marker start = new ValueMarker(data.time.getTime());
    start.setPaint(color);/*w w  w.jav  a  2  s .  co  m*/
    start.setLabel(Labelstr);
    start.setLabelAnchor(RectangleAnchor.TOP_LEFT);
    start.setLabelTextAnchor(TextAnchor.TOP_LEFT);
    start.setLabelPaint(color);
    plot.addDomainMarker(start);
}