Example usage for java.awt Color DARK_GRAY

List of usage examples for java.awt Color DARK_GRAY

Introduction

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

Prototype

Color DARK_GRAY

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

Click Source Link

Document

The color dark gray.

Usage

From source file:dk.sdu.mmmi.featureous.views.codecharacterization.TanglingViewChart.java

private void createView() {
    Controller c = Controller.getInstance();
    Set<TraceModel> traces = c.getTraceSet().getFirstLevelTraces();

    List<Result> ress = new ArrayList<Result>(new StaticTangling(pkg).calculateAndReturnAll(traces, null));

    for (Result r : ress) {
        //            OutputUtil.log(r.name + ";" +r.value);
    }/*w w w  . j av a2 s .  c  o m*/
    Result.sortByName(ress);

    if (sortByValue) {
        Collections.sort(ress);
        //            Collections.reverse(ress);
    }

    double max = 0;
    for (Result r : ress) {
        if (r.value > max) {
            max = r.value;
        }
    }

    for (Result r : ress) {
        String label = "" + (ress.indexOf(r) + 1);
        data.addValue(r.value, r.name, label);
        //            data.addValue(max - r.value, r.name + "f", label);
    }

    double total = 0;
    for (Result r : ress) {
        total += r.value;
    }

    jchart.setTitle(jchart.getTitle().getText());// + "\n" + "Total tang = " + String.format("%.5f", total));

    CategoryPlot plot = jchart.getCategoryPlot();
    ((StackedBarRenderer) plot.getRenderer()).setDrawBarOutline(true);
    plot.getRenderer().setOutlineStroke(new BasicStroke(0.1f));

    for (int i = 0; i < data.getRowCount(); i++) {
        Set<Object> elems = new HashSet<Object>();
        for (ClassModel cm : c.getTraceSet().getAllClassIDs()) {
            if (!pkg) {
                elems.add(cm);
            } else {
                elems.add(cm.getPackageName());
            }
        }
        for (Object cm : elems) {
            String key = data.getRowKey(i).toString();
            String name = "";
            if (!pkg) {
                name = ((ClassModel) cm).getName();
            } else {
                name = (String) cm;
            }
            if (key != null && key.startsWith(name)) {
                Color col = Color.pink;
                if (!pkg) {
                    col = Controller.getInstance().getAffinity()
                            .getClassAffinity(((ClassModel) cm).getName()).color;
                } else {
                    col = Controller.getInstance().getAffinity().getPkgAffinity((String) cm).color;
                }

                plot.getRenderer().setSeriesPaint(i, col);
                //                    if(key.endsWith("f")){
                //                        plot.getRenderer().setSeriesOutlinePaint(i, col);
                //                    }else{
                plot.getRenderer().setSeriesOutlinePaint(i, Color.DARK_GRAY);
                //                    }
                break;
            }
        }
    }
    //        plot.setRowRenderingOrder(SortOrder.DESCENDING);

}

From source file:my.electrochem.ElectrochemUI.java

