Example usage for org.jfree.chart.axis NumberAxis setLowerBound

List of usage examples for org.jfree.chart.axis NumberAxis setLowerBound

Introduction

In this page you can find the example usage for org.jfree.chart.axis NumberAxis setLowerBound.

Prototype

public void setLowerBound(double min) 

Source Link

Document

Sets the lower bound for the axis range.

Usage

From source file:no.met.jtimeseries.marinogram.MarinogramCurrentPlot.java

private XYPlot createPlot(TimeZone timezone, boolean plotCurrentDirection, boolean plotCurrentSpeed) {
    ChartPlotter plotter = new ChartPlotter();
    // default setting
    plotter.setHeight(this.getHeight());
    plotter.setWidth(this.getWidth());
    plotter.setPlotDefaultProperties("", "");
    Color currentSpeedColor = new Color(142, 25, 131);
    Color currentDirectionColor = new Color(142, 25, 131);
    // plot style
    PlotStyle.Builder currentStyleBuilder = new PlotStyle.Builder("Current");
    PlotStyle plotStyle;//from  w  w  w.  j a v  a  2 s  . c om
    NumberPhenomenon currentDirection = getOceanForecastDataModel()
            .getPhenomenen(PhenomenonName.CurrentDirection.toString(), NumberPhenomenon.class);
    NumberPhenomenon currentSpeed = getOceanForecastDataModel()
            .getPhenomenen(PhenomenonName.CurrentSpeed.toString(), NumberPhenomenon.class);
    if (currentSpeed == null || currentDirection == null) {
        return null;
    }
    currentSpeed = currentSpeed.scaling(100);
    double tick = (currentSpeed.getMaxValue() - currentSpeed.getMinValue()) / 2;
    tick = Math.ceil(tick / 10) * 10;
    double lowBound = Math.floor(currentSpeed.getMinValue() / (tick)) * (tick);
    //The minimum scale is 0
    lowBound = lowBound < 0 ? 0 : lowBound;
    lowBound = lowBound - tick / 2;
    double upperBound = lowBound + tick * 4;

    // reference the range axis
    NumberAxis leftNumberAxis = new NumberAxis();
    leftNumberAxis.setLabel(messages.getString("parameter.current") + " (cm/s)");
    leftNumberAxis.setLabelPaint(currentSpeedColor);
    leftNumberAxis.setTickLabelPaint(currentSpeedColor);
    leftNumberAxis.setLowerBound(lowBound);
    leftNumberAxis.setUpperBound(upperBound);
    leftNumberAxis.setTickUnit(new NumberTickUnit(tick));

    NumberAxis rightNumberAxis = new NumberAxis();
    rightNumberAxis.setLabel(messages.getString("label.knots"));
    rightNumberAxis.setLabelPaint(currentSpeedColor);
    rightNumberAxis.setTickLabelPaint(currentSpeedColor);
    lowBound = lowBound / 100.0 / KNOT;
    upperBound = upperBound / 100.0 / KNOT;
    rightNumberAxis.setLowerBound(lowBound);
    rightNumberAxis.setUpperBound(upperBound);
    rightNumberAxis.setTickUnit(new NumberTickUnit(tick / 100.0 / KNOT));
    NumberFormat formatter = new DecimalFormat("#0.00");
    rightNumberAxis.setNumberFormatOverride(formatter);

    List<Date> shortTermTimeList = this.getShortTermTime(currentDirection.getTime().get(0));

    //set thte plot current speed color to be transparent if show current speed is false
    if (!plotCurrentSpeed) {
        currentSpeedColor = new Color(0, 0, 0, 0);
    }

    // plot style
    BasicStroke dottedStroke = new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 2.0f,
            new float[] { 2.0f, 6.0f }, 0.0f);
    plotStyle = currentStyleBuilder.spline(SplineStyle.HYBRID).stroke(dottedStroke)
            .seriesColor(currentSpeedColor).numberAxis(leftNumberAxis).nonNegative(true).build();

    //Draw the current direction even if plotCurrentSpeed is false (but with transparent in such a case)
    //for the purpose to keep the same background grid and tick label on the y-axis 
    //no matter the wave height is shown or not
    plotter.addLineChart(TimeBase.SECOND, currentSpeed, plotStyle);

    plotter.getPlot().setRangeAxis(1, rightNumberAxis);
    plotter.getPlot().setOutlineVisible(true);

    Date minDate = shortTermTimeList.get(0);
    Date maxDate = shortTermTimeList.get(shortTermTimeList.size() - 1);
    plotter.setDomainRange(minDate, maxDate);
    plotter.setDomainDateFormat(timezone, "HH");
    // set domain range after (must) plot all the data
    plotter.addHourBasedDomainGridLines();
    // invisible domain axis
    plotter.getPlot().getDomainAxis().setTickLabelsVisible(false);
    // add markers
    plotter.addDomainMarkers(shortTermTimeList, timezone, locale);

    if (plotCurrentDirection) {
        List<Date> symbolTimes = Utility.filterMinimumHourInterval(currentDirection.getTime(), 2, 1);
        InListFromDateFilter symbolTimesFilter = new InListFromDateFilter(symbolTimes);
        currentDirection.filter(symbolTimesFilter);
        currentSpeed = null;
        if (plotCurrentSpeed) {
            currentSpeed = getOceanForecastDataModel().getPhenomenen(PhenomenonName.CurrentSpeed.toString(),
                    NumberPhenomenon.class);
            currentSpeed.filter(symbolTimesFilter);
            currentSpeed = currentSpeed.scaling(1 / 100.0 / KNOT);
        }

        plotStyle = currentStyleBuilder.seriesColor(currentDirectionColor).build();
        plotter.addArrowDirectionPlot(currentDirection, currentSpeed, 2, plotStyle);
    }
    plotter.getPlot().setRangeZeroBaselineVisible(false);

    return plotter.getPlot();

}

