Example usage for java.awt Color decode

List of usage examples for java.awt Color decode

Introduction

In this page you can find the example usage for java.awt Color decode.

Prototype

public static Color decode(String nm) throws NumberFormatException 

Source Link

Document

Converts a String to an integer and returns the specified opaque Color .

Usage

From source file:com.alkacon.opencms.survey.CmsFormReportingBean.java

/**
 * Returns a lazy initialized map that provides the color of the label for each background color used as a key in the Map.<p> 
 * /*from   w w  w .j a  v a 2  s. c om*/
 * Dark background color returns white.<p>
 * Light background color returns black.<p>
 * 
 * @return a lazy initialized map
 */
public Map getTextColor() {

    if (m_color == null) {
        m_color = LazyMap.decorate(new HashMap(), new Transformer() {

            /**
             * @see org.apache.commons.collections.Transformer#transform(java.lang.Object)
             */
            public Object transform(Object input) {

                try {
                    // get the color from the given value
                    String value = String.valueOf(input);
                    Color color = Color.decode(value);

                    // look if its a dark color or a light
                    int dezColor = color.getBlue() + color.getGreen() + color.getRed();
                    if (dezColor < SEP_DARK_LIGHT) {
                        return "#FFF";
                    }

                } catch (Exception e) {
                    // NOOP
                }
                return "#000";
            }
        });
    }
    return m_color;
}

From source file:userinterface.CountryNetworkAdminRole.CountryReportsJPanel.java

private JFreeChart createDonorsByStateReportsChart(CategoryDataset dataset) {
    JFreeChart barChart = ChartFactory.createBarChart("No Of Registered Donors by State", "State",
            " No Of Registered Donors", dataset, PlotOrientation.VERTICAL, true, true, false);
    barChart.setBackgroundPaint(Color.white);
    // Set the background color of the chart
    barChart.getTitle().setPaint(Color.DARK_GRAY);
    barChart.setBorderVisible(true);//from   www .  j a v  a 2s.c o  m
    // Adjust the color of the title
    CategoryPlot plot = barChart.getCategoryPlot();
    plot.getRangeAxis().setLowerBound(0.0);
    // Get the Plot object for a bar graph
    plot.setBackgroundPaint(Color.white);
    plot.setRangeGridlinePaint(Color.blue);
    CategoryItemRenderer renderer = plot.getRenderer();
    renderer.setSeriesPaint(0, Color.decode("#00008B"));
    //return chart;
    return barChart;
}

From source file:de.tsystems.mms.apm.performancesignature.PerfSigBuildActionResultsDisplay.java

private JFreeChart createXYLineChart(final StaplerRequest req, final XYDataset dataset)
        throws UnsupportedEncodingException {
    final String chartDashlet = req
            .getParameter(Messages.PerfSigBuildActionResultsDisplay_ReqParamChartDashlet());
    final String measure = req.getParameter(Messages.PerfSigBuildActionResultsDisplay_ReqParamMeasure());
    final String unit = req.getParameter(Messages.PerfSigBuildActionResultsDisplay_ReqParamUnit());
    String color = req.getParameter(Messages.PerfSigBuildActionResultsDisplay_ReqParamColor());
    if (StringUtils.isBlank(color))
        color = Messages.PerfSigBuildActionResultsDisplay_DefaultColor();
    else//from w  ww  .j a va  2  s.co  m
        URLDecoder.decode(req.getParameter(Messages.PerfSigBuildActionResultsDisplay_ReqParamColor()), "UTF-8");

    final JFreeChart chart = ChartFactory.createXYLineChart(
            PerfSigUtils.generateTitle(measure, chartDashlet).replaceAll("\\d+\\w", ""), // title
            "%", // category axis label
            unit, // value axis label
            dataset, // data
            PlotOrientation.VERTICAL, // orientation
            false, // include legend
            true, // tooltips
            false // urls
    );
    final XYPlot xyPlot = chart.getXYPlot();
    xyPlot.setForegroundAlpha(0.8f);
    xyPlot.setRangeGridlinesVisible(true);
    xyPlot.setRangeGridlinePaint(Color.black);
    xyPlot.setOutlinePaint(null);

    final XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) xyPlot.getRenderer();
    renderer.setSeriesPaint(0, Color.decode(color));
    renderer.setSeriesStroke(0, new BasicStroke(2));

    chart.setBackgroundPaint(Color.white);
    return chart;
}