private ChartPanel createChartPanel() {
    //creates a line chart object
    //returns the chart panel
    String chartTitle = "i-E curve";
    String xAxisLabel = "E (V)";
    String yAxisLabel = "i (A)";

    dataset1 = createEmptyDataset();//from  w  w  w  .j  a  va  2  s .co m

    JFreeChart chart = ChartFactory.createScatterPlot(chartTitle, xAxisLabel, yAxisLabel, dataset1);

    XYPlot plot = chart.getXYPlot();

    plot.setDomainCrosshairVisible(false);
    plot.setRangeCrosshairVisible(false);
    plot.setDomainCrosshairLockedOnData(false);
    plot.setRangeCrosshairLockedOnData(false);

    /*chart.addProgressListener(new ChartProgressListener() {
    @Override
    public void chartProgress(ChartProgressEvent cpe) {
        if (cpe.getType() == ChartProgressEvent.DRAWING_FINISHED) {
            //System.out.println("Click event!!");
            XYPlot xyPlot2 = cpe.getChart().getXYPlot();
            System.out.println("drawing finished");
            System.out.println("Xreal:"+xyPlot2.getDomainCrosshairValue()
                   +"Yreal:"+xyPlot2.getRangeCrosshairValue());
            if (click) {
                System.out.println("click true");
                if (x1 == -423.0) {
                    x1 = 0.0;
                    y1 = 0.0;
                            
                }
            
                if (x1 == 0.0 && y1 == 0.0) {
                    System.out.println("print 0,0");
                    click = true;
                    x1 = xyPlot2.getDomainCrosshairValue();
                    y1 = xyPlot2.getRangeCrosshairValue();
                    //xyPlot2.clearAnnotations();
                } else {
                    xyPlot2.clearAnnotations();
                    System.out.println("true-false");
                    click = false;
                    x1 = xyPlot2.getDomainCrosshairValue();
                    y1 = xyPlot2.getRangeCrosshairValue();
                }
                      
                             
            } else {
                System.out.println("click false");
               x2 = xyPlot2.getDomainCrosshairValue();
               y2 = xyPlot2.getRangeCrosshairValue();
               createLineAnn(xyPlot2, x1, y1, x2, y2);
               click = true;
           }
       }
       }
    });*/

    XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer();

    // sets paint color for each series
    //renderer.setSeriesPaint(0, Color.RED);

    // sets thickness for series (using strokes)
    //renderer.setSeriesStroke(0, new BasicStroke(5.0f));
    renderer.setBaseLinesVisible(true);
    //renderer.setSeriesLinesVisible(0, true);

    //renderer.setBaseShapesFilled(true);
    renderer.setBaseShapesVisible(false);
    //srenderer.setDrawSeriesLineAsPath(false);

    plot.setOutlinePaint(Color.BLUE);
    plot.setOutlineStroke(new BasicStroke(2.0f));
    plot.setBackgroundPaint(Color.DARK_GRAY);

    plot.setRangeGridlinesVisible(true);
    plot.setRangeGridlinePaint(Color.BLACK);

    plot.setDomainGridlinesVisible(true);
    plot.setDomainGridlinePaint(Color.BLACK);

    plot.setRenderer(renderer);

    return new ChartPanel(chart);
}

From source file:userinterface.StateNetworkAdminRole.StateReportsJPanel.java

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

From source file:keel.Algorithms.UnsupervisedLearning.AssociationRules.Visualization.keelassotiationrulesboxplot.ResultsProccessor.java

public void writeToFile(String outName)
        throws FileNotFoundException, UnsupportedEncodingException, IOException {
    //calcMeans();

    // Create JFreeChart Dataset
    DefaultBoxAndWhiskerCategoryDataset dataset = new DefaultBoxAndWhiskerCategoryDataset();

    HashMap<String, ArrayList<Double>> measuresFirst = algorithmMeasures.entrySet().iterator().next()
            .getValue();/*from ww w  .  j av  a2  s . c om*/
    for (Map.Entry<String, ArrayList<Double>> measure : measuresFirst.entrySet()) {
        String measureName = measure.getKey();
        //Double measureValue = measure.getValue();
        dataset.clear();

        for (Map.Entry<String, HashMap<String, ArrayList<Double>>> entry : algorithmMeasures.entrySet()) {
            String alg = entry.getKey();
            ArrayList<Double> measureValues = entry.getValue().get(measureName);

            // Parse algorithm name to show it correctly
            String aName = alg.substring(0, alg.length() - 1);
            int startAlgName = aName.lastIndexOf("/");
            aName = aName.substring(startAlgName + 1);

            dataset.add(measureValues, aName, measureName);
        }

        // Tutorial: http://www.java2s.com/Code/Java/Chart/JFreeChartBoxAndWhiskerDemo.htm
        final CategoryAxis xAxis = new CategoryAxis("Algorithm");
        final NumberAxis yAxis = new NumberAxis("Value");
        yAxis.setAutoRangeIncludesZero(false);
        final BoxAndWhiskerRenderer renderer = new BoxAndWhiskerRenderer();

        // Black and White
        int numItems = algorithmMeasures.size();
        for (int i = 0; i < numItems; i++) {
            Color color = Color.DARK_GRAY;
            if (i % 2 == 1) {
                color = Color.LIGHT_GRAY;
            }
            renderer.setSeriesPaint(i, color);
            renderer.setSeriesOutlinePaint(i, Color.BLACK);
        }

        renderer.setMeanVisible(false);
        renderer.setFillBox(false);
        renderer.setToolTipGenerator(new BoxAndWhiskerToolTipGenerator());
        final CategoryPlot plot = new CategoryPlot(dataset, xAxis, yAxis, renderer);

        Font font = new Font("SansSerif", Font.BOLD, 10);
        //ChartFactory.setChartTheme(StandardChartTheme.createLegacyTheme());
        JFreeChart jchart = new JFreeChart("Assotiation Rules Measures - BoxPlot", font, plot, true);
        //StandardChartTheme.createLegacyTheme().apply(jchart);

        int width = 640 * 2; /* Width of the image */
        int height = 480 * 2; /* Height of the image */

        // JPEG
        File chart = new File(outName + "_" + measureName + "_boxplot.jpg");
        ChartUtilities.saveChartAsJPEG(chart, jchart, width, height);

        // SVG
        SVGGraphics2D g2 = new SVGGraphics2D(width, height);
        Rectangle r = new Rectangle(0, 0, width, height);
        jchart.draw(g2, r);
        File BarChartSVG = new File(outName + "_" + measureName + "_boxplot.svg");
        SVGUtils.writeToSVG(BarChartSVG, g2.getSVGElement());
    }

}