From source file:org.vast.stt.renderer.JFreeChart.XYPlotBuilder.java

public void createPlot(ChartScene scene) {
    this.scene = scene; //  scene contains the axis info, so passing it in here for now

    datasetCount = 0;// w  ww  .  ja  v  a2s. c o  m
    rangeAxisCount = 0;
    currentItem = null;
    axisTable.clear();
    plot = new XYPlot();

    plot.setBackgroundPaint(Color.lightGray);
    plot.setDomainGridlinePaint(Color.white);
    plot.setRangeGridlinePaint(Color.white);

    String axisName = "Time (s)";
    NumberAxis domainAxis = new NumberAxis(axisName);
    domainAxis.setAutoRangeIncludesZero(false);
    domainAxis.setAutoRange(false);
    domainAxis.setNumberFormatOverride(new DateFormat());
    domainAxis.setTickLabelInsets(new RectangleInsets(0, 30, 0, 30));
    domainAxis.setLowerBound(scene.getDomainMin());
    domainAxis.setUpperBound(scene.getDomainMax());
    plot.setDomainAxis(datasetCount, domainAxis);
}

From source file:net.sf.maltcms.chromaui.chromatogram2Dviewer.ui.Chromatogram2DViewTopComponent.java

private XYPlot createPlot(IChromatogramDescriptor chromatogram, ADataset2D<IChromatogram2D, IScan2D> ds,
        PaintScale ps) {//from   ww w .j  av a  2 s .  c  o  m
    XYNoBlockRenderer xybr = new XYNoBlockRenderer();
    xybr.setPaintScale(ps);
    try {
        double modulationTime = chromatogram.getChromatogram().getParent().getChild("modulation_time")
                .getArray().getDouble(0);
        double scanRate = chromatogram.getChromatogram().getParent().getChild("scan_rate").getArray()
                .getDouble(0);
        xybr.setDefaultEntityRadius(10);//Math.max(1, (int)(modulationTime / scanRate)));
        xybr.setEntityThreshold(ds.getMinZ());
        xybr.setBlockWidth(modulationTime);
        xybr.setBlockAnchor(RectangleAnchor.CENTER);
        double spm = modulationTime * scanRate;
        double scanDuration = modulationTime / spm;
        xybr.setBlockHeight(scanDuration);
    } catch (ResourceNotAvailableException rnae) {
    }
    RTUnit rtUnit = RTUnit.SECONDS;
    xybr.setToolTipGenerator(
            new StandardXYZToolTipGenerator("{0}: @({1}, {2}) = {3}", DecimalFormat.getNumberInstance(),
                    DecimalFormat.getNumberInstance(), DecimalFormat.getNumberInstance()));
    NumberAxis rt1 = new NumberAxis("RT1 [" + rtUnit.name().toLowerCase() + "]");
    NumberAxis rt2 = new NumberAxis("RT2 [" + rtUnit.name().toLowerCase() + "]");
    rt1.setAutoRange(false);
    rt1.setLowerBound(ds.getMinX());
    rt1.setUpperBound(ds.getMaxX());
    rt1.setRangeWithMargins(ds.getMinX(), ds.getMaxX());
    rt2.setFixedAutoRange(ds.getMaxX() - ds.getMinX());
    rt2.setAutoRange(false);
    rt2.setLowerBound(ds.getMinY());
    rt2.setUpperBound(ds.getMaxY());
    rt2.setFixedAutoRange(ds.getMaxY() - ds.getMinY());
    rt2.setRangeWithMargins(ds.getMinY(), ds.getMaxY());
    XYPlot heatmapPlot = new XYPlot(ds, rt1, rt2, xybr);
    heatmapPlot.setDomainPannable(true);
    heatmapPlot.setRangePannable(true);
    return heatmapPlot;
}