From source file:au.org.ala.biocache.web.MapController.java

@Deprecated
@RequestMapping(value = "/occurrences/wms", method = RequestMethod.GET)
public void pointsWmsImage(SpatialSearchRequestParams requestParams,
        @RequestParam(value = "colourby", required = false, defaultValue = "0") Integer colourby,
        @RequestParam(value = "width", required = false, defaultValue = "256") Integer widthObj,
        @RequestParam(value = "height", required = false, defaultValue = "256") Integer heightObj,
        @RequestParam(value = "zoom", required = false, defaultValue = "0") Integer zoomLevel,
        @RequestParam(value = "symsize", required = false, defaultValue = "4") Integer symsize,
        @RequestParam(value = "symbol", required = false, defaultValue = "circle") String symbol,
        @RequestParam(value = "bbox", required = false, defaultValue = "110,-45,157,-9") String bboxString,
        @RequestParam(value = "type", required = false, defaultValue = "normal") String type,
        @RequestParam(value = "outline", required = true, defaultValue = "false") boolean outlinePoints,
        @RequestParam(value = "outlineColour", required = true, defaultValue = "0x000000") String outlineColour,
        HttpServletResponse response) throws Exception {

    // size of the circles
    int size = symsize.intValue();
    int width = widthObj.intValue();
    int height = heightObj.intValue();

    requestParams.setStart(0);//from w w  w .ja v a  2 s . co  m
    requestParams.setPageSize(Integer.MAX_VALUE);
    String query = requestParams.getQ();
    String[] filterQuery = requestParams.getFq();

    if (StringUtils.isBlank(query) && StringUtils.isBlank(requestParams.getFormattedQuery())) {
        displayBlankImage(width, height, false, response);
        return;
    }

    // let's force it to PNG's for now 
    response.setContentType("image/png");

    // Convert array to list so we append more values onto it
    ArrayList<String> fqList = null;
    if (filterQuery != null) {
        fqList = new ArrayList<String>(Arrays.asList(filterQuery));
    } else {
        fqList = new ArrayList<String>();
    }

    // the bounding box
    double[] bbox = new double[4];
    int i;
    i = 0;
    for (String s : bboxString.split(",")) {
        try {
            bbox[i] = Double.parseDouble(s);
            i++;
        } catch (Exception e) {
            logger.error(e.getMessage(), e);
        }
    }

    double pixelWidth = (bbox[2] - bbox[0]) / width;
    double pixelHeight = (bbox[3] - bbox[1]) / height;
    bbox[0] += pixelWidth / 2;
    bbox[2] -= pixelWidth / 2;
    bbox[1] += pixelHeight / 2;
    bbox[3] -= pixelHeight / 2;

    //offset for points bounding box by size
    double xoffset = (bbox[2] - bbox[0]) / (double) width * (size * 2);
    double yoffset = (bbox[3] - bbox[1]) / (double) height * (size * 2);

    //adjust offset for pixel height/width
    xoffset += pixelWidth;
    yoffset += pixelHeight;

    double[] bbox2 = new double[4];
    bbox2[0] = convertMetersToLng(bbox[0] - xoffset);
    bbox2[1] = convertMetersToLat(bbox[1] - yoffset);
    bbox2[2] = convertMetersToLng(bbox[2] + xoffset);
    bbox2[3] = convertMetersToLat(bbox[3] + yoffset);

    bbox[0] = convertMetersToLng(bbox[0]);
    bbox[1] = convertMetersToLat(bbox[1]);
    bbox[2] = convertMetersToLng(bbox[2]);
    bbox[3] = convertMetersToLat(bbox[3]);

    double[] pbbox = new double[4]; //pixel bounding box
    pbbox[0] = convertLngToPixel(bbox[0]);
    pbbox[1] = convertLatToPixel(bbox[1]);
    pbbox[2] = convertLngToPixel(bbox[2]);
    pbbox[3] = convertLatToPixel(bbox[3]);

    String bboxString2 = bbox2[0] + "," + bbox2[1] + "," + bbox2[2] + "," + bbox2[3];
    bboxToQuery(bboxString2, fqList);

    PointType pointType = getPointTypeForZoomLevel(zoomLevel);

    String[] newFilterQuery = (String[]) fqList.toArray(new String[fqList.size()]); // convert back to array

    requestParams.setFq(newFilterQuery);

    List<OccurrencePoint> points = searchDAO.getFacetPoints(requestParams, pointType);
    logger.debug("Points search for " + pointType.getLabel() + " - found: " + points.size());

    if (points.size() == 0) {
        displayBlankImage(width, height, false, response);
        return;
    }

    BufferedImage img = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
    Graphics2D g = (Graphics2D) img.getGraphics();
    g.setColor(Color.RED);

    int x, y;
    int pointWidth = size * 2;
    double width_mult = (width / (pbbox[2] - pbbox[0]));
    double height_mult = (height / (pbbox[1] - pbbox[3]));

    g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);

    Color oColour = Color.decode(outlineColour);

    for (i = 0; i < points.size(); i++) {
        OccurrencePoint pt = points.get(i);
        float lng = pt.getCoordinates().get(0).floatValue();
        float lat = pt.getCoordinates().get(1).floatValue();

        x = (int) ((convertLngToPixel(lng) - pbbox[0]) * width_mult);
        y = (int) ((convertLatToPixel(lat) - pbbox[3]) * height_mult);

        if (colourby != null) {
            int colour = 0xFF000000 | colourby.intValue();
            Color c = new Color(colour);
            g.setPaint(c);
        } else {
            g.setPaint(Color.blue);
        }

        // g.fillOval(x - (size / 2), y - (size / 2), pointWidth, pointWidth);
        Shape shp = getShape(symbol, x - (size / 2), y - (size / 2), pointWidth, pointWidth);
        g.draw(shp);
        g.fill(shp);
        if (outlinePoints) {
            g.setPaint(oColour);
            g.drawOval(x - (size / 2), y - (size / 2), pointWidth, pointWidth);
        }
    }

    g.dispose();

    try {
        ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
        ImageIO.write(img, "png", outputStream);
        ServletOutputStream outStream = response.getOutputStream();
        outStream.write(outputStream.toByteArray());
        outStream.flush();
        outStream.close();

    } catch (Exception e) {
        logger.error("Unable to write image", e);
    }
}