From source file:org.cyberoam.iview.charts.CustomCategoryAxis.java

/**
 * This method generates JFreeChart instance for 3D Bar chart with iView customization.
 * @param reportID specifies that for which report Chart is being prepared.
 * @param rsw specifies data set which would be used for the Chart
 * @param requeest used for Hyperlink generation from uri.
 * @return jfreechart instance with iView Customization.
 *///from  w ww . j a  va  2s.com
public static JFreeChart getChart(int reportID, ResultSetWrapper rsw, HttpServletRequest request) {
    JFreeChart chart = null;
    boolean isPDF = false;
    try {
        if (request == null) {
            isPDF = true;
        }
        /*
         * Create data set based on rsw object.
         */
        ReportBean reportBean = ReportBean.getRecordbyPrimarykey(reportID);
        ReportColumnBean reportColumnBeanX, reportColumnBeanY = null;

        GraphBean graphBean = null;
        DataLinkBean dataLinkBean = null;
        DefaultCategoryDataset dataset = new DefaultCategoryDataset();
        graphBean = GraphBean.getRecordbyPrimarykey(reportBean.getGraphId());//Getting GraphBean
        reportColumnBeanX = ReportColumnBean.getRecordByPrimaryKey(reportBean.getReportId(),
                graphBean.getXColumnId());//getting ReportColumnBean For X Axis
        if (reportColumnBeanX.getDataLinkId() != -1) {
            dataLinkBean = DataLinkBean.getRecordbyPrimarykey(reportColumnBeanX.getDataLinkId());
        }

        reportColumnBeanY = ReportColumnBean.getRecordByPrimaryKey(reportBean.getReportId(),
                graphBean.getYColumnId());
        rsw.beforeFirst();
        int i = 0;
        DecimalFormat placeHolder = new DecimalFormat("00");
        String xData = null;
        String graphurl = "";
        HashMap<Integer, String> urlmap = new HashMap<Integer, String>();
        while (rsw.next()) {
            xData = rsw.getString(reportColumnBeanX.getDbColumnName());
            if (dataLinkBean != null && request != null) {
                //datalink id is non -1 in tblcolumnreport table means another report is avaialble so set url 
                // here multiple url possible bec multiple record so take hashmap and store url. 
                // we have dataset but dataset is occupied.
                graphurl = dataLinkBean.generateURLForChart(rsw, request);
                urlmap.put(new Integer(i), graphurl);
            }
            //dataset second arugument use for bar line of graph and third argument give name of graph
            dataset.addValue(new Long(rsw.getLong(reportColumnBeanY.getDbColumnName())), "",
                    placeHolder.format(i) + xData);
            i++;
        }
        // we define object of CustomURLGeneratorForBarChart and if datalinkid is not -1 then it object define for link
        CustomURLGeneratorForBarChart customURLGeneratorForBarChart = null;
        if (dataLinkBean != null && request != null) {
            customURLGeneratorForBarChart = new CustomURLGeneratorForBarChart(
                    dataLinkBean.generateURLForChart(request), reportColumnBeanX.getDbColumnName());
            customURLGeneratorForBarChart.setUrlMap(urlmap);
        }
        /*
         * Create the jfree chart object.
         */
        String title = isPDF ? reportBean.getTitle() : "";
        chart = ChartFactory.createBarChart3D(title, // chart title
                "", // domain axis label
                "", dataset, // data            
                PlotOrientation.HORIZONTAL, // orientation
                false, // include legend
                true, // tooltips?
                false // URLs?
        );

        /*
         *Setting additional customization to the chart. 
         */
        //Set background color
        chart.setBackgroundPaint(Color.white);
        //Get a reference to the plot for further customisation
        CategoryPlot plot = chart.getCategoryPlot();
        plot.setBackgroundPaint(Color.white);
        plot.setDomainGridlinePaint(Color.white);
        plot.setDomainGridlinesVisible(true);
        plot.setRangeGridlinePaint(Color.DARK_GRAY);
        plot.setForegroundAlpha(0.8f);
        plot.setDomainGridlineStroke(new BasicStroke(2));
        plot.setOutlineVisible(false);
        plot.setRangeAxisLocation(AxisLocation.BOTTOM_OR_RIGHT);

        //Set the range axis to display integers only...
        NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
        if (reportColumnBeanY.getColumnFormat() == TabularReportConstants.BYTE_FORMATTING) {
            rangeAxis.setTickUnit(new ByteTickUnit(rangeAxis.getUpperBound() / 4));
        }
        rangeAxis.setStandardTickUnits(NumberAxis.createStandardTickUnits());
        rangeAxis.setTickLabelFont(new Font("Arial", Font.CENTER_BASELINE, 10));
        rangeAxis.setTickLabelsVisible(true);
        rangeAxis.setTickMarksVisible(true);
        rangeAxis.setAxisLineVisible(false);
        rangeAxis.setLabel(reportColumnBeanY.getColumnName());
        rangeAxis.setLabelFont(new Font("Arial", Font.CENTER_BASELINE, 12));
        rangeAxis.setLabelPaint(new Color(35, 139, 199));

        CustomCategoryAxis catAxis = new CustomCategoryAxis();
        catAxis.setTickLabelFont(new Font("Arial", Font.CENTER_BASELINE, 10));
        catAxis.setTickMarksVisible(false);
        catAxis.setAxisLineVisible(false);
        catAxis.setLabel(reportColumnBeanX.getColumnName());
        catAxis.setLabelFont(new Font("Arial", Font.CENTER_BASELINE, 12));
        catAxis.setLabelPaint(new Color(35, 139, 199));
        catAxis.setLabelFormat(reportColumnBeanX.getColumnFormat());

        plot.setDomainAxis(catAxis);

        //Set custom color for the chart.         
        CategoryItemRenderer renderer = new CustomRenderer(new Paint[] { new Color(254, 211, 41),
                new Color(243, 149, 80), new Color(199, 85, 82), new Color(181, 105, 152),
                new Color(69, 153, 204), new Color(155, 212, 242), new Color(52, 172, 100),
                new Color(164, 212, 92), new Color(177, 155, 138), new Color(149, 166, 141) });

        plot.setRenderer(renderer);

        BarRenderer renderer2 = (BarRenderer) plot.getRenderer();
        renderer2.setDrawBarOutline(false);
        renderer2.setBaseItemLabelsVisible(true);
        renderer2.setMaximumBarWidth(0.04);

        if (dataLinkBean != null && request != null) {
            renderer.setBaseItemURLGenerator(customURLGeneratorForBarChart);
            //renderer.setBaseItemURLGenerator(new CustomURLGeneratorForBarChart(dataLinkBean.generateURLForChart(request),reportColumnBeanX.getDbColumnName()));
        }
        renderer.setBaseToolTipGenerator(new CustomToolTipGenerator());
        renderer.setBaseToolTipGenerator(new CustomToolTipGenerator());
        renderer.setBaseToolTipGenerator(
                new CustomToolTipGenerator("{2} " + reportColumnBeanY.getColumnName()));
    } catch (Exception e) {
        CyberoamLogger.appLog.debug("Bar3D.e:" + e, e);
    }
    return chart;
}