From source file:org.vast.stt.renderer.JFreeChart.XYPlotBuilder.java

public void addAxisToPlot(DataItem item) {
    String axisName = item.getName();
    NumberAxis rangeAxis = new NumberAxis(axisName);
    rangeAxis.setAutoRangeIncludesZero(false);
    rangeAxis.setAutoRange(false);//w  w w  .  j  a va  2  s  .com
    NumberFormat format = NumberFormat.getNumberInstance();
    format.setMaximumFractionDigits(2);
    rangeAxis.setNumberFormatOverride(format);
    rangeAxis.setLowerBound(scene.getRangeMin());
    rangeAxis.setUpperBound(scene.getRangeMax());
    plot.setRangeAxis(rangeAxisCount, rangeAxis);
    axisTable.put(item, rangeAxisCount);
    rangeAxisCount++;
}

From source file:hudson.plugins.robot.graph.RobotGraph.java

/**
 * Creates a Robot trend graph// w  w w  .  j  av a  2s . c om
 * @return the JFreeChart graph object
 */
protected JFreeChart createGraph() {

    final JFreeChart chart = ChartFactory.createStackedAreaChart(null, null, yLabel, categoryDataset,
            PlotOrientation.VERTICAL, true, true, false);

    final LegendTitle legend = chart.getLegend();
    legend.setPosition(RectangleEdge.RIGHT);

    chart.setBackgroundPaint(Color.white);

    final CategoryPlot plot = (CategoryPlot) chart.getPlot();
    plot.setForegroundAlpha(0.7f);
    plot.setBackgroundPaint(Color.white);
    plot.setRangeGridlinePaint(Color.darkGray);

    final CategoryAxis domainAxis = new ShiftedCategoryAxis(xLabel);
    domainAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_45);
    domainAxis.setLowerMargin(0.0);
    domainAxis.setUpperMargin(0.0);
    domainAxis.setCategoryMargin(0.0);
    plot.setDomainAxis(domainAxis);

    final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    if (binaryData) {
        rangeAxis.setUpperBound(1);
    } else if (upperBound != 0) {
        rangeAxis.setUpperBound(upperBound);
    } else {
        rangeAxis.setAutoRange(true);
    }
    rangeAxis.setLowerBound(lowerBound);
    Font font = new Font("Dialog", Font.PLAIN, fontSize);
    plot.getDomainAxis().setLabelFont(font);
    plot.getDomainAxis().setTickLabelFont(font);
    plot.getRangeAxis().setLabelFont(font);
    plot.getRangeAxis().setTickLabelFont(font);
    legend.setItemFont(font);
    final CategoryItemRenderer renderer = plot.getRenderer();

    for (int i = 0; i < colors.length; i++) {
        renderer.setSeriesPaint(i, colors[i]);
    }

    plot.setInsets(new RectangleInsets(15.0, 0, 0, 5.0));

    return chart;
}

