Example usage for java.awt Color YELLOW

List of usage examples for java.awt Color YELLOW

Introduction

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

Prototype

Color YELLOW

To view the source code for java.awt Color YELLOW.

Click Source Link

Document

The color yellow.

Usage

From source file:visualizer.datamining.dataanalysis.CreateLineGraph.java

private JFreeChart createChart(XYDataset xydataset, String title, String xtitle, String ytitle) {
    JFreeChart chart = ChartFactory.createXYLineChart(title, xtitle, ytitle, xydataset,
            PlotOrientation.VERTICAL, true, true, false);

    chart.setBackgroundPaint(Color.WHITE);

    XYPlot xyplot = (XYPlot) chart.getPlot();
    NumberAxis numberaxis = (NumberAxis) xyplot.getRangeAxis();
    numberaxis.setAutoRangeIncludesZero(false);

    xyplot.setDomainGridlinePaint(Color.BLACK);
    xyplot.setRangeGridlinePaint(Color.BLACK);

    xyplot.setOutlinePaint(Color.BLACK);
    xyplot.setOutlineStroke(new BasicStroke(1.0f));
    xyplot.setBackgroundPaint(Color.white);
    xyplot.setDomainCrosshairVisible(true);
    xyplot.setRangeCrosshairVisible(true);

    xyplot.setDrawingSupplier(new DefaultDrawingSupplier(
            new Paint[] { Color.RED, Color.BLUE, Color.GREEN, Color.MAGENTA, Color.CYAN, Color.ORANGE,
                    Color.BLACK, Color.DARK_GRAY, Color.GRAY, Color.LIGHT_GRAY, Color.YELLOW },
            DefaultDrawingSupplier.DEFAULT_OUTLINE_PAINT_SEQUENCE,
            DefaultDrawingSupplier.DEFAULT_STROKE_SEQUENCE,
            DefaultDrawingSupplier.DEFAULT_OUTLINE_STROKE_SEQUENCE,
            DefaultDrawingSupplier.DEFAULT_SHAPE_SEQUENCE));

    XYLineAndShapeRenderer xylineandshaperenderer = (XYLineAndShapeRenderer) xyplot.getRenderer();
    xylineandshaperenderer.setBaseShapesVisible(true);
    xylineandshaperenderer.setBaseShapesFilled(true);
    xylineandshaperenderer.setDrawOutlines(true);

    return chart;
}

From source file:net.fenyo.gnetwatch.GUI.GenericSrcComponent.java

/**
 * Paints the chart./*  w  w  w  . j  av a2s.  c  o m*/
 * @param now current time.
 * @return void.
 */
// AWT thread
// AWT thread << sync_value_per_vinterval << events
public void paintChart(final long now) {
    backing_g.setClip(axis_margin_left + 1, axis_margin_top,
            dimension.width - axis_margin_left - axis_margin_right - 1,
            dimension.height - axis_margin_top - axis_margin_bottom);

    synchronized (events) {
        final int npoints = events.size();
        final int point_x[] = new int[npoints];
        final int point_y[] = new int[npoints];
        final int point_y1[] = new int[npoints];
        final int point_y2[] = new int[npoints];
        final int point_y3[] = new int[npoints];
        final int point_y4[] = new int[npoints];
        final int point_y5[] = new int[npoints];
        final int point_y6[] = new int[npoints];
        final int point_y7[] = new int[npoints];
        final int point_y8[] = new int[npoints];
        final int point_y9[] = new int[npoints];
        final int point_y10[] = new int[npoints];

        final long time_to_display = now - now % _getDelayPerInterval();
        final int pixels_offset = (pixels_per_interval * (int) (now % _getDelayPerInterval()))
                / (int) _getDelayPerInterval();
        final int last_interval_pos = dimension.width - axis_margin_right - pixels_offset;

        for (int i = 0; i < events.size(); i++) {
            final EventGenericSrc event = (EventGenericSrc) events.get(i);
            final long xpos = ((long) last_interval_pos)
                    + (((long) pixels_per_interval) * (event.getDate().getTime() - time_to_display))
                            / _getDelayPerInterval();
            if (xpos < -1000)
                point_x[i] = -1000;
            else if (xpos > 1000 + dimension.width)
                point_x[i] = 1000 + dimension.width;
            else
                point_x[i] = (int) xpos;

            // cast to double to avoid overflow on int that lead to wrong results
            point_y[i] = (int) (dimension.height - axis_margin_bottom
                    - pixels_per_vinterval * (double) event.getIntValue() / value_per_vinterval);
            point_y1[i] = (int) (dimension.height - axis_margin_bottom
                    - pixels_per_vinterval * (double) event.getValue1() / value_per_vinterval);
            point_y2[i] = (int) (dimension.height - axis_margin_bottom
                    - pixels_per_vinterval * (double) event.getValue2() / value_per_vinterval);
            point_y3[i] = (int) (dimension.height - axis_margin_bottom
                    - pixels_per_vinterval * (double) event.getValue3() / value_per_vinterval);
            point_y4[i] = (int) (dimension.height - axis_margin_bottom
                    - pixels_per_vinterval * (double) event.getValue4() / value_per_vinterval);
            point_y5[i] = (int) (dimension.height - axis_margin_bottom
                    - pixels_per_vinterval * (double) event.getValue5() / value_per_vinterval);
            point_y6[i] = (int) (dimension.height - axis_margin_bottom
                    - pixels_per_vinterval * (double) event.getValue6() / value_per_vinterval);
            point_y7[i] = (int) (dimension.height - axis_margin_bottom
                    - pixels_per_vinterval * (double) event.getValue7() / value_per_vinterval);
            point_y8[i] = (int) (dimension.height - axis_margin_bottom
                    - pixels_per_vinterval * (double) event.getValue8() / value_per_vinterval);
            point_y9[i] = (int) (dimension.height - axis_margin_bottom
                    - pixels_per_vinterval * (double) event.getValue9() / value_per_vinterval);
            point_y10[i] = (int) (dimension.height - axis_margin_bottom
                    - pixels_per_vinterval * (double) event.getValue10() / value_per_vinterval);
        }

        backing_g.setColor(Color.GREEN);
        backing_g.drawPolyline(point_x, point_y, events.size());
        for (int i = 0; i < events.size(); i++)
            backing_g.drawRect(point_x[i] - 2, point_y[i] - 2, 4, 4);

        backing_g.setColor(Color.WHITE);
        backing_g.drawPolyline(point_x, point_y1, events.size());
        for (int i = 0; i < events.size(); i++)
            backing_g.drawRect(point_x[i] - 2, point_y1[i] - 2, 4, 4);

        backing_g.setColor(Color.BLUE);
        backing_g.drawPolyline(point_x, point_y2, events.size());
        for (int i = 0; i < events.size(); i++)
            backing_g.drawRect(point_x[i] - 2, point_y2[i] - 2, 4, 4);

        backing_g.setColor(Color.GRAY);
        backing_g.drawPolyline(point_x, point_y3, events.size());
        for (int i = 0; i < events.size(); i++)
            backing_g.drawRect(point_x[i] - 2, point_y3[i] - 2, 4, 4);

        backing_g.setColor(Color.YELLOW);
        backing_g.drawPolyline(point_x, point_y4, events.size());
        for (int i = 0; i < events.size(); i++)
            backing_g.drawRect(point_x[i] - 2, point_y4[i] - 2, 4, 4);

        backing_g.setColor(Color.ORANGE);
        backing_g.drawPolyline(point_x, point_y5, events.size());
        for (int i = 0; i < events.size(); i++)
            backing_g.drawRect(point_x[i] - 2, point_y5[i] - 2, 4, 4);

        backing_g.setColor(Color.CYAN);
        backing_g.drawPolyline(point_x, point_y6, events.size());
        for (int i = 0; i < events.size(); i++)
            backing_g.drawRect(point_x[i] - 2, point_y6[i] - 2, 4, 4);

        backing_g.setColor(Color.MAGENTA);
        backing_g.drawPolyline(point_x, point_y7, events.size());
        for (int i = 0; i < events.size(); i++)
            backing_g.drawRect(point_x[i] - 2, point_y7[i] - 2, 4, 4);

        backing_g.setColor(Color.LIGHT_GRAY);
        backing_g.drawPolyline(point_x, point_y8, events.size());
        for (int i = 0; i < events.size(); i++)
            backing_g.drawRect(point_x[i] - 2, point_y8[i] - 2, 4, 4);

        backing_g.setColor(Color.PINK);
        backing_g.drawPolyline(point_x, point_y9, events.size());
        for (int i = 0; i < events.size(); i++)
            backing_g.drawRect(point_x[i] - 2, point_y9[i] - 2, 4, 4);

        backing_g.setColor(Color.RED);
        backing_g.drawPolyline(point_x, point_y10, events.size());
        for (int i = 0; i < events.size(); i++)
            backing_g.drawRect(point_x[i] - 2, point_y10[i] - 2, 4, 4);

        int cnt = 1;
        int cnt2 = 1;
        if (events.size() > 0)
            for (final String str : ((EventGenericSrc) events.get(0)).getUnits().split(";")) {
                if (str.length() > 0) {
                    switch (cnt) {
                    case 1:
                        backing_g.setColor(Color.WHITE);
                        break;
                    case 2:
                        backing_g.setColor(Color.BLUE);
                        break;
                    case 3:
                        backing_g.setColor(Color.GRAY);
                        break;
                    case 4:
                        backing_g.setColor(Color.YELLOW);
                        break;
                    case 5:
                        backing_g.setColor(Color.ORANGE);
                        break;
                    case 6:
                        backing_g.setColor(Color.CYAN);
                        break;
                    case 7:
                        backing_g.setColor(Color.MAGENTA);
                        break;
                    case 8:
                        backing_g.setColor(Color.LIGHT_GRAY);
                        break;
                    case 9:
                        backing_g.setColor(Color.PINK);
                        break;
                    case 10:
                        backing_g.setColor(Color.RED);
                        break;
                    }
                    backing_g.fillRect(dimension.width - axis_margin_right - 150, 50 - 5 + 13 * cnt2, 20, 3);

                    backing_g.setColor(Color.WHITE);
                    backing_g.drawString(str, dimension.width - axis_margin_right - 150 + 22, 50 + 13 * cnt2);

                    cnt2++;
                }
                cnt++;
            }

        backing_g.setClip(null);
    }
}

From source file:org.trade.ui.chart.renderer.CandleRenderer.java

/**
 * Method drawItem.//from w w w.  j a v  a2s  .c  o  m
 * 
 * @param g2
 *            Graphics2D
 * @param state
 *            XYItemRendererState
 * @param dataArea
 *            Rectangle2D
 * @param info
 *            PlotRenderingInfo
 * @param plot
 *            XYPlot
 * @param domainAxis
 *            ValueAxis
 * @param rangeAxis
 *            ValueAxis
 * @param dataset
 *            XYDataset
 * @param series
 *            int
 * @param item
 *            int
 * @param crosshairState
 *            CrosshairState
 * @param pass
 *            int
 * @see org.jfree.chart.renderer.xy.XYItemRenderer#drawItem(Graphics2D,
 *      XYItemRendererState, Rectangle2D, PlotRenderingInfo, XYPlot,
 *      ValueAxis, ValueAxis, XYDataset, int, int, CrosshairState, int)
 */