From source file:org.apache.uima.ruta.engine.StyleMapFactory.java

private Color parseColorForeground(String color) {
    if (color.startsWith("#")) {
        return Color.decode(color);
    } else {//from  w  ww  .j  a v  a 2s  .  c  om
        String string = (String) colorNameMap.get(color);
        if (string != null)
            return Color.decode(string);
        else
            return Color.BLACK;
    }
}

From source file:org.bitbucket.mlopatkin.android.logviewer.Configuration.java

private static Color parseColor(String key, Color defaultValue) {
    String colorValue = instance.properties.getProperty(key);
    if (colorValue == null) {
        return defaultValue;
    }/*from www  .  jav a2s. c om*/
    try {
        return Color.decode(colorValue);
    } catch (NumberFormatException e) {
        logger.warn("Incorrect color format in " + key, e);
        return defaultValue;
    }
}

From source file:ShowComponent.java

/**
 * This method loops through the command line arguments looking for class
 * names of components to create and property settings for those components
 * in the form name=value. This method demonstrates reflection and JavaBeans
 * introspection as they can be applied to dynamically created GUIs
 *///w  ww . jav a  2  s.co m
public static Vector getComponentsFromArgs(String[] args) {
    Vector components = new Vector(); // List of components to return
    Component component = null; // The current component
    PropertyDescriptor[] properties = null; // Properties of the component
    Object[] methodArgs = new Object[1]; // We'll use this below

    nextarg: // This is a labeled loop
    for (int i = 0; i < args.length; i++) { // Loop through all arguments
        // If the argument does not contain an equal sign, then it is
        // a component class name. Otherwise it is a property setting
        int equalsPos = args[i].indexOf('=');
        if (equalsPos == -1) { // Its the name of a component
            try {
                // Load the named component class
                Class componentClass = Class.forName(args[i]);
                // Instantiate it to create the component instance
                component = (Component) componentClass.newInstance();
                // Use JavaBeans to introspect the component
                // And get the list of properties it supports
                BeanInfo componentBeanInfo = Introspector.getBeanInfo(componentClass);
                properties = componentBeanInfo.getPropertyDescriptors();
            } catch (Exception e) {
                // If any step failed, print an error and exit
                System.out.println("Can't load, instantiate, " + "or introspect: " + args[i]);
                System.exit(1);
            }

            // If we succeeded, store the component in the vector
            components.addElement(component);
        } else { // The arg is a name=value property specification
            String name = args[i].substring(0, equalsPos); // property name
            String value = args[i].substring(equalsPos + 1); // property
            // value

            // If we don't have a component to set this property on, skip!
            if (component == null)
                continue nextarg;

            // Now look through the properties descriptors for this
            // component to find one with the same name.
            for (int p = 0; p < properties.length; p++) {
                if (properties[p].getName().equals(name)) {
                    // Okay, we found a property of the right name.
                    // Now get its type, and the setter method
                    Class type = properties[p].getPropertyType();
                    Method setter = properties[p].getWriteMethod();

                    // Check if property is read-only!
                    if (setter == null) {
                        System.err.println("Property " + name + " is read-only");
                        continue nextarg; // continue with next argument
                    }

                    // Try to convert the property value to the right type
                    // We support a small set of common property types here
                    // Store the converted value in an Object[] so it can
                    // be easily passed when we invoke the property setter
                    try {
                        if (type == String.class) { // no conversion needed
                            methodArgs[0] = value;
                        } else if (type == int.class) { // String to int
                            methodArgs[0] = Integer.valueOf(value);
                        } else if (type == boolean.class) { // to boolean
                            methodArgs[0] = Boolean.valueOf(value);
                        } else if (type == Color.class) { // to Color
                            methodArgs[0] = Color.decode(value);
                        } else if (type == Font.class) { // String to Font
                            methodArgs[0] = Font.decode(value);
                        } else {
                            // If we can't convert, ignore the property
                            System.err
                                    .println("Property " + name + " is of unsupported type " + type.getName());
                            continue nextarg;
                        }
                    } catch (Exception e) {
                        // If conversion failed, continue with the next arg
                        System.err.println("Can't convert  '" + value + "' to type " + type.getName()
                                + " for property " + name);
                        continue nextarg;
                    }

                    // Finally, use reflection to invoke the property
                    // setter method of the component we created, and pass
                    // in the converted property value.
                    try {
                        setter.invoke(component, methodArgs);
                    } catch (Exception e) {
                        System.err.println("Can't set property: " + name);
                    }

                    // Now go on to next command-line arg
                    continue nextarg;
                }
            }

            // If we get here, we didn't find the named property
            System.err.println("Warning: No such property: " + name);
        }
    }

    return components;
}