From source file:net.praqma.jenkins.memorymap.MemoryMapBuildAction.java

protected JFreeChart createPairedBarCharts(String title, String yaxis, double max, double min,
        CategoryDataset dataset, List<ValueMarker> markers) {
    final CategoryAxis domainAxis = new ShiftedCategoryAxis(null);
    final NumberAxis rangeAxis = new NumberAxis(yaxis);
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    rangeAxis.setUpperBound(max);/*from   w w  w  . java  2  s .c o m*/
    rangeAxis.setLowerBound(min);
    /*TODO : wrong scale choosen - Jes
     * if the user selects Mega or Giga as the scale, but there only are 
     * a couple of Kilo in the graph it would have no ticks on the axis.
     * this can be solved by. redefining the ticks,
     * We have not done this because it's a bit tricky to figure out the rigth 
     * factor to devid with
     * 
     * but the method wuld be 
     * double factor = 10
     * rangeAxis.setStandardTickUnits(new StandardTickUnitSource(max / factor));
     */

    //StackedAreaRenderer2 renderer = new StackedAreaRenderer2();
    BarRenderer renderer = new BarRenderer();

    CategoryPlot plot = new CategoryPlot(dataset, domainAxis, rangeAxis, renderer);
    plot.setDomainAxis(domainAxis);
    domainAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_90);

    plot.setOrientation(PlotOrientation.VERTICAL);
    plot.setBackgroundPaint(Color.WHITE);
    plot.setOutlinePaint(null);
    plot.setRangeGridlinesVisible(true);
    plot.setRangeGridlinePaint(Color.black);

    for (ValueMarker mkr : markers) {
        plot.addRangeMarker(mkr);
    }

    JFreeChart chart = new JFreeChart(plot);
    chart.setPadding(new RectangleInsets(30, 15, 15, 15));
    chart.setTitle(title);
    return chart;
}

From source file:no.met.jtimeseries.marinogram.MarinogramTemperaturePlot.java