From source file:UserInterfaces.HAdministration.ReportDataJPanel.java

private void level1jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_level1jButton1ActionPerformed
    // TODO add your handling code here:

    int incidentnumber = 0;
    int unsafenumber = 0;
    int nearmissnumber = 0;
    int maxlevel1number = 0;

    for (WorkRequest workRequest : organization.getWorkQueue().getWorkRequestList()) {
        if (workRequest.getLevel1().toString().equals(ErrorUtil.INCIDENT)) {
            incidentnumber = incidentnumber + 1;
        }/*from   w w  w .j a  v a2  s . c o m*/
        if (workRequest.getLevel1().toString().equals(ErrorUtil.UNSAFE_CONDITION)) {
            unsafenumber = unsafenumber + 1;
        }
        if (workRequest.getLevel1().toString().equals(ErrorUtil.NEAR_MISS)) {
            nearmissnumber = nearmissnumber + 1;
        }

    }
    if (incidentnumber > maxlevel1number) {
        maxlevel1number = incidentnumber;
        if (unsafenumber > maxlevel1number) {
            maxlevel1number = unsafenumber;
            if (nearmissnumber > maxlevel1number) {
                maxlevel1number = nearmissnumber;

            }

        }

    }

    ReportToReporter report = organization.getReport();
    report.setMaxlevel1(maxlevel1number);
    report.setNearmissnumber(nearmissnumber);
    report.setUnsafenumber(unsafenumber);
    report.setIncidentnumber(incidentnumber);
    report.setStatus("success");

    // Level1reportJPanel ljp = new Level1reportJPanel(container, report);
    //container.add("Level1reportJPanel", ljp);
    //CardLayout layout = (CardLayout) container.getLayout();
    //layout.next(container);
    DefaultCategoryDataset dataset = new DefaultCategoryDataset();
    dataset.addValue(nearmissnumber, "Near miss", "Near miss");
    dataset.addValue(unsafenumber, "Unsafe condition", "Unsafe condition");
    dataset.addValue(incidentnumber, "incident", "incident");
    //dataset.setValue(80, "masd", "sss");

    JFreeChart chart = ChartFactory.createBarChart("Level1 Error", "Error Name", "Times", dataset,
            PlotOrientation.VERTICAL, false, true, false);
    CategoryPlot plot = chart.getCategoryPlot();
    plot.setRangeGridlinePaint(Color.DARK_GRAY);
    ChartFrame frame = new ChartFrame("Chart for ERROR", chart);
    frame.setVisible(true);
    frame.setSize(450, 550);

    //set the report to the enterprise's report
    //this means all the enterprise(all the organization also) within one network could have the access to see 
    //the report (these report are based on all the data from one network'enterprise ) 
    for (Network network : es.getNetworkList()) {
        for (Enterprise e : network.getEd().getEnterprisesList()) {
            if (e.getOrgName().equals(enterprise.getOrgName())) {
                for (Enterprise en : network.getEd().getEnterprisesList()) {
                    if (en instanceof HospitalEnterprise || en instanceof ClinicEnterprise) {
                        en.setReport(report);
                    }
                }
            }
        }
    }
    // report.getMaxlevel1() = maxlevel1number;

}