From source file:org.geopublishing.atlasStyler.swing.PolygonSymbolEditGUI.java

/**
 * This method initializes jButton/*w  w w  .j  a  v a  2 s .co m*/
 * 
 * @return javax.swing.JButton
 */
private ColorButton getJButtonStrokeColor() {
    if (jButtonStrokeColor == null) {
        jButtonStrokeColor = new ColorButton();

        jButtonStrokeColor.setAction(new AbstractAction() {

            @Override
            public void actionPerformed(ActionEvent e) {

                Fill fill = symbolizer.getFill();

                Color color = null;
                if (fill != null && fill.getColor() != null) {
                    String substring = fill.getColor().toString();
                    color = Color.decode(substring);
                }

                Color newColor = AVSwingUtil.showColorChooser(PolygonSymbolEditGUI.this,
                        AtlasStylerVector.R("Stroke.ColorChooserDialog.Title"), color);

                if (newColor != null) {
                    String rgb = Integer.toHexString(newColor.getRGB());
                    rgb = "#" + rgb.substring(2, rgb.length());
                    symbolizer.getStroke().setColor(ASUtil.ff2.literal(rgb));

                    PolygonSymbolEditGUI.this.firePropertyChange(PROPERTY_UPDATED, null, null);

                    jButtonStrokeColor.setColor(newColor);

                }

            }

        });

        Stroke s = symbolizer.getStroke();
        if (s != null) {
            jButtonStrokeColor.setColor(StylingUtil.getColorFromExpression(s.getColor()));
        } else {
            jButtonStrokeColor.setEnabled(false);
        }

    }
    return jButtonStrokeColor;
}