public void drawItem(Graphics2D g2, XYItemRendererState state, Rectangle2D dataArea, PlotRenderingInfo info,
        XYPlot plot, ValueAxis domainAxis, ValueAxis rangeAxis, XYDataset dataset, int series, int item,
        CrosshairState crosshairState, int pass) {

    if (dataset instanceof OHLCVwapDataset) {

        // setup for collecting optional entity info...
        EntityCollection entities = null;
        if (info != null) {
            entities = info.getOwner().getEntityCollection();
        }

        CandleDataset candleDataset = (CandleDataset) dataset;
        CandleItem candle = (CandleItem) candleDataset.getSeries(series).getDataItem(item);

        double startX = candle.getPeriod().getFirstMillisecond();
        if (Double.isNaN(startX)) {
            return;
        }
        double endX = candle.getPeriod().getLastMillisecond();
        if (Double.isNaN(endX)) {
            return;
        }

        if (startX <= endX) {
            if (!domainAxis.getRange().intersects(startX, endX)) {
                return;
            }
        } else {
            if (!domainAxis.getRange().intersects(endX, startX)) {
                return;
            }
        }

        RectangleEdge location = plot.getDomainAxisEdge();
        double translatedStartX = domainAxis.valueToJava2D(startX, dataArea, location);
        double translatedEndX = domainAxis.valueToJava2D(endX, dataArea, location);

        double translatedWidth = Math.max(1, Math.abs(translatedEndX - translatedStartX));

        if (getMargin() > 0.0) {
            double cut = translatedWidth * getMargin();
            translatedWidth = translatedWidth - cut;
        }

        double x = candleDataset.getXValue(series, item);
        double yHigh = candleDataset.getHighValue(series, item);
        double yLow = candleDataset.getLowValue(series, item);
        double yOpen = candleDataset.getOpenValue(series, item);
        double yClose = candleDataset.getCloseValue(series, item);

        RectangleEdge domainEdge = plot.getDomainAxisEdge();
        double xx = domainAxis.valueToJava2D(x, dataArea, domainEdge);

        RectangleEdge edge = plot.getRangeAxisEdge();
        double yyHigh = rangeAxis.valueToJava2D(yHigh, dataArea, edge);
        double yyLow = rangeAxis.valueToJava2D(yLow, dataArea, edge);
        double yyOpen = rangeAxis.valueToJava2D(yOpen, dataArea, edge);
        double yyClose = rangeAxis.valueToJava2D(yClose, dataArea, edge);

        Paint outlinePaint = null;
        outlinePaint = getItemOutlinePaint(series, item);
        g2.setStroke(getItemStroke(series, item));
        g2.setPaint(outlinePaint);

        double yyMaxOpenClose = Math.max(yyOpen, yyClose);
        double yyMinOpenClose = Math.min(yyOpen, yyClose);
        double maxOpenClose = Math.max(yOpen, yClose);
        double minOpenClose = Math.min(yOpen, yClose);

        Shape body = null;
        boolean highlight = highlight(series, item);
        /**********************************
         * draw the upper shadow START
         **********************************/

        if (yHigh > maxOpenClose) {
            if (highlight) {
                body = new Rectangle2D.Double(xx - (translatedWidth / 2), yyHigh - 10, translatedWidth,
                        (yyMaxOpenClose - yyHigh) + 10);
                g2.setPaint(Color.YELLOW);
                g2.fill(body);
                g2.draw(body);
            }
        }

        if (yHigh > maxOpenClose) {
            if (nightMode) {
                if (yClose > yOpen) {
                    g2.setPaint(upPaint);
                } else {
                    g2.setPaint(downPaint);
                }
            } else {
                g2.setPaint(Color.black);
            }

            g2.draw(new Line2D.Double(xx, yyHigh, xx, yyMaxOpenClose));
        }

        /**********************************
         * draw the lower shadow START
         **********************************/
        if (yLow < minOpenClose) {
            if (highlight) {
                body = new Rectangle2D.Double(xx - (translatedWidth / 2), yyMinOpenClose, translatedWidth,
                        (yyLow - yyMinOpenClose) + 10);
                g2.setPaint(Color.YELLOW);
                g2.fill(body);
                g2.draw(body);
            }
            if (yLow < minOpenClose) {
                if (nightMode) {
                    if (yClose > yOpen) {
                        g2.setPaint(upPaint);
                    } else {
                        g2.setPaint(downPaint);
                    }
                } else {
                    g2.setPaint(Color.BLACK);
                }
                g2.draw(new Line2D.Double(xx, yyLow, xx, yyMinOpenClose));
            }
        }

        /**********************************
         * draw the body
         **********************************/

        body = new Rectangle2D.Double(xx - (translatedWidth / 2), yyMinOpenClose, translatedWidth,
                yyMaxOpenClose - yyMinOpenClose);

        if (nightMode) {
            g2.setPaint(Color.white);
        } else {
            if (yClose > yOpen) {
                g2.setPaint(upPaint);
            } else {
                g2.setPaint(downPaint);
            }
        }

        g2.fill(body);
        g2.draw(body);

        if (nightMode) {
            if (yClose > yOpen) {
                g2.setPaint(upPaint);
            } else {
                g2.setPaint(downPaint);
            }
        } else {
            g2.setPaint(outlinePaint);
        }
        g2.draw(body);
        // add an entity for the item...
        if (entities != null) {
            String tip = null;
            XYToolTipGenerator generator = getToolTipGenerator(series, item);
            if (generator != null) {
                tip = generator.generateToolTip(dataset, series, item);
            }

            XYItemEntity entity = new XYItemEntity(body, dataset, series, item, tip, null);

            entities.add(entity);
        }

        // update the cross hair point
        double x1 = dataset.getXValue(series, item);
        double y1 = dataset.getYValue(series, item);
        double transX1 = domainAxis.valueToJava2D(x1, dataArea, location);
        double transY1 = rangeAxis.valueToJava2D(y1, dataArea, plot.getRangeAxisEdge());
        int domainAxisIndex = plot.getDomainAxisIndex(domainAxis);
        int rangeAxisIndex = plot.getRangeAxisIndex(rangeAxis);
        updateCrosshairValues(crosshairState, x1, y1, domainAxisIndex, rangeAxisIndex, transX1, transY1,
                plot.getOrientation());
    }
}

From source file:org.openscience.cdk.applications.taverna.basicutilities.ChartTool.java

/**
 * Creates a bar chart./*  w ww  .jav a  2 s . co  m*/
 * 
 * @param title
 * @param categoryAxisLabel
 *            (X-Axis label)
 * @param valueAxisLabel
 *            (Y-Axis label)
 * @param dataset
 * @return JfreeChart instance.
 */
public JFreeChart createBarChart(String title, String categoryAxisLabel, String valueAxisLabel,
        CategoryDataset dataset) {
    JFreeChart chart = ChartFactory.createBarChart(title, categoryAxisLabel, valueAxisLabel, dataset,
            this.orientation, this.drawLegend, false, false);
    // set the background color for the chart...
    chart.setBackgroundPaint(Color.white);
    chart.setAntiAlias(true);
    CategoryPlot plot = chart.getCategoryPlot();
    CategoryAxis domainAxis = plot.getDomainAxis();
    domainAxis.setLowerMargin(0.01);
    domainAxis.setUpperMargin(0.01);
    domainAxis.setCategoryLabelPositions(CategoryLabelPositions.DOWN_90);
    BarRenderer renderer = (BarRenderer) plot.getRenderer();
    renderer.setSeriesPaint(0, Color.blue);
    renderer.setSeriesPaint(1, Color.red);
    renderer.setSeriesPaint(2, Color.green);
    renderer.setSeriesPaint(3, Color.darkGray);
    renderer.setSeriesPaint(4, Color.yellow);
    return chart;
}

From source file:controller.ChartAndGraphServlet.java

/**
 * Creates the appropriate chart for the patient history page or the
 * statistics page. Line charts are created to display a longitudinal view
 * of patient results on the history page. The statistics page includes pie
 * charts, bar charts, histograms, and box and whisker charts.
 *
 * @param request servlet request/*from  w  w w .  j ava  2s  .c  om*/
 * @param response servlet response
 * @throws IOException
 */