private XYPlot createPlot(TimeZone timezone, boolean plotAirTemp, boolean plotWaterTemp,
        boolean plotDewpointTemp) throws ParseException {
    Date startTime = null;// ww w .ja v a  2 s .com
    NumberPhenomenon aTemperature = null;
    NumberPhenomenon wTemperature = null;
    NumberPhenomenon dTemperature = null;
    // default setting
    ChartPlotter plotter = new ChartPlotter();
    plotter.setHeight(this.getHeight());
    plotter.setWidth(this.getWidth());
    plotter.setPlotDefaultProperties("", "");

    double minValue = 100;
    double maxValue = -100;
    int plotIndex = 0;
    if (plotAirTemp) {
        aTemperature = getLocationForecastDataModel().getPhenomenen(PhenomenonName.AirTemperature.toString(),
                NumberPhenomenon.class);
        minValue = aTemperature.getMinValue() < minValue ? aTemperature.getMinValue() : minValue;
        maxValue = aTemperature.getMaxValue() > maxValue ? aTemperature.getMaxValue() : maxValue;
        startTime = aTemperature.getTime().get(0);
        plotTemperature(plotter, aTemperature, new BasicStroke(2.0f), Color.RED,
                messages.getString("label.air"), true);
        plotter.getPlot().getRenderer(plotIndex).setSeriesVisibleInLegend(0, true);
        plotter.getPlot().getRenderer(plotIndex).setSeriesVisibleInLegend(1, true);
        plotIndex++;
    }

    if (plotWaterTemp) {
        wTemperature = getOceanForecastDataModel().getPhenomenen(PhenomenonName.seaTemperature.toString(),
                NumberPhenomenon.class);
        // only plot water temperature if it is availbe for this location
        if (wTemperature != null) {
            minValue = wTemperature.getMinValue() < minValue ? wTemperature.getMinValue() : minValue;
            maxValue = wTemperature.getMaxValue() > maxValue ? wTemperature.getMaxValue() : maxValue;
            startTime = wTemperature.getTime().get(0);
            BasicStroke dottedStroke = new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND,
                    1.0f, new float[] { 2.0f, 6.0f }, 0.0f);
            plotTemperature(plotter, wTemperature, dottedStroke, Color.RED, messages.getString("label.water"),
                    true);
            plotter.getPlot().getRenderer(plotIndex++).setSeriesVisibleInLegend(0, true);
        }
    }

    if (plotDewpointTemp) {
        dTemperature = getLocationForecastDataModel()
                .getPhenomenen(PhenomenonName.dewPointTemperature.toString(), NumberPhenomenon.class);
        minValue = dTemperature.getMinValue() < minValue ? dTemperature.getMinValue() : minValue;
        maxValue = dTemperature.getMaxValue() > maxValue ? dTemperature.getMaxValue() : maxValue;
        startTime = dTemperature.getTime().get(0);
        plotTemperature(plotter, dTemperature, new BasicStroke(2.0f), Color.ORANGE,
                messages.getString("label.dewpoint"), false);
        plotter.getPlot().getRenderer(plotIndex).setSeriesVisibleInLegend(0, true);
    }

    double tick = (maxValue - minValue) / 3.5;
    tick = Math.ceil(tick);
    double lowBound = Math.floor(minValue / (tick)) * (tick);
    lowBound = lowBound - tick / 2;
    double upperBound = lowBound + tick * 7;

    // set range axis
    NumberAxis numberAxis = new NumberAxis();
    numberAxis.setLabelPaint(Color.RED);
    numberAxis.setTickLabelPaint(Color.RED);
    numberAxis.setLabel(messages.getString("parameter.temperature") + " (\u00B0 C)");
    numberAxis.setTickUnit(new NumberTickUnit(tick));
    numberAxis.setLowerBound(lowBound);
    numberAxis.setUpperBound(upperBound);

    //Set left axis and right axis
    plotter.getPlot().setRangeAxis(0, numberAxis);
    plotter.getPlot().setRangeAxis(1, numberAxis);
    //Set the third axis and hide the third axis
    if (plotAirTemp && plotWaterTemp && plotDewpointTemp) {
        NumberAxis numberAxis2 = new NumberAxis();
        numberAxis2.setTickUnit(new NumberTickUnit(tick));
        numberAxis2.setLowerBound(lowBound);
        numberAxis2.setUpperBound(upperBound);
        plotter.getPlot().setRangeAxis(2, numberAxis2);
        plotter.getPlot().getRangeAxis(2).setVisible(false);
    }

    //Show legend at the top right position of the plot
    LegendTitle lt = new LegendTitle(plotter.getPlot());
    lt.setItemFont(new Font("Dialog", Font.PLAIN, 9));
    lt.setBackgroundPaint(new Color(255, 255, 255, 100));
    lt.setFrame(new BlockBorder(Color.white));
    lt.setPosition(RectangleEdge.TOP);
    XYTitleAnnotation ta = new XYTitleAnnotation(0.99, 0.95, lt, RectangleAnchor.TOP_RIGHT);
    plotter.getPlot().addAnnotation(ta);

    // set domain range after (must) plot all the data
    plotter.addHourBasedDomainGridLines();
    // add markers
    plotter.addDomainMarkers(getShortTermTime(startTime), timezone, locale);
    Date minDate = getShortTermTime(startTime).get(0);
    Date maxDate = getShortTermTime(startTime).get(getShortTermTime(startTime).size() - 1);
    plotter.setDomainRange(minDate, maxDate);
    plotter.setDomainDateFormat(timezone, "HH");
    plotter.getPlot().setOutlineVisible(true);
    // invisible the domain i.e, x axis
    plotter.getPlot().getDomainAxis().setTickLabelsVisible(false);

    return plotter.getPlot();

}

From source file:net.praqma.jenkins.memorymap.MemoryMapBuildAction.java