From source file:net.sf.mzmine.chartbasics.chartthemes.ChartThemeFactory.java

/**
 * Creates the theme called "Karst". In this theme, the charts have a blue background and yellow
 * lines and labels./*from   w  ww . ja va  2s  . co m*/
 *
 * @return The "Karst" theme.
 */
public static EStandardChartTheme createKarstTheme() {
    EStandardChartTheme theme = new EStandardChartTheme(THEME.KARST, "Karst");
    // Fonts
    theme.setExtraLargeFont(new Font("Arial", Font.BOLD, 20));
    theme.setLargeFont(new Font("Arial", Font.BOLD, 11));
    theme.setRegularFont(new Font("Arial", Font.PLAIN, 11));
    theme.setSmallFont(new Font("Arial", Font.PLAIN, 11));
    //
    Paint bg = new Color(50, 50, 202);
    //
    theme.setTitlePaint(Color.green);
    theme.setSubtitlePaint(Color.yellow);
    theme.setLegendBackgroundPaint(bg);
    theme.setLegendItemPaint(Color.yellow);
    theme.setChartBackgroundPaint(bg);
    theme.setPlotBackgroundPaint(bg);
    theme.setPlotOutlinePaint(Color.yellow);
    theme.setBaselinePaint(Color.white);
    theme.setCrosshairPaint(Color.red);
    theme.setLabelLinkPaint(Color.lightGray);
    theme.setTickLabelPaint(Color.yellow);
    theme.setAxisLabelPaint(Color.yellow);
    theme.setShadowPaint(Color.darkGray);
    theme.setItemLabelPaint(Color.yellow);
    theme.setDrawingSupplier(new DefaultDrawingSupplier(
            new Paint[] { Color.decode("0xFFFF00"), Color.decode("0x0036CC"), Color.decode("0xFF0000"),
                    Color.decode("0xFFFF7F"), Color.decode("0x6681CC"), Color.decode("0xFF7F7F"),
                    Color.decode("0xFFFFBF"), Color.decode("0x99A6CC"), Color.decode("0xFFBFBF"),
                    Color.decode("0xA9A938"), Color.decode("0x2D4587") },
            new Paint[] { Color.decode("0xFFFF00"), Color.decode("0x0036CC") },
            new Stroke[] { new BasicStroke(2.0f) }, new Stroke[] { new BasicStroke(0.5f) },
            DefaultDrawingSupplier.DEFAULT_SHAPE_SEQUENCE));
    theme.setErrorIndicatorPaint(Color.lightGray);
    theme.setGridBandPaint(new Color(255, 255, 255, 20));
    theme.setGridBandAlternatePaint(new Color(255, 255, 255, 40));

    // axis
    Color transp = new Color(255, 255, 255, 200);
    theme.setRangeGridlinePaint(transp);
    theme.setDomainGridlinePaint(transp);

    theme.setAxisLinePaint(Color.yellow);
    theme.setMasterFontColor(Color.yellow);

    // axis offset
    theme.setAxisOffset(new RectangleInsets(0, 0, 0, 0));
    return theme;
}

