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

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

Introduction

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

Prototype

public void setStroke(Stroke stroke) 

Source Link

Document

Sets the stroke and sends a MarkerChangeEvent to all registered listeners.

Usage

From source file:graph_line.java

public void addMarkers(double peak) {
    if (_active > 0) {
        Marker m1 = new ValueMarker(peak);
        m1.setStroke(new BasicStroke((float) .5));
        m1.setPaint(Color.GRAY);/*w  w  w  .  j a v  a2s.co m*/
        plot.addDomainMarker(m1);
    }
}

From source file:graph_line.java

public void addMarkers(double[] peak) {
    if (_active > 0) {
        for (int i = 0; i < peak.length; i++) {
            Marker m1 = new ValueMarker(peak[i]);
            m1.setStroke(new BasicStroke((float) .5));
            m1.setPaint(Color.GRAY);
            plot.addDomainMarker(m1);/*  w w  w . ja va 2  s.  c om*/
        }
    }
}

From source file:graph_baseband.java

public void addMarkers(double peak, Color color) {
    if (_active > 0) {
        Marker m1 = new ValueMarker(peak);
        m1.setStroke(new BasicStroke((float) 1));
        m1.setPaint(color);/*  w  w  w . ja v a2 s  .  c  o m*/
        plot.addDomainMarker(m1);
    }
}

From source file:graph_line.java

public void addMarkers(double pos1, double pos2) {
    if (!fftseries.isEmpty()) {
        Marker m1 = new ValueMarker(pos1);
        Marker m2 = new ValueMarker(pos2);

        m1.setStroke(new BasicStroke(2));
        m2.setStroke(new BasicStroke(2));
        m1.setPaint(Color.RED);/*from  w  w w .  j  a  v  a  2 s  .  c  o m*/
        m2.setPaint(Color.GREEN);
        plot.addDomainMarker(m1);
        plot.addDomainMarker(m2);
    }

}

From source file:net.sf.jasperreports.customizers.marker.AbstractMarkerCustomizer.java

protected void configureStroke(Marker marker) {
    Float strokeWidth = getFloatProperty(PROPERTY_STROKE_WIDTH);
    if (strokeWidth == null) {
        strokeWidth = 1f;//  w  ww  .  ja  va 2  s  . c  o m
    }

    BasicStroke basicStroke = getStroke(strokeWidth);

    marker.setStroke(basicStroke);
}

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);//from   www .j av a2  s .  c o m
    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:org.jrecruiter.web.actions.admin.ShowStatisticsAction.java

public final String chartJobCount() throws Exception {

    final Calendar calendarToday = CalendarUtils.getCalendarWithoutTime();

    final Calendar calendar30 = CalendarUtils.getCalendarWithoutTime();
    calendar30.add(Calendar.MONTH, -36);

    final List<JobCountPerDay> jobCountPerDayList = jobService.getJobCountPerDayAndPeriod(calendar30.getTime(),
            calendarToday.getTime());/*from  ww  w .ja v  a2 s.com*/

    final TimeSeries hitsPerDayData = new TimeSeries("Hits", Day.class);
    final XYDataset hitsPerDayDataset = new TimeSeriesCollection(hitsPerDayData);
    this.chart = ChartFactory.createTimeSeriesChart("",
            super.getText("class.ShowStatisticsAcion.chart.job.count.caption"), "", hitsPerDayDataset, false,
            true, false);

    final XYPlot xyplot = (XYPlot) this.chart.getPlot();

    for (JobCountPerDay jobCountPerDay : jobCountPerDayList) {

        final Day day = new Day(jobCountPerDay.getJobDate());

        if (jobCountPerDay.getAutomaticallyCleaned()) {

            final Marker originalEnd = new ValueMarker(day.getFirstMillisecond());
            originalEnd.setPaint(new Color(0, 80, 138, 150));
            float[] dashPattern = { 6, 2 };

            originalEnd.setStroke(
                    new BasicStroke(2, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 10, dashPattern, 0));
            originalEnd.setLabelAnchor(RectangleAnchor.TOP_LEFT);
            originalEnd.setLabelTextAnchor(TextAnchor.TOP_RIGHT);
            originalEnd.setLabel("C");
            originalEnd.setAlpha(0.1F);
            xyplot.addDomainMarker(originalEnd);
        }

        hitsPerDayData.add(day, jobCountPerDay.getTotalNumberOfJobs());
    }

    chart.setBackgroundPaint(new Color(255, 255, 255, 0));

    xyplot.setDomainGridlinePaint(Color.LIGHT_GRAY);
    xyplot.setBackgroundPaint(new Color(255, 255, 255, 0));

    xyplot.setRangeGridlinePaint(Color.LIGHT_GRAY);
    xyplot.setAxisOffset(new RectangleInsets(5D, 5D, 5D, 5D));
    xyplot.setDomainCrosshairVisible(true);
    xyplot.setRangeCrosshairVisible(true);

    org.jfree.chart.renderer.xy.XYItemRenderer xyitemrenderer = xyplot.getRenderer();
    if (xyitemrenderer instanceof XYLineAndShapeRenderer) {
        XYLineAndShapeRenderer xylineandshaperenderer = (XYLineAndShapeRenderer) xyitemrenderer;
        xylineandshaperenderer.setBaseShapesVisible(false);
        xyitemrenderer.setSeriesPaint(0, new Color(244, 66, 0));
    }

    DateAxis dateaxis = (DateAxis) xyplot.getDomainAxis();

    dateaxis.setAutoRange(true);
    dateaxis.setAutoTickUnitSelection(true);

    NumberAxis valueAxis = (NumberAxis) xyplot.getRangeAxis();
    valueAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());

    return SUCCESS;
}