From source file:com.diversityarrays.kdxplore.field.FieldViewPanel.java

public FieldViewPanel(PlotVisitList plotVisitList, Map<Integer, Trait> traitMap,
        SeparatorVisibilityOption visible, SimplePlotCellRenderer plotRenderer, Component... extras) {
    super(new BorderLayout());

    this.plotVisitList = plotVisitList;
    this.traitMap = traitMap;

    trial = plotVisitList.getTrial();/*from ww w.j a v  a  2s .c om*/

    fieldLayoutTableModel.setTrial(trial);

    int rowHeight = fieldLayoutTable.getRowHeight();
    fieldLayoutTable.setRowHeight(4 * rowHeight);

    fieldLayoutTable.setCellSelectionEnabled(true);

    fieldLayoutTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);

    // IMPORTANT: DO NOT SORT THE FIELD LAYOUT TABLE
    fieldLayoutTable.setAutoCreateRowSorter(false);

    Map<Integer, Plot> plotById = new HashMap<>();
    FieldLayout<Integer> plotIdLayout = FieldLayoutUtil.createPlotIdLayout(trial.getTrialLayout(),
            trial.getPlotIdentSummary(), plotVisitList.getPlots(), plotById);

    KdxploreFieldLayout<Plot> kdxFieldLayout = new KdxploreFieldLayout<Plot>(Plot.class, plotIdLayout.imageId,
            plotIdLayout.xsize, plotIdLayout.ysize);
    kdxFieldLayout.warning = plotIdLayout.warning;

    String displayName = null;
    for (VisitOrder2D vo : VisitOrder2D.values()) {
        if (vo.imageId == plotIdLayout.imageId) {
            displayName = vo.displayName;
            break;
        }
    }
    //      VisitOrder2D vo = plotVisitList.getVisitOrder();
    KDClientUtils.initAction(plotIdLayout.imageId, changeCollectionOrder, displayName);

    hasUserPlotId = lookForUserPlotIdPresent(plotById, plotIdLayout, kdxFieldLayout);

    this.plotCellRenderer = plotRenderer;
    plotCellRenderer.setShowUserPlotId(hasUserPlotId);

    plotCellRenderer.setPlotXYprovider(getXYprovider());

    plotCellRenderer.setPlotVisitList(plotVisitList);

    fieldLayoutTable.setDefaultRenderer(Plot.class, plotCellRenderer);
    fieldLayoutTable.setCellSelectionEnabled(true);

    fieldLayoutTableModel.setFieldLayout(kdxFieldLayout);

    if (kdxFieldLayout.warning != null && !kdxFieldLayout.warning.isEmpty()) {
        warningMessage.setText(kdxFieldLayout.warning);
    } else {
        warningMessage.setText("");
    }

    fieldLayoutTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    fieldLayoutTable.getTableHeader().setReorderingAllowed(false);
    fieldLayoutTable.setCellSelectionEnabled(true);

    StringBuilder naming = new StringBuilder();
    String nameForRow = plotVisitList.getTrial().getNameForRow();
    if (!Check.isEmpty(nameForRow)) {
        naming.append(nameForRow);
    }
    String nameForCol = plotVisitList.getTrial().getNameForColumn();
    if (!Check.isEmpty(nameForCol)) {
        if (naming.length() > 0) {
            naming.append('/');
        }
        naming.append(nameForCol);
    }
    fieldTableScrollPane = new JScrollPane(fieldLayoutTable);
    if (naming.length() > 0) {
        JLabel cornerLabel = new JLabel(naming.toString());
        fieldTableScrollPane.setCorner(JScrollPane.UPPER_LEFT_CORNER, cornerLabel);
    }
    fieldTableScrollPane.setRowHeaderView(rowHeaderTable);

    //      fieldLayoutTable.setRowHeaderTable(rowHeaderTable);

    //      Box extra = Box.createHorizontalBox();
    //      extra.add(new JButton(changeCollectionOrder));
    //      if (extras != null && extras.length > 0) {
    //         extra.add(Box.createHorizontalStrut(8));
    //         for (Component c : extras) {
    //            extra.add(c);
    //         }
    //      }
    //      extra.add(Box.createHorizontalGlue());

    switch (visible) {
    case NOTVISIBLE:
        break;

    case VISIBLE:
    default:
        Box top = Box.createHorizontalBox();
        top.setOpaque(true);
        top.setBackground(Color.LIGHT_GRAY);
        top.setBorder(new MatteBorder(0, 0, 1, 0, Color.GRAY));
        JLabel label = new JLabel("Field");
        label.setForeground(Color.DARK_GRAY);
        label.setFont(label.getFont().deriveFont(Font.BOLD));
        top.add(label);
        top.add(new JButton(changeCollectionOrder));

        if (extras != null && extras.length > 0) {
            top.add(Box.createHorizontalStrut(8));
            for (Component c : extras) {
                top.add(c);
            }
        }
        add(top, BorderLayout.NORTH);
        break;
    }

    add(fieldTableScrollPane, BorderLayout.CENTER);
    add(warningMessage, BorderLayout.SOUTH);
}