public void getChart(HttpServletRequest request, HttpServletResponse response) throws IOException {
    HttpSession session = request.getSession();
    response.setContentType("image/png");
    OutputStream outputStream = response.getOutputStream();
    final int widthIncreaseThreshold = 18;
    final int incrementalIncreaseThreshold = 22;
    final int incrementalIncreaseInPixels = 45;
    final int treatmentClassUnknownIndex = 6;
    int width = 640;
    int height = 450;
    int bigWidth = 780;
    ReferenceContainer rc = (ReferenceContainer) session.getServletContext().getAttribute("references");
    HealthyTargetReference htr = rc.getHealthyTargets();
    String action = request.getParameter("action");

    switch (action) {
    case "a1c": {
        ArrayList<A1cResult> a1cHistory = (ArrayList<A1cResult>) session
                .getAttribute(SessionObjectUtility.A1C_GRAPH_POINTS);
        DefaultCategoryDataset dataset = new DefaultCategoryDataset();

        /* add the data */
        for (int i = a1cHistory.size() - 1; i > -1; i--) {
            dataset.addValue(a1cHistory.get(i).getValue(), "A1C", a1cHistory.get(i).getDate());
        }
        /* remove reference */
        session.setAttribute(SessionObjectUtility.A1C_GRAPH_POINTS, null);

        boolean legend = true;
        boolean tooltips = false;
        boolean urls = false;

        /* get the chart */
        JFreeChart chart = ChartFactory.createLineChart("A1C History", "dates", "A1C", dataset,
                PlotOrientation.VERTICAL, legend, tooltips, urls);

        /* angle the x-axis labels */
        CategoryPlot plot = chart.getCategoryPlot();
        CategoryAxis xAxis = (CategoryAxis) plot.getDomainAxis();
        xAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_45);

        chart.setBorderPaint(Color.GREEN);
        chart.setBorderStroke(new BasicStroke(5.0f));
        chart.setBorderVisible(true);

        /* show the healthy target boundaries */
        BigDecimal upper = htr.getA1c().getUpperBound();
        BigDecimal lower = htr.getA1c().getLowerBound();
        if (upper != null) {
            ValueMarker marker = new ValueMarker(upper.doubleValue());
            marker.setPaint(Color.YELLOW);
            plot.addRangeMarker(marker);
        }
        if (lower != null) {
            ValueMarker marker = new ValueMarker(lower.doubleValue());
            marker.setPaint(Color.YELLOW);
            plot.addRangeMarker(marker);
        }

        if (a1cHistory.size() > widthIncreaseThreshold) {
            width = bigWidth;
        }
        if (a1cHistory.size() > incrementalIncreaseThreshold) {
            int increments = a1cHistory.size() % incrementalIncreaseThreshold;
            for (int i = 0; i < increments; i++) {
                width += incrementalIncreaseInPixels;
            }
        }
        ChartUtilities.writeChartAsPNG(outputStream, chart, width, height);
        break;
    }
    case "psa": {
        ArrayList<ContinuousResult> psaHistory = (ArrayList<ContinuousResult>) session
                .getAttribute(SessionObjectUtility.PSA_GRAPH_POINTS);
        DefaultCategoryDataset dataset = new DefaultCategoryDataset();

        /* add the data */
        for (int i = psaHistory.size() - 1; i > -1; i--) {
            dataset.addValue(psaHistory.get(i).getValue(), "PSA", psaHistory.get(i).getDate());
        }

        /* remove reference */
        session.setAttribute(SessionObjectUtility.PSA_GRAPH_POINTS, null);

        boolean legend = true;
        boolean tooltips = false;
        boolean urls = false;

        /* get the chart */
        JFreeChart chart = ChartFactory.createLineChart("PSA History", "dates", "PSA", dataset,
                PlotOrientation.VERTICAL, legend, tooltips, urls);

        /* angle the x-axis labels */
        CategoryPlot plot = chart.getCategoryPlot();
        CategoryAxis xAxis = (CategoryAxis) plot.getDomainAxis();
        xAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_45);

        chart.setBorderPaint(Color.GREEN);
        chart.setBorderStroke(new BasicStroke(5.0f));
        chart.setBorderVisible(true);

        /* show the healthy target boundaries */
        BigDecimal upper = htr.getPsa().getUpperBound();
        BigDecimal lower = htr.getPsa().getLowerBound();
        if (upper != null) {
            ValueMarker marker = new ValueMarker(upper.doubleValue());
            marker.setPaint(Color.YELLOW);
            plot.addRangeMarker(marker);
        }
        if (lower != null) {
            ValueMarker marker = new ValueMarker(lower.doubleValue());
            marker.setPaint(Color.YELLOW);
            plot.addRangeMarker(marker);
        }

        if (psaHistory.size() > widthIncreaseThreshold) {
            width = bigWidth;
        }
        if (psaHistory.size() > incrementalIncreaseThreshold) {
            int increments = psaHistory.size() % incrementalIncreaseThreshold;
            for (int i = 0; i < increments; i++) {
                width += incrementalIncreaseInPixels;
            }
        }
        ChartUtilities.writeChartAsPNG(outputStream, chart, width, height);
        break;
    }
    case "alt": {
        ArrayList<ContinuousResult> altHistory = (ArrayList<ContinuousResult>) session
                .getAttribute(SessionObjectUtility.ALT_GRAPH_POINTS);
        DefaultCategoryDataset dataset = new DefaultCategoryDataset();

        /* add the data */
        for (int i = altHistory.size() - 1; i > -1; i--) {
            dataset.addValue(altHistory.get(i).getValue(), "ALT", altHistory.get(i).getDate());
        }

        /* remove reference */
        session.setAttribute(SessionObjectUtility.ALT_GRAPH_POINTS, null);

        boolean legend = true;
        boolean tooltips = false;
        boolean urls = false;

        /* get the chart */
        JFreeChart chart = ChartFactory.createLineChart("ALT History", "dates", "ALT", dataset,
                PlotOrientation.VERTICAL, legend, tooltips, urls);

        /* angle the x-axis labels */
        CategoryPlot plot = chart.getCategoryPlot();
        CategoryAxis xAxis = (CategoryAxis) plot.getDomainAxis();
        xAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_45);

        chart.setBorderPaint(Color.GREEN);
        chart.setBorderStroke(new BasicStroke(5.0f));
        chart.setBorderVisible(true);

        /* show the healthy target boundaries */
        BigDecimal upper = htr.getAlt().getUpperBound();
        BigDecimal lower = htr.getAlt().getLowerBound();
        if (upper != null) {
            ValueMarker marker = new ValueMarker(upper.doubleValue());
            marker.setPaint(Color.YELLOW);
            plot.addRangeMarker(marker);
        }
        if (lower != null) {
            ValueMarker marker = new ValueMarker(lower.doubleValue());
            marker.setPaint(Color.YELLOW);
            plot.addRangeMarker(marker);
        }

        if (altHistory.size() > widthIncreaseThreshold) {
            width = bigWidth;
        }
        if (altHistory.size() > incrementalIncreaseThreshold) {
            int increments = altHistory.size() % incrementalIncreaseThreshold;
            for (int i = 0; i < increments; i++) {
                width += incrementalIncreaseInPixels;
            }
        }
        ChartUtilities.writeChartAsPNG(outputStream, chart, width, height);
        break;
    }
    case "ast": {
        ArrayList<ContinuousResult> astHistory = (ArrayList<ContinuousResult>) session
                .getAttribute(SessionObjectUtility.AST_GRAPH_POINTS);
        DefaultCategoryDataset dataset = new DefaultCategoryDataset();

        /* add the data */
        for (int i = astHistory.size() - 1; i > -1; i--) {
            dataset.addValue(astHistory.get(i).getValue(), "AST", astHistory.get(i).getDate());
        }

        /* remove reference */
        session.setAttribute(SessionObjectUtility.AST_GRAPH_POINTS, null);

        boolean legend = true;
        boolean tooltips = false;
        boolean urls = false;

        /* get the chart */
        JFreeChart chart = ChartFactory.createLineChart("AST History", "dates", "AST", dataset,
                PlotOrientation.VERTICAL, legend, tooltips, urls);

        /* angle the x-axis labels */
        CategoryPlot plot = chart.getCategoryPlot();
        CategoryAxis xAxis = (CategoryAxis) plot.getDomainAxis();
        xAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_45);

        chart.setBorderPaint(Color.GREEN);
        chart.setBorderStroke(new BasicStroke(5.0f));
        chart.setBorderVisible(true);

        /* show the healthy target boundaries */
        BigDecimal upper = htr.getAst().getUpperBound();
        BigDecimal lower = htr.getAst().getLowerBound();
        if (upper != null) {
            ValueMarker marker = new ValueMarker(upper.doubleValue());
            marker.setPaint(Color.YELLOW);
            plot.addRangeMarker(marker);
        }
        if (lower != null) {
            ValueMarker marker = new ValueMarker(lower.doubleValue());
            marker.setPaint(Color.YELLOW);
            plot.addRangeMarker(marker);
        }

        if (astHistory.size() > widthIncreaseThreshold) {
            width = bigWidth;
        }
        if (astHistory.size() > incrementalIncreaseThreshold) {
            int increments = astHistory.size() % incrementalIncreaseThreshold;
            for (int i = 0; i < increments; i++) {
                width += incrementalIncreaseInPixels;
            }
        }
        ChartUtilities.writeChartAsPNG(outputStream, chart, width, height);
        break;
    }
    case "bp": {
        ArrayList<BloodPressureResult> bpHistory = (ArrayList<BloodPressureResult>) session
                .getAttribute(SessionObjectUtility.BP_GRAPH_POINTS);
        DefaultCategoryDataset dataset = new DefaultCategoryDataset();

        /* add the data */
        for (int i = bpHistory.size() - 1; i > -1; i--) {
            dataset.addValue(bpHistory.get(i).getSystolicValue(), "systolic", bpHistory.get(i).getDate());
            dataset.addValue(bpHistory.get(i).getDiastolicValue(), "diastolic", bpHistory.get(i).getDate());
        }

        /* remove reference */
        session.setAttribute(SessionObjectUtility.BP_GRAPH_POINTS, null);

        boolean legend = true;
        boolean tooltips = false;
        boolean urls = false;

        /* get the chart */
        JFreeChart chart = ChartFactory.createLineChart("Blood Pressure History", "dates", "blood pressure",
                dataset, PlotOrientation.VERTICAL, legend, tooltips, urls);

        /* angle the x-axis labels */
        CategoryPlot plot = chart.getCategoryPlot();
        CategoryAxis xAxis = (CategoryAxis) plot.getDomainAxis();
        xAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_45);

        chart.setBorderPaint(Color.GREEN);
        chart.setBorderStroke(new BasicStroke(5.0f));
        chart.setBorderVisible(true);

        /* show the healthy target boundaries */
        BigDecimal upperSystole = htr.getBloodPressureSystole().getUpperBound();
        BigDecimal upperDiastole = htr.getBloodPressureDiastole().getUpperBound();
        if (upperSystole != null) {
            ValueMarker marker = new ValueMarker(upperSystole.doubleValue());
            marker.setPaint(Color.MAGENTA);
            plot.addRangeMarker(marker);
        }
        if (upperDiastole != null) {
            ValueMarker marker = new ValueMarker(upperDiastole.doubleValue());
            marker.setPaint(Color.BLUE);
            plot.addRangeMarker(marker);
        }

        if (bpHistory.size() > widthIncreaseThreshold) {
            width = bigWidth;
        }
        if (bpHistory.size() > incrementalIncreaseThreshold) {
            int increments = bpHistory.size() % incrementalIncreaseThreshold;
            for (int i = 0; i < increments; i++) {
                width += incrementalIncreaseInPixels;
            }
        }
        ChartUtilities.writeChartAsPNG(outputStream, chart, width, height);
        break;
    }
    case "bmi": {
        ArrayList<ContinuousResult> bmiHistory = (ArrayList<ContinuousResult>) session
                .getAttribute(SessionObjectUtility.BMI_GRAPH_POINTS);
        DefaultCategoryDataset dataset = new DefaultCategoryDataset();

        /* add the data */
        for (int i = bmiHistory.size() - 1; i > -1; i--) {
            dataset.addValue(bmiHistory.get(i).getValue(), "BMI", bmiHistory.get(i).getDate());
        }

        /* remove reference */
        session.setAttribute(SessionObjectUtility.BMI_GRAPH_POINTS, null);

        boolean legend = true;
        boolean tooltips = false;
        boolean urls = false;

        /* get the chart */
        JFreeChart chart = ChartFactory.createLineChart("BMI History", "dates", "BMI", dataset,
                PlotOrientation.VERTICAL, legend, tooltips, urls);

        /* angle the x-axis labels */
        CategoryPlot plot = chart.getCategoryPlot();
        CategoryAxis xAxis = (CategoryAxis) plot.getDomainAxis();
        xAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_45);

        chart.setBorderPaint(Color.GREEN);
        chart.setBorderStroke(new BasicStroke(5.0f));
        chart.setBorderVisible(true);

        /* show the healthy target boundaries */
        BigDecimal upper = htr.getBmi().getUpperBound();
        BigDecimal lower = htr.getBmi().getLowerBound();
        if (upper != null) {
            ValueMarker marker = new ValueMarker(upper.doubleValue());
            marker.setPaint(Color.YELLOW);
            plot.addRangeMarker(marker);
        }
        if (lower != null) {
            ValueMarker marker = new ValueMarker(lower.doubleValue());
            marker.setPaint(Color.YELLOW);
            plot.addRangeMarker(marker);
        }

        if (bmiHistory.size() > widthIncreaseThreshold) {
            width = bigWidth;
        }
        if (bmiHistory.size() > incrementalIncreaseThreshold) {
            int increments = bmiHistory.size() % incrementalIncreaseThreshold;
            for (int i = 0; i < increments; i++) {
                width += incrementalIncreaseInPixels;
            }
        }
        ChartUtilities.writeChartAsPNG(outputStream, chart, width, height);
        break;
    }
    case "creatinine": {
        ArrayList<ContinuousResult> creatinineHistory = (ArrayList<ContinuousResult>) session
                .getAttribute(SessionObjectUtility.CREATININE_GRAPH_POINTS);
        DefaultCategoryDataset dataset = new DefaultCategoryDataset();

        /* add the data */
        for (int i = creatinineHistory.size() - 1; i > -1; i--) {
            dataset.addValue(creatinineHistory.get(i).getValue(), "creatinine",
                    creatinineHistory.get(i).getDate());
        }

        /* remove reference */
        session.setAttribute(SessionObjectUtility.CREATININE_GRAPH_POINTS, null);

        boolean legend = true;
        boolean tooltips = false;
        boolean urls = false;

        /* get the chart */
        JFreeChart chart = ChartFactory.createLineChart("Creatinine History", "dates", "creatinine", dataset,
                PlotOrientation.VERTICAL, legend, tooltips, urls);

        /* angle the x-axis labels */
        CategoryPlot plot = chart.getCategoryPlot();
        CategoryAxis xAxis = (CategoryAxis) plot.getDomainAxis();
        xAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_45);

        chart.setBorderPaint(Color.GREEN);
        chart.setBorderStroke(new BasicStroke(5.0f));
        chart.setBorderVisible(true);

        /* show the healthy target boundaries */
        BigDecimal upper = htr.getCreatinine().getUpperBound();
        BigDecimal lower = htr.getCreatinine().getLowerBound();
        if (upper != null) {
            ValueMarker marker = new ValueMarker(upper.doubleValue());
            marker.setPaint(Color.YELLOW);
            plot.addRangeMarker(marker);
        }
        if (lower != null) {
            ValueMarker marker = new ValueMarker(lower.doubleValue());
            marker.setPaint(Color.YELLOW);
            plot.addRangeMarker(marker);
        }

        if (creatinineHistory.size() > widthIncreaseThreshold) {
            width = bigWidth;
        }
        if (creatinineHistory.size() > incrementalIncreaseThreshold) {
            int increments = creatinineHistory.size() % incrementalIncreaseThreshold;
            for (int i = 0; i < increments; i++) {
                width += incrementalIncreaseInPixels;
            }
        }
        ChartUtilities.writeChartAsPNG(outputStream, chart, width, height);
        break;
    }
    case "egfr": {
        ArrayList<ContinuousResult> egfrHistory = (ArrayList<ContinuousResult>) session
                .getAttribute(SessionObjectUtility.EGFR_GRAPH_POINTS);
        DefaultCategoryDataset dataset = new DefaultCategoryDataset();

        /* add the data */
        for (int i = egfrHistory.size() - 1; i > -1; i--) {
            dataset.addValue(egfrHistory.get(i).getValue(), "eGFR", egfrHistory.get(i).getDate());
        }

        /* remove reference */
        session.setAttribute(SessionObjectUtility.EGFR_GRAPH_POINTS, null);

        boolean legend = true;
        boolean tooltips = false;
        boolean urls = false;

        /* get the chart */
        JFreeChart chart = ChartFactory.createLineChart("eGFR History", "dates", "eGFR", dataset,
                PlotOrientation.VERTICAL, legend, tooltips, urls);

        /* angle the x-axis labels */
        CategoryPlot plot = chart.getCategoryPlot();
        CategoryAxis xAxis = (CategoryAxis) plot.getDomainAxis();
        xAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_45);

        chart.setBorderPaint(Color.GREEN);
        chart.setBorderStroke(new BasicStroke(5.0f));
        chart.setBorderVisible(true);

        /* show the healthy target boundaries */
        BigDecimal upper = htr.getEgfr().getUpperBound();
        BigDecimal lower = htr.getEgfr().getLowerBound();
        if (upper != null) {
            ValueMarker marker = new ValueMarker(upper.doubleValue());
            marker.setPaint(Color.YELLOW);
            plot.addRangeMarker(marker);
        }
        if (lower != null) {
            ValueMarker marker = new ValueMarker(lower.doubleValue());
            marker.setPaint(Color.YELLOW);
            plot.addRangeMarker(marker);
        }

        if (egfrHistory.size() > widthIncreaseThreshold) {
            width = bigWidth;
        }
        if (egfrHistory.size() > incrementalIncreaseThreshold) {
            int increments = egfrHistory.size() % incrementalIncreaseThreshold;
            for (int i = 0; i < increments; i++) {
                width += incrementalIncreaseInPixels;
            }
        }
        ChartUtilities.writeChartAsPNG(outputStream, chart, width, height);
        break;
    }
    case "glucose": {
        ArrayList<ContinuousResult> glucoseHistory = (ArrayList<ContinuousResult>) session
                .getAttribute(SessionObjectUtility.GLUCOSE_GRAPH_POINTS);
        DefaultCategoryDataset dataset = new DefaultCategoryDataset();

        /* add the data */
        for (int i = glucoseHistory.size() - 1; i > -1; i--) {
            dataset.addValue(glucoseHistory.get(i).getValue(), "glucose", glucoseHistory.get(i).getDate());
        }

        /* remove reference */
        session.setAttribute(SessionObjectUtility.GLUCOSE_GRAPH_POINTS, null);

        boolean legend = true;
        boolean tooltips = false;
        boolean urls = false;

        /* get the chart */
        JFreeChart chart = ChartFactory.createLineChart("Glucose History", "dates", "glucose", dataset,
                PlotOrientation.VERTICAL, legend, tooltips, urls);

        /* angle the x-axis labels */
        CategoryPlot plot = chart.getCategoryPlot();
        CategoryAxis xAxis = (CategoryAxis) plot.getDomainAxis();
        xAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_45);

        chart.setBorderPaint(Color.GREEN);
        chart.setBorderStroke(new BasicStroke(5.0f));
        chart.setBorderVisible(true);

        /* show the healthy target boundaries */
        BigDecimal upper = htr.getGlucoseAc().getUpperBound();
        BigDecimal lower = htr.getGlucoseAc().getLowerBound();
        if (upper != null) {
            ValueMarker marker = new ValueMarker(upper.doubleValue());
            marker.setPaint(Color.YELLOW);
            plot.addRangeMarker(marker);
        }
        if (lower != null) {
            ValueMarker marker = new ValueMarker(lower.doubleValue());
            marker.setPaint(Color.YELLOW);
            plot.addRangeMarker(marker);
        }

        if (glucoseHistory.size() > widthIncreaseThreshold) {
            width = bigWidth;
        }
        if (glucoseHistory.size() > incrementalIncreaseThreshold) {
            int increments = glucoseHistory.size() % incrementalIncreaseThreshold;
            for (int i = 0; i < increments; i++) {
                width += incrementalIncreaseInPixels;
            }
        }
        ChartUtilities.writeChartAsPNG(outputStream, chart, width, height);
        break;
    }
    case "hdl": {
        ArrayList<ContinuousResult> hdlHistory = (ArrayList<ContinuousResult>) session
                .getAttribute(SessionObjectUtility.HDL_GRAPH_POINTS);
        DefaultCategoryDataset dataset = new DefaultCategoryDataset();

        /* add the data */
        for (int i = hdlHistory.size() - 1; i > -1; i--) {
            dataset.addValue(hdlHistory.get(i).getValue(), "HDL", hdlHistory.get(i).getDate());
        }

        /* remove reference */
        session.setAttribute(SessionObjectUtility.HDL_GRAPH_POINTS, null);

        boolean legend = true;
        boolean tooltips = false;
        boolean urls = false;

        /*get the chart */
        JFreeChart chart = ChartFactory.createLineChart("HDL History", "dates", "HDL", dataset,
                PlotOrientation.VERTICAL, legend, tooltips, urls);

        /* angle the x-axis labels */
        CategoryPlot plot = chart.getCategoryPlot();
        CategoryAxis xAxis = (CategoryAxis) plot.getDomainAxis();
        xAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_45);

        chart.setBorderPaint(Color.GREEN);
        chart.setBorderStroke(new BasicStroke(5.0f));
        chart.setBorderVisible(true);

        /* show the healthy target boundaries */
        BigDecimal upperFemale = htr.getHdlFemale().getUpperBound();
        BigDecimal lowerFemale = htr.getHdlFemale().getLowerBound();
        BigDecimal upperMale = htr.getHdlMale().getUpperBound();
        BigDecimal lowerMale = htr.getHdlMale().getLowerBound();
        if (upperFemale != null) {
            ValueMarker marker = new ValueMarker(upperFemale.doubleValue());
            marker.setPaint(Color.MAGENTA);
            plot.addRangeMarker(marker);
        }
        if (lowerFemale != null) {
            ValueMarker marker = new ValueMarker(lowerFemale.doubleValue());
            marker.setPaint(Color.MAGENTA);
            plot.addRangeMarker(marker);
        }
        if (upperMale != null) {
            ValueMarker marker = new ValueMarker(upperMale.doubleValue());
            marker.setPaint(Color.BLUE);
            plot.addRangeMarker(marker);
        }
        if (lowerMale != null) {
            ValueMarker marker = new ValueMarker(lowerMale.doubleValue());
            marker.setPaint(Color.BLUE);
            plot.addRangeMarker(marker);
        }

        if (hdlHistory.size() > widthIncreaseThreshold) {
            width = bigWidth;
        }
        if (hdlHistory.size() > incrementalIncreaseThreshold) {
            int increments = hdlHistory.size() % incrementalIncreaseThreshold;
            for (int i = 0; i < increments; i++) {
                width += incrementalIncreaseInPixels;
            }
        }
        ChartUtilities.writeChartAsPNG(outputStream, chart, width, height);
        break;
    }
    case "ldl": {
        ArrayList<LdlResult> ldlHistory = (ArrayList<LdlResult>) session
                .getAttribute(SessionObjectUtility.LDL_GRAPH_POINTS);
        DefaultCategoryDataset dataset = new DefaultCategoryDataset();

        /* add the data */
        for (int i = ldlHistory.size() - 1; i > -1; i--) {
            dataset.addValue(ldlHistory.get(i).getValue(), "LDL", ldlHistory.get(i).getDate());
        }

        /* remove reference */
        session.setAttribute(SessionObjectUtility.LDL_GRAPH_POINTS, null);

        boolean legend = true;
        boolean tooltips = false;
        boolean urls = false;

        /* get the chart */
        JFreeChart chart = ChartFactory.createLineChart("LDL History", "dates", "LDL", dataset,
                PlotOrientation.VERTICAL, legend, tooltips, urls);

        /* angle the x-axis labels */
        CategoryPlot plot = chart.getCategoryPlot();
        CategoryAxis xAxis = (CategoryAxis) plot.getDomainAxis();
        xAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_45);

        chart.setBorderPaint(Color.GREEN);
        chart.setBorderStroke(new BasicStroke(5.0f));
        chart.setBorderVisible(true);

        /* show the healthy target boundaries */
        BigDecimal upper = htr.getLdl().getUpperBound();
        BigDecimal lower = htr.getLdl().getLowerBound();
        if (upper != null) {
            ValueMarker marker = new ValueMarker(upper.doubleValue());
            marker.setPaint(Color.YELLOW);
            plot.addRangeMarker(marker);
        }
        if (lower != null) {
            ValueMarker marker = new ValueMarker(lower.doubleValue());
            marker.setPaint(Color.YELLOW);
            plot.addRangeMarker(marker);
        }

        if (ldlHistory.size() > widthIncreaseThreshold) {
            width = bigWidth;
        }
        if (ldlHistory.size() > incrementalIncreaseThreshold) {
            int increments = ldlHistory.size() % incrementalIncreaseThreshold;
            for (int i = 0; i < increments; i++) {
                width += incrementalIncreaseInPixels;
            }
        }
        ChartUtilities.writeChartAsPNG(outputStream, chart, width, height);
        break;
    }
    case "compliance": {
        ArrayList<ContinuousResult> complianceHistory = (ArrayList<ContinuousResult>) session
                .getAttribute(SessionObjectUtility.COMPLIANCE_GRAPH_POINTS);
        DefaultCategoryDataset dataset = new DefaultCategoryDataset();

        /* add the data */
        for (int i = complianceHistory.size() - 1; i > -1; i--) {
            dataset.addValue(complianceHistory.get(i).getValue(), "compliance",
                    complianceHistory.get(i).getDate());
        }

        /* remove reference */
        session.setAttribute(SessionObjectUtility.COMPLIANCE_GRAPH_POINTS, null);

        boolean legend = true;
        boolean tooltips = false;
        boolean urls = false;

        /* get the chart */
        JFreeChart chart = ChartFactory.createLineChart("Compliance History", "dates", "compliance", dataset,
                PlotOrientation.VERTICAL, legend, tooltips, urls);

        /* angle the x-axis labels */
        CategoryPlot plot = chart.getCategoryPlot();
        CategoryAxis xAxis = (CategoryAxis) plot.getDomainAxis();
        xAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_45);

        chart.setBorderPaint(Color.GREEN);
        chart.setBorderStroke(new BasicStroke(5.0f));
        chart.setBorderVisible(true);

        if (complianceHistory.size() > widthIncreaseThreshold) {
            width = bigWidth;
        }
        if (complianceHistory.size() > incrementalIncreaseThreshold) {
            int increments = complianceHistory.size() % incrementalIncreaseThreshold;
            for (int i = 0; i < increments; i++) {
                width += incrementalIncreaseInPixels;
            }
        }
        ChartUtilities.writeChartAsPNG(outputStream, chart, width, height);
        break;
    }
    case "physicalActivity": {
        ArrayList<DiscreteResult> physicalActivityHistory = (ArrayList<DiscreteResult>) session
                .getAttribute(SessionObjectUtility.PHYSICAL_ACTIVITY_GRAPH_POINTS);
        DefaultCategoryDataset dataset = new DefaultCategoryDataset();

        /* add the data */
        for (int i = physicalActivityHistory.size() - 1; i > -1; i--) {
            dataset.addValue(physicalActivityHistory.get(i).getValue(), "physical activity",
                    physicalActivityHistory.get(i).getDate());
        }

        /* remove reference */
        session.setAttribute(SessionObjectUtility.PHYSICAL_ACTIVITY_GRAPH_POINTS, null);

        boolean legend = true;
        boolean tooltips = false;
        boolean urls = false;

        /* get the chart */
        JFreeChart chart = ChartFactory.createLineChart("Physical Activity History", "dates", "min per wk",
                dataset, PlotOrientation.VERTICAL, legend, tooltips, urls);

        /* angle the x-axis labels */
        CategoryPlot plot = chart.getCategoryPlot();
        CategoryAxis xAxis = (CategoryAxis) plot.getDomainAxis();
        xAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_45);

        chart.setBorderPaint(Color.GREEN);
        chart.setBorderStroke(new BasicStroke(5.0f));
        chart.setBorderVisible(true);

        /* show the healthy target boundaries */
        BigDecimal upper = htr.getPhysicalActivity().getUpperBound();
        BigDecimal lower = htr.getPhysicalActivity().getLowerBound();
        if (upper != null) {
            ValueMarker marker = new ValueMarker(upper.doubleValue());
            marker.setPaint(Color.YELLOW);
            plot.addRangeMarker(marker);
        }
        if (lower != null) {
            ValueMarker marker = new ValueMarker(lower.doubleValue());
            marker.setPaint(Color.YELLOW);
            plot.addRangeMarker(marker);
        }

        if (physicalActivityHistory.size() > widthIncreaseThreshold) {
            width = bigWidth;
        }
        if (physicalActivityHistory.size() > incrementalIncreaseThreshold) {
            int increments = physicalActivityHistory.size() % incrementalIncreaseThreshold;
            for (int i = 0; i < increments; i++) {
                width += incrementalIncreaseInPixels;
            }
        }
        ChartUtilities.writeChartAsPNG(outputStream, chart, width, height);
        break;
    }
    case "psychological": {
        ArrayList<PsychologicalScreeningResult> psychologicalHistory = (ArrayList<PsychologicalScreeningResult>) session
                .getAttribute(SessionObjectUtility.PSYCHOLOGICAL_GRAPH_POINTS);
        DefaultCategoryDataset dataset = new DefaultCategoryDataset();

        /* add the data */
        for (int i = psychologicalHistory.size() - 1; i > -1; i--) {
            dataset.addValue(psychologicalHistory.get(i).getScore(), "PHQ9 score",
                    psychologicalHistory.get(i).getDate());
        }

        /* remove reference */
        session.setAttribute(SessionObjectUtility.PSYCHOLOGICAL_GRAPH_POINTS, null);

        boolean legend = true;
        boolean tooltips = false;
        boolean urls = false;

        /* get the chart */
        JFreeChart chart = ChartFactory.createLineChart("Psychological Screening History", "dates", "score",
                dataset, PlotOrientation.VERTICAL, legend, tooltips, urls);

        /* angle the x-axis labels */
        CategoryPlot plot = chart.getCategoryPlot();
        CategoryAxis xAxis = (CategoryAxis) plot.getDomainAxis();
        xAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_45);

        chart.setBorderPaint(Color.GREEN);
        chart.setBorderStroke(new BasicStroke(5.0f));
        chart.setBorderVisible(true);

        if (psychologicalHistory.size() > widthIncreaseThreshold) {
            width = bigWidth;
        }
        if (psychologicalHistory.size() > incrementalIncreaseThreshold) {
            int increments = psychologicalHistory.size() % incrementalIncreaseThreshold;
            for (int i = 0; i < increments; i++) {
                width += incrementalIncreaseInPixels;
            }
        }
        ChartUtilities.writeChartAsPNG(outputStream, chart, width, height);
        break;
    }
    case "t4": {
        ArrayList<ContinuousResult> t4History = (ArrayList<ContinuousResult>) session
                .getAttribute(SessionObjectUtility.T4_GRAPH_POINTS);
        DefaultCategoryDataset dataset = new DefaultCategoryDataset();

        /* add the data */
        for (int i = t4History.size() - 1; i > -1; i--) {
            dataset.addValue(t4History.get(i).getValue(), "T4", t4History.get(i).getDate());
        }

        /* remove reference */
        session.setAttribute(SessionObjectUtility.T4_GRAPH_POINTS, null);

        boolean legend = true;
        boolean tooltips = false;
        boolean urls = false;

        /* get the chart */
        JFreeChart chart = ChartFactory.createLineChart("T4 History", "dates", "T4", dataset,
                PlotOrientation.VERTICAL, legend, tooltips, urls);

        /* angle the x-axis labels */
        CategoryPlot plot = chart.getCategoryPlot();
        CategoryAxis xAxis = (CategoryAxis) plot.getDomainAxis();
        xAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_45);

        chart.setBorderPaint(Color.GREEN);
        chart.setBorderStroke(new BasicStroke(5.0f));
        chart.setBorderVisible(true);

        /* show the healthy target boundaries */
        BigDecimal upper = htr.getT4().getUpperBound();
        BigDecimal lower = htr.getT4().getLowerBound();
        if (upper != null) {
            ValueMarker marker = new ValueMarker(upper.doubleValue());
            marker.setPaint(Color.YELLOW);
            plot.addRangeMarker(marker);
        }
        if (lower != null) {
            ValueMarker marker = new ValueMarker(lower.doubleValue());
            marker.setPaint(Color.YELLOW);
            plot.addRangeMarker(marker);
        }

        if (t4History.size() > widthIncreaseThreshold) {
            width = bigWidth;
        }
        if (t4History.size() > incrementalIncreaseThreshold) {
            int increments = t4History.size() % incrementalIncreaseThreshold;
            for (int i = 0; i < increments; i++) {
                width += incrementalIncreaseInPixels;
            }
        }
        ChartUtilities.writeChartAsPNG(outputStream, chart, width, height);
        break;
    }
    case "triglycerides": {
        ArrayList<ContinuousResult> triglyceridesHistory = (ArrayList<ContinuousResult>) session
                .getAttribute(SessionObjectUtility.TRIGLYCERIDES_GRAPH_POINTS);
        DefaultCategoryDataset dataset = new DefaultCategoryDataset();

        /* add the data */
        for (int i = triglyceridesHistory.size() - 1; i > -1; i--) {
            dataset.addValue(triglyceridesHistory.get(i).getValue(), "triglycerides",
                    triglyceridesHistory.get(i).getDate());
        }

        /* remove reference */
        session.setAttribute(SessionObjectUtility.TRIGLYCERIDES_GRAPH_POINTS, null);

        boolean legend = true;
        boolean tooltips = false;
        boolean urls = false;

        /* get the chart */
        JFreeChart chart = ChartFactory.createLineChart("Triglycerides History", "dates", "triglycerides",
                dataset, PlotOrientation.VERTICAL, legend, tooltips, urls);

        /* angle the x-axis labels */
        CategoryPlot plot = chart.getCategoryPlot();
        CategoryAxis xAxis = (CategoryAxis) plot.getDomainAxis();
        xAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_45);

        chart.setBorderPaint(Color.GREEN);
        chart.setBorderStroke(new BasicStroke(5.0f));
        chart.setBorderVisible(true);

        /* show the healthy target boundaries */
        BigDecimal upper = htr.getTriglycerides().getUpperBound();
        BigDecimal lower = htr.getTriglycerides().getLowerBound();
        if (upper != null) {
            ValueMarker marker = new ValueMarker(upper.doubleValue());
            marker.setPaint(Color.YELLOW);
            plot.addRangeMarker(marker);
        }
        if (lower != null) {
            ValueMarker marker = new ValueMarker(lower.doubleValue());
            marker.setPaint(Color.YELLOW);
            plot.addRangeMarker(marker);
        }

        if (triglyceridesHistory.size() > widthIncreaseThreshold) {
            width = bigWidth;
        }
        if (triglyceridesHistory.size() > incrementalIncreaseThreshold) {
            int increments = triglyceridesHistory.size() % incrementalIncreaseThreshold;
            for (int i = 0; i < increments; i++) {
                width += incrementalIncreaseInPixels;
            }
        }
        ChartUtilities.writeChartAsPNG(outputStream, chart, width, height);
        break;
    }
    case "tsh": {
        ArrayList<TshResult> tshHistory = (ArrayList<TshResult>) session
                .getAttribute(SessionObjectUtility.TSH_GRAPH_POINTS);
        DefaultCategoryDataset dataset = new DefaultCategoryDataset();

        /* add the data */
        for (int i = tshHistory.size() - 1; i > -1; i--) {
            dataset.addValue(tshHistory.get(i).getValue(), "TSH", tshHistory.get(i).getDate());
        }

        /* remove reference */
        session.setAttribute(SessionObjectUtility.TSH_GRAPH_POINTS, null);

        boolean legend = true;
        boolean tooltips = false;
        boolean urls = false;

        /* get the chart */
        JFreeChart chart = ChartFactory.createLineChart("TSH History", "dates", "TSH", dataset,
                PlotOrientation.VERTICAL, legend, tooltips, urls);

        /* angle the x-axis labels */
        CategoryPlot plot = chart.getCategoryPlot();
        CategoryAxis xAxis = (CategoryAxis) plot.getDomainAxis();
        xAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_45);

        chart.setBorderPaint(Color.GREEN);
        chart.setBorderStroke(new BasicStroke(5.0f));
        chart.setBorderVisible(true);

        /* show the healthy target boundaries */
        BigDecimal upper = htr.getTsh().getUpperBound();
        BigDecimal lower = htr.getTsh().getLowerBound();
        if (upper != null) {
            ValueMarker marker = new ValueMarker(upper.doubleValue());
            marker.setPaint(Color.YELLOW);
            plot.addRangeMarker(marker);
        }
        if (lower != null) {
            ValueMarker marker = new ValueMarker(lower.doubleValue());
            marker.setPaint(Color.YELLOW);
            plot.addRangeMarker(marker);
        }

        if (tshHistory.size() > widthIncreaseThreshold) {
            width = bigWidth;
        }
        if (tshHistory.size() > incrementalIncreaseThreshold) {
            int increments = tshHistory.size() % incrementalIncreaseThreshold;
            for (int i = 0; i < increments; i++) {
                width += incrementalIncreaseInPixels;
            }
        }
        ChartUtilities.writeChartAsPNG(outputStream, chart, width, height);
        break;
    }
    case "uacr": {
        ArrayList<ContinuousResult> uacrHistory = (ArrayList<ContinuousResult>) session
                .getAttribute(SessionObjectUtility.UACR_GRAPH_POINTS);
        DefaultCategoryDataset dataset = new DefaultCategoryDataset();

        /* add the data */
        for (int i = uacrHistory.size() - 1; i > -1; i--) {
            dataset.addValue(uacrHistory.get(i).getValue(), "UACR", uacrHistory.get(i).getDate());
        }

        /* remove reference */
        session.setAttribute(SessionObjectUtility.UACR_GRAPH_POINTS, null);

        boolean legend = true;
        boolean tooltips = false;
        boolean urls = false;

        /* get the chart */
        JFreeChart chart = ChartFactory.createLineChart("UACR History", "dates", "UACR", dataset,
                PlotOrientation.VERTICAL, legend, tooltips, urls);

        /* angle the x-axis labels */
        CategoryPlot plot = chart.getCategoryPlot();
        CategoryAxis xAxis = (CategoryAxis) plot.getDomainAxis();
        xAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_45);

        chart.setBorderPaint(Color.GREEN);
        chart.setBorderStroke(new BasicStroke(5.0f));
        chart.setBorderVisible(true);

        /* show the healthy target boundaries */
        BigDecimal upper = htr.getUacr().getUpperBound();
        BigDecimal lower = htr.getUacr().getLowerBound();
        if (upper != null) {
            ValueMarker marker = new ValueMarker(upper.doubleValue());
            marker.setPaint(Color.YELLOW);
            plot.addRangeMarker(marker);
        }
        if (lower != null) {
            ValueMarker marker = new ValueMarker(lower.doubleValue());
            marker.setPaint(Color.YELLOW);
            plot.addRangeMarker(marker);
        }

        if (uacrHistory.size() > widthIncreaseThreshold) {
            width = bigWidth;
        }
        if (uacrHistory.size() > incrementalIncreaseThreshold) {
            int increments = uacrHistory.size() % incrementalIncreaseThreshold;
            for (int i = 0; i < increments; i++) {
                width += incrementalIncreaseInPixels;
            }
        }
        ChartUtilities.writeChartAsPNG(outputStream, chart, width, height);
        break;
    }
    case "waist": {
        ArrayList<ContinuousResult> waistHistory = (ArrayList<ContinuousResult>) session
                .getAttribute(SessionObjectUtility.WAIST_GRAPH_POINTS);
        DefaultCategoryDataset dataset = new DefaultCategoryDataset();

        /* add the data */
        for (int i = waistHistory.size() - 1; i > -1; i--) {
            dataset.addValue(waistHistory.get(i).getValue(), "waist", waistHistory.get(i).getDate());
        }

        /* remove reference */
        session.setAttribute(SessionObjectUtility.WAIST_GRAPH_POINTS, null);

        boolean legend = true;
        boolean tooltips = false;
        boolean urls = false;

        /* get the chart */
        JFreeChart chart = ChartFactory.createLineChart("Waist History", "dates", "waist", dataset,
                PlotOrientation.VERTICAL, legend, tooltips, urls);

        /* angle the x-axis labels */
        CategoryPlot plot = chart.getCategoryPlot();
        CategoryAxis xAxis = (CategoryAxis) plot.getDomainAxis();
        xAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_45);

        chart.setBorderPaint(Color.GREEN);
        chart.setBorderStroke(new BasicStroke(5.0f));
        chart.setBorderVisible(true);

        /* show the healthy target boundaries */
        BigDecimal upperFemale = htr.getWaistFemale().getUpperBound();
        BigDecimal lowerFemale = htr.getWaistFemale().getLowerBound();
        BigDecimal upperMale = htr.getWaistMale().getUpperBound();
        BigDecimal lowerMale = htr.getWaistMale().getLowerBound();
        if (upperFemale != null) {
            ValueMarker marker = new ValueMarker(upperFemale.doubleValue());
            marker.setPaint(Color.MAGENTA);
            plot.addRangeMarker(marker);
        }
        if (lowerFemale != null) {
            ValueMarker marker = new ValueMarker(lowerFemale.doubleValue());
            marker.setPaint(Color.MAGENTA);
            plot.addRangeMarker(marker);
        }
        if (upperMale != null) {
            ValueMarker marker = new ValueMarker(upperMale.doubleValue());
            marker.setPaint(Color.BLUE);
            plot.addRangeMarker(marker);
        }
        if (lowerMale != null) {
            ValueMarker marker = new ValueMarker(lowerMale.doubleValue());
            marker.setPaint(Color.BLUE);
            plot.addRangeMarker(marker);
        }

        if (waistHistory.size() > widthIncreaseThreshold) {
            width = bigWidth;
        }
        if (waistHistory.size() > incrementalIncreaseThreshold) {
            int increments = waistHistory.size() % incrementalIncreaseThreshold;
            for (int i = 0; i < increments; i++) {
                width += incrementalIncreaseInPixels;
            }
        }
        ChartUtilities.writeChartAsPNG(outputStream, chart, width, height);
        break;
    }
    case "agedemographics": {
        DemographicData demographicData = (DemographicData) session
                .getAttribute(SessionObjectUtility.AGE_DEMOGRAPHICS_GRAPH_DATA);
        HistogramDataset dataset = new HistogramDataset();
        ArrayList<Integer> ages = demographicData.getAges();
        if (ages.size() > 0) {
            double[] vector = new double[ages.size()];

            for (int i = 0; i < vector.length; i++) {
                vector[i] = ages.get(i);
            }

            /* add the data */
            dataset.addSeries("number of patients", vector, 10);

            /* remove reference */
            session.setAttribute(SessionObjectUtility.AGE_DEMOGRAPHICS_GRAPH_DATA, null);

            boolean legend = true;
            boolean tooltips = false;
            boolean urls = false;

            /* get the chart */
            JFreeChart chart = ChartFactory.createHistogram("Age Distribution", "age", "number of patients",
                    dataset, PlotOrientation.VERTICAL, legend, tooltips, urls);

            chart.setBorderPaint(Color.GREEN);
            chart.setBorderStroke(new BasicStroke(5.0f));
            chart.setBorderVisible(true);

            XYPlot plot = chart.getXYPlot();

            final XYBarRenderer renderer = (XYBarRenderer) plot.getRenderer();

            /* creating a shadow */
            renderer.setShadowXOffset(4.0);
            renderer.setShadowYOffset(1.5);
            renderer.setShadowVisible(true);

            ChartUtilities.writeChartAsPNG(outputStream, chart, width, height);
        }
        break;
    }
    case "genderdemographics": {
        DemographicData demographicData = (DemographicData) session
                .getAttribute(SessionObjectUtility.GENDER_DEMOGRAPHICS_GRAPH_DATA);
        DefaultPieDataset dataset = new DefaultPieDataset();

        /* add the data */
        dataset.setValue("female", demographicData.getPercentFemale());
        dataset.setValue("male", demographicData.getPercentMale());

        /* remove reference */
        session.setAttribute(SessionObjectUtility.GENDER_DEMOGRAPHICS_GRAPH_DATA, null);

        boolean legend = true;
        boolean tooltips = false;
        boolean urls = false;

        /* get the chart */
        JFreeChart chart = ChartFactory.createPieChart3D("Gender", dataset, legend, tooltips, urls);

        final PiePlot3D plot = (PiePlot3D) chart.getPlot();
        plot.setStartAngle(90);
        plot.setForegroundAlpha(0.60f);
        plot.setInteriorGap(0.02);

        PieSectionLabelGenerator labels = new StandardPieSectionLabelGenerator("{0}: ({2})",
                new DecimalFormat("0"), new DecimalFormat("0%"));
        plot.setLabelGenerator(labels);

        chart.setBorderPaint(Color.GREEN);
        chart.setBorderStroke(new BasicStroke(5.0f));
        chart.setBorderVisible(true);

        ChartUtilities.writeChartAsPNG(outputStream, chart, width, height);
        break;
    }
    case "racedemographics": {
        DemographicData demographicData = (DemographicData) session
                .getAttribute(SessionObjectUtility.RACE_DEMOGRAPHICS_GRAPH_DATA);
        DefaultPieDataset dataset = new DefaultPieDataset();

        /* add the data */
        dataset.setValue("White", demographicData.getPercentWhite());
        dataset.setValue("African American", demographicData.getPercentAfricanAmerican());
        dataset.setValue("Asian/Pacific Islander", demographicData.getPercentAsian());
        dataset.setValue("American Indian/Alaska Native", demographicData.getPercentIndian());
        dataset.setValue("Hispanic", demographicData.getPercentHispanic());
        dataset.setValue("Middle Eastern", demographicData.getPercentMiddleEastern());
        dataset.setValue("Other", demographicData.getPercentOther());

        /* remove reference */
        session.setAttribute(SessionObjectUtility.RACE_DEMOGRAPHICS_GRAPH_DATA, null);

        boolean legend = true;
        boolean tooltips = false;
        boolean urls = false;

        /* get the chart */
        JFreeChart chart = ChartFactory.createPieChart3D("Race", dataset, legend, tooltips, urls);

        final PiePlot3D plot = (PiePlot3D) chart.getPlot();
        plot.setStartAngle(90);
        plot.setForegroundAlpha(0.60f);
        plot.setInteriorGap(0.02);

        PieSectionLabelGenerator labels = new StandardPieSectionLabelGenerator("{0}: ({2})",
                new DecimalFormat("0"), new DecimalFormat("0%"));
        plot.setLabelGenerator(labels);

        chart.setBorderPaint(Color.GREEN);
        chart.setBorderStroke(new BasicStroke(5.0f));
        chart.setBorderVisible(true);

        ChartUtilities.writeChartAsPNG(outputStream, chart, width, height);
        break;
    }
    case "lasta1c": {
        Stats glycemicStats = (Stats) session.getAttribute(SessionObjectUtility.LAST_A1C_DATA);
        HistogramDataset dataset = new HistogramDataset();
        ArrayList<CategoricalValue> lastA1cValues = new ArrayList<>();

        if (glycemicStats.getGroups() != null) {
            int i;
            for (i = 0; i < glycemicStats.getGroups().size(); i++) {
                if (glycemicStats.getGroups().get(i) != null) {
                    lastA1cValues.addAll(glycemicStats.getGroups().get(i));
                }
            }
        }
        if (lastA1cValues.size() > 0) {
            double[] vector = new double[lastA1cValues.size()];

            for (int i = 0; i < vector.length; i++) {
                vector[i] = lastA1cValues.get(i).getValue().doubleValue();
            }

            /* add the data */
            dataset.addSeries("number of patients", vector, 15);

            /* remove reference */
            session.setAttribute(SessionObjectUtility.LAST_A1C_DATA, null);

            boolean legend = true;
            boolean tooltips = false;
            boolean urls = false;

            /* get the chart */
            JFreeChart chart = ChartFactory.createHistogram("Most Recent A1C Values", "last A1C(%)",
                    "number of patients", dataset, PlotOrientation.VERTICAL, legend, tooltips, urls);

            chart.setBorderPaint(Color.GREEN);
            chart.setBorderStroke(new BasicStroke(5.0f));
            chart.setBorderVisible(true);

            XYPlot plot = chart.getXYPlot();

            final XYBarRenderer renderer = (XYBarRenderer) plot.getRenderer();

            /* creating a shadow */
            renderer.setShadowXOffset(4.0);
            renderer.setShadowYOffset(1.5);
            renderer.setShadowVisible(true);

            ChartUtilities.writeChartAsPNG(outputStream, chart, width, height);
        }
        break;
    }
    case "lasta1cbyclassattendance": {
        final int topGroupIndex = 4;
        Stats glycemicStats = (Stats) session.getAttribute(SessionObjectUtility.LAST_A1C_BY_CLASS_DATA);

        DefaultBoxAndWhiskerCategoryDataset dataset = new DefaultBoxAndWhiskerCategoryDataset();

        if (glycemicStats.getGroups() != null) {
            for (int i = 0; i < glycemicStats.getGroups().size(); i++) {
                if ((glycemicStats.getGroups().get(i) != null)
                        && (!glycemicStats.getGroups().get(i).isEmpty())) {
                    List values = new ArrayList();
                    for (CategoricalValue cv : glycemicStats.getGroups().get(i)) {
                        values.add(cv.getValue());
                    }
                    if (i == topGroupIndex) {
                        dataset.add(BoxAndWhiskerCalculator.calculateBoxAndWhiskerStatistics(values),
                                "last A1C(%)", "5 or more");
                    } else {
                        dataset.add(BoxAndWhiskerCalculator.calculateBoxAndWhiskerStatistics(values),
                                "last A1C(%)", i + 1);
                    }
                }
            }
        }

        /* remove reference */
        session.setAttribute(SessionObjectUtility.LAST_A1C_BY_CLASS_DATA, null);

        CategoryAxis domainAxis = new CategoryAxis("number of classes attended");
        NumberAxis rangeAxis = new NumberAxis("last A1C(%)");
        BoxAndWhiskerRenderer renderer = new BoxAndWhiskerRenderer();
        CategoryPlot plot = new CategoryPlot(dataset, domainAxis, rangeAxis, renderer);
        JFreeChart chart = new JFreeChart("Most Recent A1C by Classes Attended", plot);
        renderer.setMeanVisible(false);

        chart.setBorderPaint(Color.GREEN);
        chart.setBorderStroke(new BasicStroke(5.0f));
        chart.setBorderVisible(true);

        ChartUtilities.writeChartAsPNG(outputStream, chart, width, height);
        break;
    }
    case "lastbmimales": {
        Stats bmiMalesStats = (Stats) session.getAttribute(SessionObjectUtility.LAST_BMI_MALES_DATA);
        HistogramDataset dataset = new HistogramDataset();
        ArrayList<CategoricalValue> lastBmiMalesValues = new ArrayList<>();
        if ((bmiMalesStats.getGroups() != null) && (!bmiMalesStats.getGroups().isEmpty())) {
            for (int i = 0; i < bmiMalesStats.getGroups().size(); i++) {
                if (bmiMalesStats.getGroups().get(i) != null) {
                    lastBmiMalesValues.addAll(bmiMalesStats.getGroups().get(i));
                }
            }
        }
        if (lastBmiMalesValues.size() > 0) {
            double[] vector = new double[lastBmiMalesValues.size()];

            for (int i = 0; i < vector.length; i++) {
                vector[i] = lastBmiMalesValues.get(i).getValue().doubleValue();
            }

            /* add the data */
            dataset.addSeries("number of patients", vector, 15);

            /* remove reference */
            session.setAttribute(SessionObjectUtility.LAST_BMI_MALES_DATA, null);

            boolean legend = true;
            boolean tooltips = false;
            boolean urls = false;

            /* get the chart */
            JFreeChart chart = ChartFactory.createHistogram("Most Recent BMI Values for Males", "last BMI",
                    "number of patients", dataset, PlotOrientation.VERTICAL, legend, tooltips, urls);

            chart.setBorderPaint(Color.GREEN);
            chart.setBorderStroke(new BasicStroke(5.0f));
            chart.setBorderVisible(true);

            XYPlot plot = chart.getXYPlot();

            final XYBarRenderer renderer = (XYBarRenderer) plot.getRenderer();

            /* creating a shadow */
            renderer.setShadowXOffset(4.0);
            renderer.setShadowYOffset(1.5);
            renderer.setShadowVisible(true);

            ChartUtilities.writeChartAsPNG(outputStream, chart, width, height);
        }
        break;
    }
    case "lastbmifemales": {
        Stats bmiFemalesStats = (Stats) session.getAttribute(SessionObjectUtility.LAST_BMI_FEMALES_DATA);
        HistogramDataset dataset = new HistogramDataset();
        ArrayList<CategoricalValue> lastBmiFemalesValues = new ArrayList<>();
        if ((bmiFemalesStats.getGroups() != null) && (!bmiFemalesStats.getGroups().isEmpty())) {
            for (int i = 0; i < bmiFemalesStats.getGroups().size(); i++) {
                if (bmiFemalesStats.getGroups().get(i) != null) {
                    lastBmiFemalesValues.addAll(bmiFemalesStats.getGroups().get(i));
                }
            }
        }
        if (lastBmiFemalesValues.size() > 0) {
            double[] vector = new double[lastBmiFemalesValues.size()];

            for (int i = 0; i < vector.length; i++) {
                vector[i] = lastBmiFemalesValues.get(i).getValue().doubleValue();
            }

            /* add the data */
            dataset.addSeries("number of patients", vector, 15);

            /* remove reference */
            session.setAttribute(SessionObjectUtility.LAST_BMI_FEMALES_DATA, null);

            boolean legend = true;
            boolean tooltips = false;
            boolean urls = false;

            /* get the chart */
            JFreeChart chart = ChartFactory.createHistogram("Most Recent BMI Values for Females", "last BMI",
                    "number of patients", dataset, PlotOrientation.VERTICAL, legend, tooltips, urls);

            chart.setBorderPaint(Color.GREEN);
            chart.setBorderStroke(new BasicStroke(5.0f));
            chart.setBorderVisible(true);

            XYPlot plot = chart.getXYPlot();

            final XYBarRenderer renderer = (XYBarRenderer) plot.getRenderer();

            /* creating a shadow */
            renderer.setShadowXOffset(4.0);
            renderer.setShadowYOffset(1.5);
            renderer.setShadowVisible(true);

            ChartUtilities.writeChartAsPNG(outputStream, chart, width, height);
        }
        break;
    }
    case "lastbmimalesbyclassattendance": {
        final int topGroupIndex = 4;
        Stats bmiMalesStats = (Stats) session.getAttribute(SessionObjectUtility.LAST_BMI_MALES_BY_CLASS_DATA);

        DefaultBoxAndWhiskerCategoryDataset dataset = new DefaultBoxAndWhiskerCategoryDataset();

        if (bmiMalesStats.getGroups() != null) {
            for (int i = 0; i < bmiMalesStats.getGroups().size(); i++) {
                if ((bmiMalesStats.getGroups().get(i) != null)
                        && (!bmiMalesStats.getGroups().get(i).isEmpty())) {
                    List values = new ArrayList();
                    for (CategoricalValue cv : bmiMalesStats.getGroups().get(i)) {
                        values.add(cv.getValue());
                    }
                    if (i == topGroupIndex) {
                        dataset.add(BoxAndWhiskerCalculator.calculateBoxAndWhiskerStatistics(values),
                                "last BMI (males)", "5 or more");
                    } else {
                        dataset.add(BoxAndWhiskerCalculator.calculateBoxAndWhiskerStatistics(values),
                                "last BMI (males)", i + 1);
                    }
                }
            }
        }

        /* remove reference */
        session.setAttribute(SessionObjectUtility.LAST_BMI_MALES_BY_CLASS_DATA, null);

        CategoryAxis domainAxis = new CategoryAxis("number of classes attended");
        NumberAxis rangeAxis = new NumberAxis("last BMI (males)");
        BoxAndWhiskerRenderer renderer = new BoxAndWhiskerRenderer();
        CategoryPlot plot = new CategoryPlot(dataset, domainAxis, rangeAxis, renderer);
        JFreeChart chart = new JFreeChart("Most Recent BMI for Males by Classes Attended", plot);
        renderer.setMeanVisible(false);

        chart.setBorderPaint(Color.GREEN);
        chart.setBorderStroke(new BasicStroke(5.0f));
        chart.setBorderVisible(true);

        ChartUtilities.writeChartAsPNG(outputStream, chart, width, height);
        break;
    }
    case "lastbmifemalesbyclassattendance": {
        final int topGroupIndex = 4;
        Stats bmiFemalesStats = (Stats) session
                .getAttribute(SessionObjectUtility.LAST_BMI_FEMALES_BY_CLASS_DATA);

        DefaultBoxAndWhiskerCategoryDataset dataset = new DefaultBoxAndWhiskerCategoryDataset();

        if (bmiFemalesStats.getGroups() != null) {
            for (int i = 0; i < bmiFemalesStats.getGroups().size(); i++) {
                if ((bmiFemalesStats.getGroups().get(i) != null)
                        && (!bmiFemalesStats.getGroups().get(i).isEmpty())) {
                    List values = new ArrayList();
                    for (CategoricalValue cv : bmiFemalesStats.getGroups().get(i)) {
                        values.add(cv.getValue());
                    }
                    if (i == topGroupIndex) {
                        dataset.add(BoxAndWhiskerCalculator.calculateBoxAndWhiskerStatistics(values),
                                "last BMI (females)", "5 or more");
                    } else {
                        dataset.add(BoxAndWhiskerCalculator.calculateBoxAndWhiskerStatistics(values),
                                "last BMI (females)", i + 1);
                    }
                }
            }
        }

        /* remove reference */
        session.setAttribute(SessionObjectUtility.LAST_BMI_FEMALES_BY_CLASS_DATA, null);

        CategoryAxis domainAxis = new CategoryAxis("number of classes attended");
        NumberAxis rangeAxis = new NumberAxis("last BMI (females)");
        BoxAndWhiskerRenderer renderer = new BoxAndWhiskerRenderer();
        CategoryPlot plot = new CategoryPlot(dataset, domainAxis, rangeAxis, renderer);
        JFreeChart chart = new JFreeChart("Most Recent BMI for Females by Classes Attended", plot);
        renderer.setMeanVisible(false);

        chart.setBorderPaint(Color.GREEN);
        chart.setBorderStroke(new BasicStroke(5.0f));
        chart.setBorderVisible(true);

        ChartUtilities.writeChartAsPNG(outputStream, chart, width, height);
        break;
    }
    case "lasta1cbytreatment": {
        final int firstIndex = 0;
        Stats glycemicStats = (Stats) session.getAttribute(SessionObjectUtility.LAST_A1C_BY_TREATMENT);

        DefaultBoxAndWhiskerCategoryDataset dataset = new DefaultBoxAndWhiskerCategoryDataset();

        if (glycemicStats.getGroups() != null) {
            for (int i = 0; i < glycemicStats.getGroups().size(); i++) {
                if ((glycemicStats.getGroups().get(i) != null)
                        && (!glycemicStats.getGroups().get(i).isEmpty())) {
                    String category = glycemicStats.getGroups().get(i).get(firstIndex) != null
                            ? glycemicStats.getGroups().get(i).get(firstIndex).getCategory()
                            : "";
                    List values = new ArrayList();
                    for (CategoricalValue cv : glycemicStats.getGroups().get(i)) {
                        values.add(cv.getValue());
                    }
                    dataset.add(BoxAndWhiskerCalculator.calculateBoxAndWhiskerStatistics(values), "last A1C(%)",
                            category);
                }
            }
        }

        /* remove reference */
        session.setAttribute(SessionObjectUtility.LAST_A1C_BY_TREATMENT, null);

        CategoryAxis domainAxis = new CategoryAxis("treatment class");
        NumberAxis rangeAxis = new NumberAxis("last A1C(%)");
        BoxAndWhiskerRenderer renderer = new BoxAndWhiskerRenderer();
        CategoryPlot plot = new CategoryPlot(dataset, domainAxis, rangeAxis, renderer);
        JFreeChart chart = new JFreeChart("Most Recent A1C by Treatment Class", plot);
        renderer.setMeanVisible(false);

        chart.setBorderPaint(Color.GREEN);
        chart.setBorderStroke(new BasicStroke(5.0f));
        chart.setBorderVisible(true);

        ChartUtilities.writeChartAsPNG(outputStream, chart, width, height);
        break;
    }
    case "treatmentclasscounts": {
        int treatmentClassCountsIndex = 1;

        Stats treatmentData = (Stats) session.getAttribute(SessionObjectUtility.CLASS_COUNTS_TREATMENT_STATS);
        DefaultPieDataset dataset = new DefaultPieDataset();

        /* add the treatment data to the dataset */
        for (int i = 0; i < treatmentClassUnknownIndex + 1; i++) {
            dataset.setValue(treatmentData.getGroups().get(treatmentClassCountsIndex).get(i).getCategory(),
                    treatmentData.getGroups().get(treatmentClassCountsIndex).get(i).getValue());
        }

        /* remove reference */
        session.setAttribute(SessionObjectUtility.CLASS_COUNTS_TREATMENT_STATS, null);

        boolean legend = true;
        boolean tooltips = false;
        boolean urls = false;

        /* get the chart */
        JFreeChart chart = ChartFactory.createPieChart3D("Treatment Class", dataset, legend, tooltips, urls);

        final PiePlot3D plot = (PiePlot3D) chart.getPlot();
        plot.setStartAngle(90);
        plot.setForegroundAlpha(0.60f);
        plot.setInteriorGap(0.02);

        PieSectionLabelGenerator labels = new StandardPieSectionLabelGenerator("{0}: {1} ({2})",
                new DecimalFormat("0"), new DecimalFormat("0%"));
        plot.setLabelGenerator(labels);

        chart.setBorderPaint(Color.GREEN);
        chart.setBorderStroke(new BasicStroke(5.0f));
        chart.setBorderVisible(true);

        ChartUtilities.writeChartAsPNG(outputStream, chart, width, height);
        break;
    }
    case "treatmentgenderclasscounts": {
        int maleClassCountsIndex = 2;
        int femaleClassCountsIndex = 3;

        Stats treatmentData = (Stats) session
                .getAttribute(SessionObjectUtility.GENDER_CLASS_COUNTS_TREATMENT_STATS);
        final DefaultCategoryDataset dataset = new DefaultCategoryDataset();

        HashMap<Integer, String> genderMap = new HashMap<>();
        genderMap.put(maleClassCountsIndex, "Male");
        genderMap.put(femaleClassCountsIndex, "Female");

        /* load data for males and females into the dataset */
        for (int i = femaleClassCountsIndex; i > maleClassCountsIndex - 1; i--) {
            for (int j = 0; j < treatmentClassUnknownIndex + 1; j++) {
                dataset.addValue(treatmentData.getGroups().get(i).get(j).getValue(), genderMap.get(i),
                        treatmentData.getGroups().get(i).get(j).getCategory());
            }
        }

        /* remove reference */
        session.setAttribute(SessionObjectUtility.GENDER_CLASS_COUNTS_TREATMENT_STATS, null);

        boolean legend = true;
        boolean tooltips = false;
        boolean urls = false;

        JFreeChart barChart = ChartFactory.createBarChart("Treatment Class by Gender", "Treatment Class",
                "Number of Patients", dataset, PlotOrientation.VERTICAL, legend, tooltips, urls);

        barChart.setBorderPaint(Color.GREEN);
        barChart.setBorderStroke(new BasicStroke(5.0f));
        barChart.setBorderVisible(true);

        CategoryPlot plot = barChart.getCategoryPlot();

        final BarRenderer renderer = (BarRenderer) plot.getRenderer();

        /* creating a shadow */
        renderer.setShadowXOffset(4.0);
        renderer.setShadowYOffset(1.5);
        renderer.setShadowVisible(true);

        ChartUtilities.writeChartAsPNG(outputStream, barChart, width, height);

        break;
    }
    case "treatmentraceclasscounts": {
        int whiteClassCountsIndex = 4;
        int africanAmericanClassCountsIndex = 5;
        int asianPacificIslanderClassCountsIndex = 6;
        int americanIndianAlaskaNativeClassCountsIndex = 7;
        int hispanicClassCountsIndex = 8;
        int middleEasternClassCountsIndex = 9;
        int otherClassCountsIndex = 10;

        Stats treatmentData = (Stats) session
                .getAttribute(SessionObjectUtility.RACE_CLASS_COUNTS_TREATMENT_STATS);
        final DefaultCategoryDataset dataset = new DefaultCategoryDataset();

        HashMap<Integer, String> raceMap = new HashMap<>();
        raceMap.put(whiteClassCountsIndex, "White");
        raceMap.put(africanAmericanClassCountsIndex, "African American");
        raceMap.put(asianPacificIslanderClassCountsIndex, "Asian/Pacific Islander");
        raceMap.put(americanIndianAlaskaNativeClassCountsIndex, "American Indian/Alaska Native");
        raceMap.put(hispanicClassCountsIndex, "Hispanic");
        raceMap.put(middleEasternClassCountsIndex, "Middle Eastern");
        raceMap.put(otherClassCountsIndex, "Other");

        /* load data for each race into the dataset */
        for (int i = whiteClassCountsIndex; i < otherClassCountsIndex + 1; i++) {
            for (int j = 0; j < treatmentClassUnknownIndex + 1; j++) {
                dataset.addValue(treatmentData.getGroups().get(i).get(j).getValue(), raceMap.get(i),
                        treatmentData.getGroups().get(i).get(j).getCategory());
            }
        }

        /* remove reference */
        session.setAttribute(SessionObjectUtility.RACE_CLASS_COUNTS_TREATMENT_STATS, null);

        boolean legend = true;
        boolean tooltips = false;
        boolean urls = false;

        JFreeChart barChart = ChartFactory.createStackedBarChart("Treatment Class by Race", "Treatment Class",
                "Number of Patients", dataset, PlotOrientation.VERTICAL, legend, tooltips, urls);

        barChart.setBorderPaint(Color.GREEN);
        barChart.setBorderStroke(new BasicStroke(5.0f));
        barChart.setBorderVisible(true);

        CategoryPlot plot = barChart.getCategoryPlot();

        final BarRenderer renderer = (BarRenderer) plot.getRenderer();

        /* creating a shadow */
        renderer.setShadowXOffset(4.0);
        renderer.setShadowYOffset(1.5);
        renderer.setShadowVisible(true);

        ChartUtilities.writeChartAsPNG(outputStream, barChart, width, height);

        break;
    }
    default:
        break;
    }
}