protected JFreeChart createChart(CategoryDataset dataset, String title, String yaxis, int max, int min) {
    final JFreeChart chart = ChartFactory.createStackedAreaChart(title, // chart                                                                                                                                       // title
            null, // unused
            yaxis, // range axis label
            dataset, // data
            PlotOrientation.VERTICAL, // orientation
            true, // include legend
            true, // tooltips
            false // urls
    );/*from  w w w  .j a v  a  2 s. c o  m*/

    final LegendTitle legend = chart.getLegend();

    legend.setPosition(RectangleEdge.BOTTOM);

    chart.setBackgroundPaint(Color.white);

    final CategoryPlot plot = chart.getCategoryPlot();

    plot.setBackgroundPaint(Color.WHITE);
    plot.setOutlinePaint(null);
    plot.setRangeGridlinesVisible(true);
    plot.setRangeGridlinePaint(Color.black);

    CategoryAxis domainAxis = new ShiftedCategoryAxis(null);
    plot.setDomainAxis(domainAxis);
    domainAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_90);
    domainAxis.setLowerMargin(0.0);
    domainAxis.setUpperMargin(0.0);
    domainAxis.setCategoryMargin(0.0);

    final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    rangeAxis.setUpperBound(max);
    rangeAxis.setLowerBound(min);

    final StackedAreaRenderer renderer = (StackedAreaRenderer) plot.getRenderer();
    renderer.setBaseStroke(new BasicStroke(2.0f));
    plot.setInsets(new RectangleInsets(5.0, 0, 0, 5.0));
    return chart;
}

From source file:desmoj.extensions.grafic.util.Plotter.java

/**
 * configure range axis ( lowerBound, upperBound, label, format ticks)
 * of time-series chart/*from  ww w . ja  v  a2s  .  c o  m*/
 * @param numberAxis
 * @param label
 */
private void configureRangeAxis(NumberAxis numberAxis, String label) {
    double min = numberAxis.getLowerBound();
    double max = numberAxis.getUpperBound();
    Double delta = 0.01 * (max - min);
    numberAxis.setLowerBound(min - delta);
    numberAxis.setUpperBound(max + delta);

    numberAxis.setLabel(label);

    // format Ticks
    double fontHeight = numberAxis.getTickLabelFont().getLineMetrics("X", this.frc).getHeight();
    double maxTicks = this.paintPanel.getSize().height / fontHeight;
    int digits = Math.max(0, (int) -Math.floor(Math.log10((max - min) / maxTicks)));
    //System.out.println(fontHeight+"  "+digits+"  "+Math.log10((max - min)/ maxTicks));
    NumberFormat formatter = NumberFormat.getNumberInstance(this.locale);
    formatter.setMinimumFractionDigits(digits);
    formatter.setMaximumFractionDigits(digits);
    formatter.setGroupingUsed(true);
    numberAxis.setNumberFormatOverride(formatter);
}

From source file:no.met.jtimeseries.marinogram.MarinogramWindPlot.java