From source file:it.eng.spagobi.engines.chart.bo.charttypes.targetcharts.SparkLine.java

@Override
public JFreeChart createChart(DatasetMap datasets) {
    logger.debug("IN");
    XYDataset dataset = (XYDataset) datasets.getDatasets().get("1");

    final JFreeChart sparkLineGraph = ChartFactory.createTimeSeriesChart(null, null, null, dataset, legend,
            false, false);//  w  ww. jav a  2  s. c  o  m
    sparkLineGraph.setBackgroundPaint(color);

    TextTitle title = setStyleTitle(name, styleTitle);
    sparkLineGraph.setTitle(title);
    if (subName != null && !subName.equals("")) {
        TextTitle subTitle = setStyleTitle(subName, styleSubTitle);
        sparkLineGraph.addSubtitle(subTitle);
    }

    sparkLineGraph.setBorderVisible(false);
    sparkLineGraph.setBorderPaint(Color.BLACK);
    XYPlot plot = sparkLineGraph.getXYPlot();
    plot.setOutlineVisible(false);
    plot.setInsets(new RectangleInsets(0.0, 0.0, 0.0, 0.0));
    plot.setBackgroundPaint(null);
    plot.setDomainGridlinesVisible(false);
    plot.setDomainCrosshairVisible(false);
    plot.setRangeGridlinesVisible(false);
    plot.setRangeCrosshairVisible(false);
    plot.setBackgroundPaint(color);

    // calculate the last marker color
    Paint colorLast = getLastPointColor();

    // Calculate average, minimum and maximum to draw plot borders.
    boolean isFirst = true;
    double avg = 0, min = Double.POSITIVE_INFINITY, max = Double.NEGATIVE_INFINITY;
    int count = 0;
    for (int i = 0; i < timeSeries.getItemCount(); i++) {
        if (timeSeries.getValue(i) != null) {
            count++;
            if (isFirst) {
                min = timeSeries.getValue(i).doubleValue();
                max = timeSeries.getValue(i).doubleValue();
                isFirst = false;
            }
            double n = timeSeries.getValue(i).doubleValue();
            //calculate avg, min, max
            avg += n;
            if (n < min)
                min = n;
            if (n > max)
                max = n;
        }
    }
    // average
    avg = avg / (double) count;

    // calculate min and max between thresholds!
    boolean isFirst2 = true;
    double lb = 0, ub = 0;
    for (Iterator iterator = thresholds.keySet().iterator(); iterator.hasNext();) {
        Double thres = (Double) iterator.next();
        if (isFirst2 == true) {
            ub = thres.doubleValue();
            lb = thres.doubleValue();
            isFirst2 = false;
        }
        if (thres.doubleValue() > ub)
            ub = thres.doubleValue();
        if (thres.doubleValue() < lb)
            lb = thres.doubleValue();
    }

    plot.getRangeAxis().setRange(new Range(Math.min(lb, min - 2), Math.max(ub, max + 2) + 2));

    addMarker(1, avg, Color.GRAY, 0.8f, plot);
    //addAvaregeSeries(series, plot);
    addPointSeries(timeSeries, plot);

    int num = 3;
    for (Iterator iterator = thresholds.keySet().iterator(); iterator.hasNext();) {
        Double thres = (Double) iterator.next();
        TargetThreshold targThres = thresholds.get(thres);
        Color color = Color.WHITE;
        if (targThres != null && targThres.getColor() != null) {
            color = targThres.getColor();
        }
        if (targThres.isVisible()) {
            addMarker(num++, thres.doubleValue(), color, 0.5f, plot);
        }
    }

    ValueAxis domainAxis = plot.getDomainAxis();
    domainAxis.setVisible(false);
    domainAxis.setUpperMargin(0.2);
    NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    rangeAxis.setVisible(false);

    plot.getRenderer().setSeriesPaint(0, Color.BLACK);
    XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(true, false) {
        public boolean getItemShapeVisible(int _series, int item) {
            TimeSeriesDataItem tsdi = timeSeries.getDataItem(item);
            if (tsdi == null)
                return false;
            Month period = (Month) tsdi.getPeriod();
            int currMonth = period.getMonth();
            int currYear = period.getYearValue();
            int lastMonthFilled = lastMonth.getMonth();
            int lastYearFilled = lastMonth.getYearValue();
            boolean isLast = false;
            if (currYear == lastYearFilled && currMonth == lastMonthFilled) {
                isLast = true;
            }
            return isLast;
        }
    };
    renderer.setSeriesPaint(0, Color.decode("0x000000"));

    renderer.setBaseShapesVisible(true);
    renderer.setBaseShapesFilled(true);
    renderer.setDrawOutlines(true);
    renderer.setUseFillPaint(true);
    renderer.setBaseFillPaint(colorLast);
    renderer.setBaseOutlinePaint(Color.BLACK);
    renderer.setUseOutlinePaint(true);
    renderer.setSeriesShape(0, new Ellipse2D.Double(-4.0, -4.0, 8.0, 8.0));

    if (wlt_mode.doubleValue() == 0) {
        renderer.setBaseItemLabelsVisible(Boolean.FALSE, true);
    } else {
        renderer.setBaseItemLabelsVisible(Boolean.TRUE, true);
        renderer.setBaseItemLabelFont(
                new Font(styleValueLabels.getFontName(), Font.PLAIN, styleValueLabels.getSize()));
        renderer.setBaseItemLabelPaint(styleValueLabels.getColor());
        renderer.setBaseItemLabelGenerator(new StandardXYItemLabelGenerator("{2}", new DecimalFormat("0.###"),
                new DecimalFormat("0.###")) {
            public String generateLabel(CategoryDataset dataset, int row, int column) {
                if (dataset.getValue(row, column) == null || dataset.getValue(row, column).doubleValue() == 0)
                    return "";
                String columnKey = (String) dataset.getColumnKey(column);
                int separator = columnKey.indexOf('-');
                String month = columnKey.substring(0, separator);
                String year = columnKey.substring(separator + 1);
                int monthNum = Integer.parseInt(month);
                if (wlt_mode.doubleValue() >= 1 && wlt_mode.doubleValue() <= 4) {
                    if (wlt_mode.doubleValue() == 2 && column % 2 == 0)
                        return "";

                    Calendar calendar = Calendar.getInstance();
                    calendar.set(Calendar.MONTH, monthNum - 1);
                    SimpleDateFormat dataFormat = new SimpleDateFormat("MMM");
                    return dataFormat.format(calendar.getTime());
                } else
                    return "" + monthNum;
            }
        });
    }

    if (wlt_mode.doubleValue() == 3) {
        renderer.setBasePositiveItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12,
                org.jfree.ui.TextAnchor.BOTTOM_CENTER, org.jfree.ui.TextAnchor.BOTTOM_RIGHT, Math.PI / 2));
        renderer.setBaseNegativeItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.OUTSIDE6,
                org.jfree.ui.TextAnchor.TOP_CENTER, org.jfree.ui.TextAnchor.HALF_ASCENT_LEFT, Math.PI / 2));

    } else if (wlt_mode.doubleValue() == 4) {
        renderer.setBasePositiveItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12,
                org.jfree.ui.TextAnchor.BOTTOM_CENTER, org.jfree.ui.TextAnchor.BOTTOM_RIGHT, Math.PI / 4));
        renderer.setBaseNegativeItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.OUTSIDE6,
                org.jfree.ui.TextAnchor.TOP_CENTER, org.jfree.ui.TextAnchor.HALF_ASCENT_LEFT, Math.PI / 4));
    }

    if (legend == true) {
        LegendItemCollection collection = createThresholdLegend(plot);
        LegendItem item = new LegendItem("Avg", "Avg", "Avg", "Avg", new Rectangle(10, 10), colorAverage);
        collection.add(item);
        plot.setFixedLegendItems(collection);

    }

    plot.setRenderer(0, renderer);
    logger.debug("OUT");
    return sparkLineGraph;
}