From source file:gov.nih.nci.caintegrator.common.Cai2Util.java

/**
 * Used by classes to retrieve a color based on a number from a ten color palette.
 * (1-10) are colors and anything else returns black.
 * @param colorNumber - number to use.//from  w w  w .j  a v a2  s  .c  om
 * @return - Color object for that number.
 */
public static Color getBasicColor(int colorNumber) {
    switch (colorNumber) {
    case 1:
        return Color.GREEN;
    case 2:
        return Color.BLUE;
    case 3:
        return Color.RED;
    case 4:
        return Color.CYAN;
    case 5:
        return Color.DARK_GRAY;
    case 6:
        return Color.YELLOW;
    case 7:
        return Color.LIGHT_GRAY;
    case 8:
        return Color.MAGENTA;
    case 9:
        return Color.ORANGE;
    case 10:
        return Color.PINK;
    default:
        return Color.BLACK;
    }
}

From source file:com.tiempometa.muestradatos.JProgramTags.java

private void initComponents() {
    // JFormDesigner - Component initialization - DO NOT MODIFY
    // //GEN-BEGIN:initComponents
    ResourceBundle bundle = ResourceBundle.getBundle("com.tiempometa.muestradatos.muestradatos");
    dialogPane = new JPanel();
    contentPanel = new JPanel();
    label1 = new JLabel();
    statusLabel = new JLabel();
    nextChipnumberTextField = new JTextField();
    programButton = new JButton();
    bibLabel = new JLabel();
    label3 = new JLabel();
    tidTextField = new JTextField();
    label4 = new JLabel();
    epcTextField = new JTextField();
    label5 = new JLabel();
    programmedEpcTextField = new JTextField();
    scrollPane1 = new JScrollPane();
    tagReadTable = new JTable();
    lockCheckbox = new JCheckBox();
    label2 = new JLabel();
    accessPasswordTextField = new JTextField();
    label6 = new JLabel();
    killPasswordTextField = new JTextField();
    checkBox1 = new JCheckBox();
    buttonBar = new JPanel();
    closeButton = new JButton();
    CellConstraints cc = new CellConstraints();

    // ======== this ========
    setTitle(bundle.getString("JProgramTags.this.title"));
    setIconImage(//from  w w  w .java2s.com
            new ImageIcon(getClass().getResource("/com/tiempometa/resources/tiempometa_icon_large_alpha.png"))
                    .getImage());
    setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    Container contentPane = getContentPane();
    contentPane.setLayout(new BorderLayout());

    // ======== dialogPane ========
    {
        dialogPane.setBorder(Borders.DIALOG_BORDER);
        dialogPane.setLayout(new BorderLayout());

        // ======== contentPanel ========
        {
            contentPanel.setFont(new Font("Tahoma", Font.PLAIN, 14));
            contentPanel.setLayout(new FormLayout(
                    new ColumnSpec[] { new ColumnSpec(Sizes.dluX(12)), FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
                            new ColumnSpec(Sizes.dluX(86)), FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
                            new ColumnSpec(Sizes.dluX(73)), FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
                            new ColumnSpec(Sizes.dluX(71)), FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
                            new ColumnSpec(Sizes.dluX(68)), FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
                            new ColumnSpec(Sizes.dluX(97)) },
                    new RowSpec[] { new RowSpec(Sizes.dluY(10)), FormFactory.LINE_GAP_ROWSPEC,
                            new RowSpec(Sizes.dluY(15)), FormFactory.LINE_GAP_ROWSPEC,
                            FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC,
                            FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC,
                            new RowSpec(Sizes.dluY(17)), FormFactory.LINE_GAP_ROWSPEC,
                            FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC,
                            FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC,
                            FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC,
                            FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC,
                            FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC,
                            FormFactory.DEFAULT_ROWSPEC }));

            // ---- label1 ----
            label1.setText(bundle.getString("JProgramTags.label1.text"));
            label1.setFont(new Font("Tahoma", Font.PLAIN, 36));
            contentPanel.add(label1, cc.xywh(3, 5, 3, 1));

            // ---- statusLabel ----
            statusLabel.setText(bundle.getString("JProgramTags.statusLabel.text"));
            statusLabel.setHorizontalAlignment(SwingConstants.CENTER);
            statusLabel.setBackground(Color.yellow);
            statusLabel.setOpaque(true);
            statusLabel.setFont(new Font("Tahoma", Font.BOLD, 20));
            contentPanel.add(statusLabel, cc.xywh(9, 3, 3, 5));

            // ---- nextChipnumberTextField ----
            nextChipnumberTextField.setFont(new Font("Tahoma", Font.PLAIN, 36));
            contentPanel.add(nextChipnumberTextField, cc.xy(7, 5));

            // ---- programButton ----
            programButton.setText(bundle.getString("JProgramTags.programButton.text"));
            programButton.setFont(new Font("Tahoma", Font.PLAIN, 14));
            programButton.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    programButtonActionPerformed(e);
                }
            });
            contentPanel.add(programButton, cc.xywh(3, 7, 3, 1));

            // ---- bibLabel ----
            bibLabel.setForeground(Color.red);
            bibLabel.setFont(new Font("Tahoma", Font.BOLD, 36));
            bibLabel.setHorizontalAlignment(SwingConstants.CENTER);
            contentPanel.add(bibLabel, cc.xy(11, 9));

            // ---- label3 ----
            label3.setText(bundle.getString("JProgramTags.label3.text"));
            label3.setFont(new Font("Tahoma", Font.PLAIN, 14));
            contentPanel.add(label3, cc.xy(7, 11));

            // ---- tidTextField ----
            tidTextField.setEditable(false);
            tidTextField.setFont(new Font("Tahoma", Font.PLAIN, 14));
            contentPanel.add(tidTextField, cc.xywh(9, 11, 3, 1));

            // ---- label4 ----
            label4.setText(bundle.getString("JProgramTags.label4.text"));
            label4.setFont(new Font("Tahoma", Font.PLAIN, 14));
            contentPanel.add(label4, cc.xy(7, 13));

            // ---- epcTextField ----
            epcTextField.setEditable(false);
            epcTextField.setFont(new Font("Tahoma", Font.PLAIN, 14));
            contentPanel.add(epcTextField, cc.xywh(9, 13, 3, 1));

            // ---- label5 ----
            label5.setText(bundle.getString("JProgramTags.label5.text"));
            label5.setFont(new Font("Tahoma", Font.PLAIN, 14));
            contentPanel.add(label5, cc.xy(7, 15));

            // ---- programmedEpcTextField ----
            programmedEpcTextField.setEditable(false);
            programmedEpcTextField.setFont(new Font("Tahoma", Font.PLAIN, 14));
            contentPanel.add(programmedEpcTextField, cc.xywh(9, 15, 3, 1));

            // ======== scrollPane1 ========
            {
                scrollPane1.setViewportView(tagReadTable);
            }
            contentPanel.add(scrollPane1, cc.xywh(3, 17, 9, 1));

            // ---- lockCheckbox ----
            lockCheckbox.setText(bundle.getString("JProgramTags.lockCheckbox.text"));
            lockCheckbox.setSelected(true);
            lockCheckbox.setFont(new Font("Tahoma", Font.PLAIN, 14));
            lockCheckbox.addItemListener(new ItemListener() {
                @Override
                public void itemStateChanged(ItemEvent e) {
                    checkBox2ItemStateChanged(e);
                }
            });
            contentPanel.add(lockCheckbox, cc.xy(3, 19));

            // ---- label2 ----
            label2.setText(bundle.getString("JProgramTags.label2.text"));
            label2.setFont(new Font("Tahoma", Font.PLAIN, 14));
            contentPanel.add(label2, cc.xy(5, 19));

            // ---- accessPasswordTextField ----
            accessPasswordTextField.setFont(new Font("Tahoma", Font.PLAIN, 14));
            contentPanel.add(accessPasswordTextField, cc.xy(7, 19));

            // ---- label6 ----
            label6.setText(bundle.getString("JProgramTags.label6.text"));
            label6.setFont(new Font("Tahoma", Font.PLAIN, 14));
            contentPanel.add(label6, cc.xy(5, 21));

            // ---- killPasswordTextField ----
            killPasswordTextField.setFont(new Font("Tahoma", Font.PLAIN, 14));
            contentPanel.add(killPasswordTextField, cc.xy(7, 21));

            // ---- checkBox1 ----
            checkBox1.setText(bundle.getString("JProgramTags.checkBox1.text"));
            checkBox1.setEnabled(false);
            contentPanel.add(checkBox1, cc.xy(9, 21));
        }
        dialogPane.add(contentPanel, BorderLayout.EAST);

        // ======== buttonBar ========
        {
            buttonBar.setBorder(Borders.BUTTON_BAR_GAP_BORDER);
            buttonBar.setLayout(
                    new FormLayout(new ColumnSpec[] { FormFactory.GLUE_COLSPEC, FormFactory.BUTTON_COLSPEC },
                            RowSpec.decodeSpecs("pref")));

            // ---- closeButton ----
            closeButton.setText("Cerrar");
            closeButton.setFont(new Font("Tahoma", Font.PLAIN, 14));
            closeButton.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    closeButtonActionPerformed(e);
                }
            });
            buttonBar.add(closeButton, cc.xy(2, 1));
        }
        dialogPane.add(buttonBar, BorderLayout.SOUTH);
    }
    contentPane.add(dialogPane, BorderLayout.CENTER);
    setSize(700, 625);
    setLocationRelativeTo(getOwner());
    // //GEN-END:initComponents
}