private XYPlot createPlot(TimeZone timezone, boolean plotWindDirection, boolean plotWindSpeed) {
    ChartPlotter plotter = new ChartPlotter();
    // default setting
    plotter.setHeight(this.getHeight());
    plotter.setWidth(this.getWidth());
    plotter.setPlotDefaultProperties("", "");
    Color windSpeedColor = new Color(0, 0, 0);
    Color windDirectionColor = new Color(0, 0, 0);
    // plot style
    PlotStyle.Builder currentStyleBuilder = new PlotStyle.Builder("Wind");
    PlotStyle plotStyle;/* w  ww .  j a  va 2 s.  c o  m*/
    NumberPhenomenon windDirection = getLocationForecastDataModel()
            .getPhenomenen(PhenomenonName.WindDirectionDegree.toString(), NumberPhenomenon.class);
    NumberPhenomenon windSpeed = getLocationForecastDataModel()
            .getPhenomenen(PhenomenonName.WindSpeedMPS.toString(), NumberPhenomenon.class);
    if (windSpeed == null || windDirection == null) {
        return null;
    }

    double tick = (windSpeed.getMaxValue() - windSpeed.getMinValue()) / 3;
    tick = Math.ceil(tick);
    double lowBound = Math.floor(windSpeed.getMinValue() / (tick)) * (tick);
    //The minimum scale is 0
    lowBound = lowBound < 0 ? 0 : lowBound;
    lowBound = lowBound - tick / 2;
    double upperBound = lowBound + tick * 6;

    // reference the range axis
    NumberAxis leftNumberAxis = new NumberAxis();
    leftNumberAxis.setLabel(messages.getString("parameter.wind") + " (m/s)");
    leftNumberAxis.setLabelPaint(windSpeedColor);
    leftNumberAxis.setTickLabelPaint(windSpeedColor);
    //int tickUnit = (int) Math.ceil((upperBound - lowBound) / 6);
    leftNumberAxis.setTickUnit(new NumberTickUnit(tick));
    leftNumberAxis.setLowerBound(lowBound);
    leftNumberAxis.setUpperBound(upperBound);

    NumberAxis rightNumberAxis = new NumberAxis();
    rightNumberAxis.setLabel(messages.getString("label.knots"));
    rightNumberAxis.setLabelPaint(windSpeedColor);
    rightNumberAxis.setTickLabelPaint(windSpeedColor);
    lowBound = lowBound / KNOT;
    upperBound = upperBound / KNOT;
    rightNumberAxis.setLowerBound(lowBound);
    rightNumberAxis.setUpperBound(upperBound);
    rightNumberAxis.setTickUnit(new NumberTickUnit(tick / KNOT));
    NumberFormat formatter = new DecimalFormat("#0.0");
    rightNumberAxis.setNumberFormatOverride(formatter);

    List<Date> shortTermTimeList = this.getShortTermTime(windDirection.getTime().get(0));

    // set thte plot current speed color to be transparent if show current
    // speed is false
    if (!plotWindSpeed) {
        windSpeedColor = new Color(0, 0, 0, 0);
    }

    // plot style
    plotStyle = currentStyleBuilder.spline(SplineStyle.HYBRID).stroke(new BasicStroke(2.0f))
            .seriesColor(windSpeedColor).numberAxis(leftNumberAxis).nonNegative(true).build();

    // Draw the current direction even if plotCurrentSpeed is false (but
    // with transparent in such a case)
    // for the purpose to keep the same background grid and tick label on
    // the y-axis
    // no matter the wave height is shown or not
    plotter.addLineChart(TimeBase.SECOND, windSpeed, plotStyle);

    plotter.getPlot().setRangeAxis(1, rightNumberAxis);
    plotter.getPlot().setOutlineVisible(true);

    Date minDate = shortTermTimeList.get(0);
    Date maxDate = shortTermTimeList.get(shortTermTimeList.size() - 1);
    plotter.setDomainRange(minDate, maxDate);
    plotter.setDomainDateFormat(timezone, "HH");
    // set domain range after (must) plot all the data
    plotter.addHourBasedDomainGridLines();
    // invisible domain axis
    plotter.getPlot().getDomainAxis().setTickLabelsVisible(false);
    // add markers
    plotter.addDomainMarkers(shortTermTimeList, timezone, locale);

    if (plotWindDirection) {
        List<Date> symbolTimes = Utility.filterMinimumHourInterval(windDirection.getTime(), 2, 1);
        InListFromDateFilter symbolTimesFilter = new InListFromDateFilter(symbolTimes);
        windDirection.filter(symbolTimesFilter);
        windSpeed = null;
        if (plotWindSpeed) {
            windSpeed = getLocationForecastDataModel().getPhenomenen(PhenomenonName.WindSpeedMPS.toString(),
                    NumberPhenomenon.class);
            windSpeed.filter(symbolTimesFilter);
            windSpeed = windSpeed.scaling(1 / KNOT);
        }

        plotStyle = currentStyleBuilder.seriesColor(windDirectionColor).build();
        // when plot wind direction, the arrow should be rotated 180 degree
        windDirection = windDirection.transform(180);
        plotter.addArrowDirectionPlot(windDirection, windSpeed, 2, plotStyle);
        // transform back after plot
        windDirection = windDirection.transform(180);
    }
    plotter.getPlot().setRangeZeroBaselineVisible(false);

    return plotter.getPlot();

}