From source file:com.uttesh.pdfngreport.handler.PdfReportHandler.java

/**
 * Not Used for the current release//from  ww w . jav  a2  s . com
 *
 * @param dataSet
 */
public void pieExplodeChart(DefaultPieDataset dataSet, String os) {
    try {
        JFreeChart chart = ChartFactory.createPieChart("", dataSet, true, true, false);
        ChartStyle.theme(chart);
        PiePlot plot = (PiePlot) chart.getPlot();
        plot.setForegroundAlpha(0.6f);
        plot.setCircular(true);
        plot.setSectionPaint("Passed", Color.decode("#019244"));
        plot.setSectionPaint("Failed", Color.decode("#EE6044"));
        plot.setSectionPaint("Skipped", Color.decode("#F0AD4E"));
        Color transparent = new Color(0.0f, 0.0f, 0.0f, 0.0f);
        //plot.setLabelLinksVisible(Boolean.FALSE);
        plot.setLabelOutlinePaint(transparent);
        plot.setLabelBackgroundPaint(transparent);
        plot.setLabelShadowPaint(transparent);
        plot.setLabelLinkPaint(Color.GRAY);
        Font font = new Font("SansSerif", Font.PLAIN, 10);
        plot.setLabelFont(font);
        plot.setLabelPaint(Color.DARK_GRAY);
        plot.setExplodePercent("Passed", 0.10);
        //plot.setExplodePercent("Failed", 0.10);
        //plot.setExplodePercent("Skipped", 0.10);
        plot.setSimpleLabels(true);
        PieSectionLabelGenerator gen = new StandardPieSectionLabelGenerator("{1} ({2})", new DecimalFormat("0"),
                new DecimalFormat("0%"));
        plot.setLabelGenerator(gen);

        if (os != null && os.equalsIgnoreCase("w")) {
            ChartUtilities.saveChartAsPNG(
                    new File(reportLocation + Constants.BACKWARD_SLASH + Constants.REPORT_CHART_FILE), chart,
                    560, 200);
        } else {
            ChartUtilities.saveChartAsPNG(
                    new File(reportLocation + Constants.FORWARD_SLASH + Constants.REPORT_CHART_FILE), chart,
                    560, 200);
        }
    } catch (Exception e) {
        e.printStackTrace(System.err);
        if (os != null && os.equalsIgnoreCase("w")) {
            new File(reportLocation + Constants.BACKWARD_SLASH + Constants.REPORT_CHART_FILE).delete();
        } else {
            new File(reportLocation + Constants.FORWARD_SLASH + Constants.REPORT_CHART_FILE).delete();
        }
        System.exit(-1);
    }
}