From source file:GUI.Statistique.java

private void bilanFinanciereParMois() {
    float janvier = 0;
    float fevrier = 0;
    float mars = 0;
    float avril = 0;
    float mai = 0;
    float juin = 0;
    float juillet = 0;
    float aout = 0;
    float septembre = 0;
    float octobre = 0;
    float novembre = 0;
    float decembre = 0;
    CommandeDAO commandeDAO = new CommandeDAO();
    List<Commande> commandes = new ArrayList<>();
    commandes = commandeDAO.findAll();// w w  w . j  a  va 2s.  co m
    for (Commande commande : commandes) {

        if (commande.getDatecommande().getYear() + 1900 == 2016) {
            switch (commande.getDatecommande().getMonth()) {
            case 0:
                janvier += commande.getTotalcommande();
                break;
            case 1:
                fevrier += commande.getTotalcommande();
                break;
            case 2:
                mars += commande.getTotalcommande();
                break;
            case 3:
                avril += commande.getTotalcommande();
                break;
            case 4:
                mai += commande.getTotalcommande();
                break;
            case 5:
                juin += commande.getTotalcommande();
                break;
            case 6:
                juillet += commande.getTotalcommande();
                break;
            case 7:
                aout += commande.getTotalcommande();
                break;
            case 8:
                septembre += commande.getTotalcommande();
                break;
            case 9:
                novembre += commande.getTotalcommande();
                break;
            case 10:
                octobre += commande.getTotalcommande();
                break;
            case 11:
                decembre += commande.getTotalcommande();
                break;
            }
        }
    }
    DefaultCategoryDataset dSet = new DefaultCategoryDataset();
    dSet.addValue(janvier, "Janvier", "Janvier");
    dSet.addValue(fevrier, "Fevrier", "Fevrier");
    dSet.addValue(mars, "Mars", "Mars");
    dSet.addValue(avril, "Avril", "Avril");
    dSet.addValue(mai, "Mai", "Mai");
    dSet.addValue(juin, "Juin", "Juin");
    dSet.addValue(juillet, "Juillet", "Juillet");
    dSet.addValue(aout, "Aout", "Aout");
    dSet.addValue(septembre, "Septembre", "Janvier");
    dSet.addValue(octobre, "Octobre", "Fevrier");
    dSet.addValue(novembre, "Novemvre", "Novembre");
    dSet.addValue(decembre, "Decembre", "Decembre");
    JFreeChart chart = ChartFactory.createBarChart3D("Rapport financier", "Rvenus", "Montant (DT)", dSet,
            PlotOrientation.VERTICAL, true, true, true);
    chart.setBackgroundPaint(Color.yellow);
    chart.getTitle().setPaint(Color.RED);
    CategoryPlot p = chart.getCategoryPlot();
    p.setRangeGridlinePaint(Color.black);
    ChartPanel cp = new ChartPanel(chart, true, true, true, false, true);
    ChartFrame f = new ChartFrame("try", chart);
    //JFrame f =new JFrame();
    f.setContentPane(cp);
    f.pack();
    //f.setVisible(true);
    // f.setSize(panelRevDep.getWidth()-20,panelRevDep.getHeight()-20);
    // f.setVisible(true);
    // panelRevDep.removeAll();
    //panelRevDep.repaint();
    jpProduit.add(cp);

}

From source file:com.polivoto.vistas.acciones.Datos.java

private void setcolors() {
    colores.add(Color.red);//from   w  w  w . java2  s  .  c  o m
    colores.add(Color.green);
    colores.add(Color.blue);
    colores.add(Color.yellow);
    colores.add(Color.magenta);
    colores.add(Color.cyan);
    colores.add(Color.pink);
    colores.add(Color.orange);
    colores.add(Color.darkGray);
    colores.add(Color.white);
}

From source file:org.tsho.dmc2.core.chart.TrajectoryMultiRenderer.java

public LegendItemCollection getLegendItems() {

    Stroke stroke = new BasicStroke(1.0f, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_BEVEL);
    Shape shape = new Rectangle2D.Double(-3, -3, 6, 6);

    LegendItemCollection legendItems = new LegendItemCollection();

    for (int i = 0; i < stepperList.length; i++) {
        legendItems.add(new LegendItem(Integer.toString(i), "", shape, true, paintList[i], stroke, Color.yellow,
                stroke));//from  ww w .j  a  v a2  s  .c o m
    }

    return legendItems;
}