From source file:no.met.jtimeseries.chart.ChartPlotter.java

public void addPercipitationBars(TimeBase timeBase, String title, NumberPhenomenon phenomenon, Color color) {
    XYDataset dataSet = phenomenon.getTimeSeries(title, timeBase);
    if (dataSet.getSeriesCount() > 0) {

        double margin = 0.1;
        double maxPrecipitation = phenomenon.getMaxValue();
        addBarChart(dataSet, "value", color, margin, maxPrecipitation);
        showBarValuesOnTop(plotIndex - 1, 6D);

        plot.getRangeAxis(getRangeAxisIndex() - 1).setVisible(false);

        final Marker marker = new ValueMarker(0);
        marker.setPaint(Color.GRAY);
        marker.setStroke(new BasicStroke(1));
        plot.addRangeMarker(getRangeAxisIndex() - 1, marker, Layer.BACKGROUND);
    }//w  w w  .j  ava  2s. c o m
}

From source file:no.met.jtimeseries.chart.ChartPlotter.java

private void paintDomainGridLine(Calendar date, XYPlot plot) {

    long millis = date.getTimeInMillis();
    final Marker originalEnd = new ValueMarker(millis);
    originalEnd.setPaint(DOMAIN_GRID_LINE_COLOR);
    originalEnd.setStroke(new BasicStroke(1));
    plot.addDomainMarker(originalEnd, Layer.BACKGROUND);
}

From source file:no.met.jtimeseries.chart.ChartPlotter.java

/**
Add max min bar. Mainly used to show precipitation that has max and min values
* @param timeBase/*from  w w w.j av  a2  s . c  o  m*/
* @param title
* @param maxMinTimeSeriesEnabler
* @param maxColor
* @param minColor 
*/
public void addMaxMinPercipitationBars(TimeBase timeBase, String title, NumberPhenomenon max,
        NumberPhenomenon min, Color maxColor, Color minColor) {

    XYDataset maxDataset = max.getTimeSeries(title, timeBase);
    XYDataset minDataset = min.getTimeSeries(title, timeBase);
    if (maxDataset.getSeriesCount() > 0 && minDataset.getSeriesCount() > 0 && maxDataset.getItemCount(0) > 0
            && minDataset.getItemCount(0) > 0) {

        double margin = 0.2;
        double maxPrecipitation = max.getMaxValue();

        addBarChart(minDataset, "min", minColor, margin, maxPrecipitation);
        showBarValuesOnBottom(plotIndex - 1, 1D);

        rangeAxisIndex--;

        addBarChart(maxDataset, "max", maxColor, margin, maxPrecipitation);
        showBarValuesOnTop(plotIndex - 1, 6D);

        plot.getRangeAxis(getRangeAxisIndex() - 1).setVisible(false);

        final Marker marker = new ValueMarker(0);
        marker.setPaint(Color.GRAY);
        marker.setStroke(new BasicStroke(1));
        plot.addRangeMarker(getRangeAxisIndex() - 1, marker, Layer.BACKGROUND);
    }
}