From source file:com.icesoft.faces.component.outputchart.AbstractChart.java

public ColorMap() {
    this.put("black", Color.BLACK);
    this.put("blue", Color.BLUE);
    this.put("cyan", Color.CYAN);
    this.put("darkGray", Color.DARK_GRAY);
    this.put("gray", Color.GRAY);
    this.put("green", Color.GREEN);
    this.put("lightGray", Color.LIGHT_GRAY);
    this.put("magenta", Color.MAGENTA);
    this.put("orange", Color.ORANGE);
    this.put("pink", Color.PINK);
    this.put("red", Color.RED);
    this.put("white", Color.WHITE);
    this.put("yellow", Color.YELLOW);
}

From source file:org.mwc.debrief.track_shift.views.BaseStackedDotsView.java

/**
 * method to create a working plot (to contain our data)
 * //from  w  w  w. jav a2  s.co m
 * @return the chart, in it's own panel
 */
@SuppressWarnings("deprecation")
protected void createStackedPlot() {

    // first create the x (time) axis
    final SimpleDateFormat _df = new SimpleDateFormat("HHmm:ss");
    _df.setTimeZone(TimeZone.getTimeZone("GMT"));

    final DateAxis xAxis = new CachedTickDateAxis("");
    xAxis.setDateFormatOverride(_df);
    Font tickLabelFont = new Font("Courier", Font.PLAIN, 13);
    xAxis.setTickLabelFont(tickLabelFont);
    xAxis.setTickLabelPaint(Color.BLACK);

    xAxis.setStandardTickUnits(DateAxisEditor.createStandardDateTickUnitsAsTickUnits());
    xAxis.setAutoTickUnitSelection(true);

    // create the special stepper plot
    _dotPlot = new XYPlot();
    NumberAxis errorAxis = new NumberAxis("Error (" + getUnits() + ")");
    Font axisLabelFont = new Font("Courier", Font.PLAIN, 16);
    errorAxis.setLabelFont(axisLabelFont);
    errorAxis.setTickLabelFont(tickLabelFont);
    _dotPlot.setRangeAxis(errorAxis);
    _dotPlot.setRangeAxisLocation(AxisLocation.TOP_OR_LEFT);
    _dotPlot.setRenderer(new ColourStandardXYItemRenderer(null, null, _dotPlot));

    _dotPlot.setRangeGridlinePaint(Color.LIGHT_GRAY);
    _dotPlot.setRangeGridlineStroke(new BasicStroke(2));
    _dotPlot.setDomainGridlinePaint(Color.LIGHT_GRAY);
    _dotPlot.setDomainGridlineStroke(new BasicStroke(2));

    // now try to do add a zero marker on the error bar
    final Paint thePaint = Color.DARK_GRAY;
    final Stroke theStroke = new BasicStroke(3);
    final ValueMarker zeroMarker = new ValueMarker(0.0, thePaint, theStroke);
    _dotPlot.addRangeMarker(zeroMarker);

    _linePlot = new XYPlot();
    final NumberAxis absBrgAxis = new NumberAxis("Absolute (" + getUnits() + ")");
    absBrgAxis.setLabelFont(axisLabelFont);
    absBrgAxis.setTickLabelFont(tickLabelFont);
    _linePlot.setRangeAxis(absBrgAxis);
    absBrgAxis.setAutoRangeIncludesZero(false);
    _linePlot.setRangeAxisLocation(AxisLocation.TOP_OR_LEFT);
    final DefaultXYItemRenderer lineRend = new ColourStandardXYItemRenderer(null, null, _linePlot);
    lineRend.setPaint(Color.DARK_GRAY);
    _linePlot.setRenderer(lineRend);

    _linePlot.setDomainCrosshairVisible(true);
    _linePlot.setRangeCrosshairVisible(true);
    _linePlot.setDomainCrosshairPaint(Color.GRAY);
    _linePlot.setRangeCrosshairPaint(Color.GRAY);
    _linePlot.setDomainCrosshairStroke(new BasicStroke(3.0f));
    _linePlot.setRangeCrosshairStroke(new BasicStroke(3.0f));

    _linePlot.setRangeGridlinePaint(Color.LIGHT_GRAY);
    _linePlot.setRangeGridlineStroke(new BasicStroke(2));
    _linePlot.setDomainGridlinePaint(Color.LIGHT_GRAY);
    _linePlot.setDomainGridlineStroke(new BasicStroke(2));

    // and the plot object to display the cross hair value
    final XYTextAnnotation annot = new XYTextAnnotation("-----", 2, 2);
    annot.setTextAnchor(TextAnchor.TOP_LEFT);

    Font annotationFont = new Font("Courier", Font.BOLD, 16);
    annot.setFont(annotationFont);
    annot.setPaint(Color.DARK_GRAY);
    annot.setBackgroundPaint(Color.white);
    _linePlot.addAnnotation(annot);

    // give them a high contrast backdrop
    _dotPlot.setBackgroundPaint(Color.white);
    _linePlot.setBackgroundPaint(Color.white);

    // set the y axes to autocalculate
    _dotPlot.getRangeAxis().setAutoRange(true);
    _linePlot.getRangeAxis().setAutoRange(true);

    _combined = new CombinedDomainXYPlot(xAxis);

    _combined.add(_linePlot);
    _combined.add(_dotPlot);

    _combined.setOrientation(PlotOrientation.HORIZONTAL);

    // put the plot into a chart
    _myChart = new JFreeChart(null, null, _combined, true);

    final LegendItemSource[] sources = { _linePlot };
    _myChart.getLegend().setSources(sources);

    _myChart.addProgressListener(new ChartProgressListener() {
        public void chartProgress(final ChartProgressEvent cpe) {
            if (cpe.getType() != ChartProgressEvent.DRAWING_FINISHED)
                return;

            // is hte line plot visible?
            if (!_showLinePlot.isChecked())
                return;

            // double-check our label is still in the right place
            final double xVal = _linePlot.getRangeAxis().getLowerBound();
            final double yVal = _linePlot.getDomainAxis().getUpperBound();
            boolean annotChanged = false;
            if (annot.getX() != yVal) {
                annot.setX(yVal);
                annotChanged = true;
            }
            if (annot.getY() != xVal) {
                annot.setY(xVal);
                annotChanged = true;
            }
            // and write the text
            final String numA = MWC.Utilities.TextFormatting.GeneralFormat
                    .formatOneDecimalPlace(_linePlot.getRangeCrosshairValue());
            final Date newDate = new Date((long) _linePlot.getDomainCrosshairValue());
            final SimpleDateFormat _df = new SimpleDateFormat("HHmm:ss");
            _df.setTimeZone(TimeZone.getTimeZone("GMT"));
            final String dateVal = _df.format(newDate);
            final String theMessage = " [" + dateVal + "," + numA + "]";
            if (!theMessage.equals(annot.getText())) {
                annot.setText(theMessage);
                annotChanged = true;
            }
            if (annotChanged) {
                _linePlot.removeAnnotation(annot);
                _linePlot.addAnnotation(annot);
            }
        }
    });

    // and insert into the panel
    _holder.setChart(_myChart);

    // do a little tidying to reflect the memento settings
    if (!_showLinePlot.isChecked())
        _combined.remove(_linePlot);
    if (!_showDotPlot.isChecked() && _showLinePlot.isChecked())
        _combined.remove(_dotPlot);
}