List of usage examples for java.awt Color LIGHT_GRAY
Color LIGHT_GRAY
To view the source code for java.awt Color LIGHT_GRAY.
Click Source Link
From source file:us.paulevans.basicxslt.TransformOutputPropertiesFrame.java
/** * Event handler/* www . ja v a 2 s. com*/ */ public void actionPerformed(ActionEvent aEvent) { Object eventSource; eventSource = aEvent.getSource(); if (eventSource == cancelBtn) { dispose(); } else if (eventSource instanceof JRadioButton) { setEnableXmlCheckboxes(eventSource == xml); if (eventSource == other) { otherMethod.setEnabled(true); otherMethod.requestFocus(); otherMethod.setBackground(Color.WHITE); } else { otherMethod.setEnabled(false); otherMethod.setBackground(Color.LIGHT_GRAY); } } else if (eventSource == okayBtn) { if (xslRow != null) { setOutputProperties(xslRow.getTransformOutputProperties()); xslRow.setAreOutputPropertiesSet(true); } else { setOutputProperties(xmlIdentityTransformOutputProps); parent.setAreOutputPropertiesSet(true); } dispose(); } }
From source file:unikn.dbis.univis.visualization.pivottable.VPivotTable.java
public void clear() { if (!xAxisDimensions.isEmpty()) { for (VDimension dimension : xAxisDimensions) { setAncestorsDropped(dimension, false); }//from w w w . j a va 2 s .c o m } if (!yAxisDimensions.isEmpty()) { for (VDimension dimension : yAxisDimensions) { setAncestorsDropped(dimension, false); } } xAxisDimensions.clear(); yAxisDimensions.clear(); measureNodes.clear(); dropAreaX.setForeground(Color.LIGHT_GRAY); dropAreaX.setToolTipText(textInXYBox); dropAreaX.setText(textInXYBox); dropAreaY.setForeground(Color.LIGHT_GRAY); dropAreaY.setToolTipText(textInXYBox); dropAreaY.setText(textInXYBox); dropAreaMeasure.setForeground(Color.LIGHT_GRAY); dropAreaMeasure.setToolTipText(textInMeasureBox); dropAreaMeasure.setText(textInMeasureBox); if (tableScrollPane != null) { remove(tableScrollPane); } validate(); repaint(); }
From source file:com.rapidminer.gui.plotter.charts.BubbleChartPlotter.java
@Override public void updatePlotter() { final DataTable dataTable = getDataTable(); prepareData();//from w w w. j av a2s. c om JFreeChart chart = ChartFactory.createBubbleChart(null, // chart title null, // domain axis label null, // range axis label xyzDataSet, // data PlotOrientation.VERTICAL, // orientation false, // include legend true, // tooltips false // URLs ); if (axis[X_AXIS] >= 0 && axis[Y_AXIS] >= 0 && axis[BUBBLE_SIZE_AXIS] >= 0) { if (nominal) { int size = xyzDataSet.getSeriesCount(); chart = ChartFactory.createBubbleChart(null, // chart title null, // domain axis label null, // range axis label xyzDataSet, // data PlotOrientation.VERTICAL, // orientation colorColumn >= 0 && size < 100 ? true : false, // include legend true, // tooltips false // URLs ); // renderer settings XYBubbleRenderer renderer = (XYBubbleRenderer) chart.getXYPlot().getRenderer(); renderer.setBaseOutlinePaint(Color.BLACK); if (size > 1) { for (int i = 0; i < size; i++) { renderer.setSeriesPaint(i, getColorProvider(true).getPointColor(i / (double) (size - 1))); renderer.setSeriesShape(i, new Ellipse2D.Double(-3, -3, 7, 7)); } } else { renderer.setSeriesPaint(0, getColorProvider().getPointColor(1.0d)); renderer.setSeriesShape(0, new Ellipse2D.Double(-3, -3, 7, 7)); } // legend settings LegendTitle legend = chart.getLegend(); if (legend != null) { legend.setPosition(RectangleEdge.TOP); legend.setFrame(BlockBorder.NONE); legend.setHorizontalAlignment(HorizontalAlignment.LEFT); legend.setItemFont(LABEL_FONT); } } else { chart = ChartFactory.createScatterPlot(null, // chart title null, // domain axis label null, // range axis label xyzDataSet, // data PlotOrientation.VERTICAL, // orientation false, // include legend true, // tooltips false // URLs ); // renderer settings ColorizedBubbleRenderer renderer = new ColorizedBubbleRenderer(this.colors); renderer.setBaseOutlinePaint(Color.BLACK); chart.getXYPlot().setRenderer(renderer); // legend settings chart.addLegend(new LegendTitle(renderer) { private static final long serialVersionUID = 1288380309936848376L; @Override public Object draw(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D area, java.lang.Object params) { if (dataTable.isDate(colorColumn) || dataTable.isTime(colorColumn) || dataTable.isDateTime(colorColumn)) { drawSimpleDateLegend(g2, (int) (area.getCenterX() - 170), (int) (area.getCenterY() + 7), dataTable, colorColumn, minColor, maxColor); return new BlockResult(); } else { final String minColorString = Tools.formatNumber(minColor); final String maxColorString = Tools.formatNumber(maxColor); drawSimpleNumericalLegend(g2, (int) (area.getCenterX() - 90), (int) (area.getCenterY() + 7), dataTable.getColumnName(colorColumn), minColorString, maxColorString); return new BlockResult(); } } @Override public void draw(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D area) { draw(g2, area, null); } }); } } // GENERAL CHART SETTINGS // set the background colors for the chart... chart.setBackgroundPaint(Color.WHITE); chart.getPlot().setBackgroundPaint(Color.WHITE); chart.getPlot().setForegroundAlpha(0.7f); XYPlot plot = chart.getXYPlot(); plot.setDomainGridlinePaint(Color.LIGHT_GRAY); plot.setRangeGridlinePaint(Color.LIGHT_GRAY); // domain axis if (axis[X_AXIS] >= 0) { if (dataTable.isNominal(axis[X_AXIS])) { String[] values = new String[dataTable.getNumberOfValues(axis[X_AXIS])]; for (int i = 0; i < values.length; i++) { values[i] = dataTable.mapIndex(axis[X_AXIS], i); } plot.setDomainAxis(new SymbolAxis(dataTable.getColumnName(axis[X_AXIS]), values)); } else if (dataTable.isDate(axis[X_AXIS]) || dataTable.isDateTime(axis[X_AXIS])) { DateAxis domainAxis = new DateAxis(dataTable.getColumnName(axis[X_AXIS])); domainAxis.setTimeZone(Tools.getPreferredTimeZone()); plot.setDomainAxis(domainAxis); } else { if (logScales[X_AXIS]) { LogAxis domainAxis = new LogAxis(dataTable.getColumnName(axis[X_AXIS])); domainAxis.setStandardTickUnits(NumberAxis.createStandardTickUnits(Locale.US)); plot.setDomainAxis(domainAxis); } else { plot.setDomainAxis(new NumberAxis(dataTable.getColumnName(axis[X_AXIS]))); } } Range range = getRangeForDimension(axis[X_AXIS]); if (range != null) { plot.getDomainAxis().setRange(range, true, false); } else { plot.getDomainAxis().setAutoRange(true); } } plot.getDomainAxis().setLabelFont(LABEL_FONT_BOLD); plot.getDomainAxis().setTickLabelFont(LABEL_FONT); // rotate labels if (isLabelRotating()) { plot.getDomainAxis().setTickLabelsVisible(true); plot.getDomainAxis().setVerticalTickLabels(true); } // range axis if (axis[Y_AXIS] >= 0) { if (dataTable.isNominal(axis[Y_AXIS])) { String[] values = new String[dataTable.getNumberOfValues(axis[Y_AXIS])]; for (int i = 0; i < values.length; i++) { values[i] = dataTable.mapIndex(axis[Y_AXIS], i); } plot.setRangeAxis(new SymbolAxis(dataTable.getColumnName(axis[Y_AXIS]), values)); } else if (dataTable.isDate(axis[Y_AXIS]) || dataTable.isDateTime(axis[Y_AXIS])) { DateAxis rangeAxis = new DateAxis(dataTable.getColumnName(axis[Y_AXIS])); rangeAxis.setTimeZone(Tools.getPreferredTimeZone()); plot.setRangeAxis(rangeAxis); } else { plot.setRangeAxis(new NumberAxis(dataTable.getColumnName(axis[Y_AXIS]))); } Range range = getRangeForDimension(axis[Y_AXIS]); if (range != null) { plot.getRangeAxis().setRange(range, true, false); } else { plot.getRangeAxis().setAutoRange(true); } } plot.getRangeAxis().setLabelFont(LABEL_FONT_BOLD); plot.getRangeAxis().setTickLabelFont(LABEL_FONT); AbstractChartPanel panel = getPlotterPanel(); // Chart Panel Settings if (panel == null) { panel = createPanel(chart); } else { panel.setChart(chart); } // ATTENTION: WITHOUT THIS WE GET SEVERE MEMORY LEAKS!!! panel.getChartRenderingInfo().setEntityCollection(null); }
From source file:probe.com.view.core.chart4j.VennDiagramPanel.java
/** * Update the plot.//from ww w. j a v a 2s. co m */ public void updatePlot() { // plotPanel.removeAll(); tooltipToDatasetMap = new HashMap<String, String>(); DefaultXYZDataset xyzDataset = new DefaultXYZDataset(); chart = ChartFactory.createBubbleChart(null, "X", "Y", xyzDataset, PlotOrientation.VERTICAL, false, true, false); XYPlot plot = chart.getXYPlot(); if (currentVennDiagramType == VennDiagramType.ONE_WAY) { plot.getRangeAxis().setRange(0.86, 1.24); plot.getDomainAxis().setRange(0.85, 1.25); } else if (currentVennDiagramType == VennDiagramType.TWO_WAY) { plot.getRangeAxis().setRange(0.86, 1.24); plot.getDomainAxis().setRange(0.85, 1.25); } else if (currentVennDiagramType == VennDiagramType.THREE_WAY) { plot.getRangeAxis().setRange(0.86, 1.24); plot.getDomainAxis().setRange(0.85, 1.25); } else { plot.getRangeAxis().setRange(-0.04, 0.6); plot.getDomainAxis().setRange(-0.08, 0.7); } plot.getRangeAxis().setVisible(false); plot.getDomainAxis().setVisible(false); double radius = 0.1; Ellipse2D ellipse = new Ellipse2D.Double(1 - radius, 1 - radius, radius + radius, radius + radius); XYShapeAnnotation xyShapeAnnotation = new XYShapeAnnotation(ellipse, new BasicStroke(2f), new Color(140, 140, 140, 150), datasetAColor); // @TODO: make it possible set the line color and width? plot.addAnnotation(xyShapeAnnotation); if (currentVennDiagramType == VennDiagramType.TWO_WAY || currentVennDiagramType == VennDiagramType.THREE_WAY) { ellipse = new Ellipse2D.Double(1 - radius + 0.1, 1 - radius, radius + radius, radius + radius); xyShapeAnnotation = new XYShapeAnnotation(ellipse, new BasicStroke(2f), new Color(140, 140, 140, 150), datasetBColor); plot.addAnnotation(xyShapeAnnotation); } if (currentVennDiagramType == VennDiagramType.THREE_WAY) { ellipse = new Ellipse2D.Double(1 - radius + 0.05, 1 - radius + 0.1, radius + radius, radius + radius); xyShapeAnnotation = new XYShapeAnnotation(ellipse, new BasicStroke(2f), new Color(140, 140, 140, 150), datasetCColor); plot.addAnnotation(xyShapeAnnotation); } XYTextAnnotation anotation; if (currentVennDiagramType == VennDiagramType.ONE_WAY) { anotation = new XYTextAnnotation("" + vennDiagramResults.get("a").size(), 1.0, 1.0); anotation.setToolTipText(groupNames.get("a")); anotation.setFont(new Font(anotation.getFont().getFontName(), Font.BOLD, fontSizeValues)); plot.addAnnotation(anotation); tooltipToDatasetMap.put(anotation.getToolTipText(), "a"); // legend if (showLegend) { anotation = new XYTextAnnotation(groupNames.get("a"), legendDatasetAThreeWay.getX(), legendDatasetAThreeWay.getY()); anotation.setTextAnchor(TextAnchor.BASELINE_LEFT); anotation.setFont(new Font(anotation.getFont().getFontName(), Font.BOLD, fontSizeLegend)); plot.addAnnotation(anotation); } } else if (currentVennDiagramType == VennDiagramType.TWO_WAY) { anotation = new XYTextAnnotation("" + vennDiagramResults.get("a").size(), 0.96, 1.0); anotation.setToolTipText(groupNames.get("a")); anotation.setFont(new Font(anotation.getFont().getFontName(), Font.BOLD, fontSizeValues)); plot.addAnnotation(anotation); tooltipToDatasetMap.put(anotation.getToolTipText(), "a"); anotation = new XYTextAnnotation("" + vennDiagramResults.get("b").size(), 1.14, 1.0); anotation.setToolTipText(groupNames.get("b")); anotation.setFont(new Font(anotation.getFont().getFontName(), Font.BOLD, fontSizeValues)); plot.addAnnotation(anotation); tooltipToDatasetMap.put(anotation.getToolTipText(), "b"); anotation = new XYTextAnnotation("" + vennDiagramResults.get("ab").size(), 1.05, 1.0); anotation .setToolTipText("<html>" + groupNames.get("a") + " ∩ " + groupNames.get("b") + "</html>"); anotation.setFont(new Font(anotation.getFont().getFontName(), Font.BOLD, fontSizeValues)); plot.addAnnotation(anotation); tooltipToDatasetMap.put(anotation.getToolTipText(), "ab"); // legend if (showLegend) { anotation = new XYTextAnnotation(groupNames.get("a"), legendDatasetAThreeWay.getX(), legendDatasetAThreeWay.getY()); anotation.setTextAnchor(TextAnchor.BASELINE_LEFT); anotation.setFont(new Font(anotation.getFont().getFontName(), Font.BOLD, fontSizeLegend)); plot.addAnnotation(anotation); anotation = new XYTextAnnotation(groupNames.get("b"), legendDatasetBThreeWay.getX(), legendDatasetBThreeWay.getY()); anotation.setTextAnchor(TextAnchor.BASELINE_LEFT); anotation.setFont(new Font(anotation.getFont().getFontName(), Font.BOLD, fontSizeLegend)); plot.addAnnotation(anotation); } } else if (currentVennDiagramType == VennDiagramType.THREE_WAY) { anotation = new XYTextAnnotation("" + vennDiagramResults.get("a").size(), 0.96, 0.97); anotation.setToolTipText(groupNames.get("a")); anotation.setFont(new Font(anotation.getFont().getFontName(), Font.BOLD, fontSizeValues)); plot.addAnnotation(anotation); tooltipToDatasetMap.put(anotation.getToolTipText(), "a"); anotation = new XYTextAnnotation("" + vennDiagramResults.get("b").size(), 1.14, 0.97); anotation.setToolTipText(groupNames.get("b")); anotation.setFont(new Font(anotation.getFont().getFontName(), Font.BOLD, fontSizeValues)); plot.addAnnotation(anotation); tooltipToDatasetMap.put(anotation.getToolTipText(), "b"); anotation = new XYTextAnnotation("" + vennDiagramResults.get("ab").size(), 1.05, 0.97); anotation .setToolTipText("<html>" + groupNames.get("a") + " ∩ " + groupNames.get("b") + "</html>"); anotation.setFont(new Font(anotation.getFont().getFontName(), Font.BOLD, fontSizeValues)); plot.addAnnotation(anotation); tooltipToDatasetMap.put(anotation.getToolTipText(), "ab"); anotation = new XYTextAnnotation("" + vennDiagramResults.get("c").size(), 1.05, 1.14); anotation.setToolTipText(groupNames.get("c")); anotation.setFont(new Font(anotation.getFont().getFontName(), Font.BOLD, fontSizeValues)); plot.addAnnotation(anotation); tooltipToDatasetMap.put(anotation.getToolTipText(), "c"); anotation = new XYTextAnnotation("" + vennDiagramResults.get("ac").size(), 0.99, 1.065); anotation.setToolTipText( "<html>" + groupNames.get("a") + " ∩ " + groupNames.get("c") + "</html>"); anotation.setFont(new Font(anotation.getFont().getFontName(), Font.BOLD, fontSizeValues)); plot.addAnnotation(anotation); tooltipToDatasetMap.put(anotation.getToolTipText(), "ac"); anotation = new XYTextAnnotation("" + vennDiagramResults.get("bc").size(), 1.11, 1.065); anotation .setToolTipText("<html>" + groupNames.get("b") + " ∩ " + groupNames.get("c") + "</html>"); anotation.setFont(new Font(anotation.getFont().getFontName(), Font.BOLD, fontSizeValues)); plot.addAnnotation(anotation); tooltipToDatasetMap.put(anotation.getToolTipText(), "bc"); anotation = new XYTextAnnotation("" + vennDiagramResults.get("abc").size(), 1.05, 1.036); anotation.setToolTipText("<html>" + groupNames.get("a") + " ∩ " + groupNames.get("b") + " ∩ " + groupNames.get("c") + "</html>"); anotation.setFont(new Font(anotation.getFont().getFontName(), Font.BOLD, fontSizeValues)); plot.addAnnotation(anotation); tooltipToDatasetMap.put(anotation.getToolTipText(), "abc"); // legend if (showLegend) { anotation = new XYTextAnnotation(groupNames.get("a"), legendDatasetAThreeWay.getX(), legendDatasetAThreeWay.getY()); anotation.setTextAnchor(TextAnchor.BASELINE_LEFT); anotation.setFont(new Font(anotation.getFont().getFontName(), Font.BOLD, fontSizeLegend)); plot.addAnnotation(anotation); anotation = new XYTextAnnotation(groupNames.get("b"), legendDatasetBThreeWay.getX(), legendDatasetBThreeWay.getY()); anotation.setTextAnchor(TextAnchor.BASELINE_LEFT); anotation.setFont(new Font(anotation.getFont().getFontName(), Font.BOLD, fontSizeLegend)); plot.addAnnotation(anotation); anotation = new XYTextAnnotation(groupNames.get("c"), legendDatasetCThreeWay.getX(), legendDatasetCThreeWay.getY()); anotation.setTextAnchor(TextAnchor.BASELINE_LEFT); anotation.setFont(new Font(anotation.getFont().getFontName(), Font.BOLD, fontSizeLegend)); plot.addAnnotation(anotation); } } else if (currentVennDiagramType == VennDiagramType.FOUR_WAY) { XYBoxAnnotation anotation2 = new XYBoxAnnotation(0, 0, 0.2, 0.5, new BasicStroke(2), Color.LIGHT_GRAY, datasetAColor); plot.addAnnotation(anotation2); anotation2 = new XYBoxAnnotation(0.1, 0, 0.3, 0.4, new BasicStroke(2), Color.LIGHT_GRAY, datasetBColor); plot.addAnnotation(anotation2); anotation2 = new XYBoxAnnotation(0, 0.1, 0.4, 0.3, new BasicStroke(2), Color.LIGHT_GRAY, datasetCColor); plot.addAnnotation(anotation2); anotation2 = new XYBoxAnnotation(0, 0, 0.5, 0.2, new BasicStroke(2), Color.LIGHT_GRAY, datasetDColor); plot.addAnnotation(anotation2); anotation = new XYTextAnnotation("" + vennDiagramResults.get("a").size(), 0.15, 0.45); anotation.setToolTipText(groupNames.get("a")); anotation.setFont(new Font(anotation.getFont().getFontName(), Font.BOLD, fontSizeValues)); plot.addAnnotation(anotation); tooltipToDatasetMap.put(anotation.getToolTipText(), "a"); anotation = new XYTextAnnotation("" + vennDiagramResults.get("ab").size(), 0.15, 0.35); anotation .setToolTipText("<html>" + groupNames.get("a") + " ∩ " + groupNames.get("b") + "</html>"); anotation.setFont(new Font(anotation.getFont().getFontName(), Font.BOLD, fontSizeValues)); plot.addAnnotation(anotation); tooltipToDatasetMap.put(anotation.getToolTipText(), "ab"); anotation = new XYTextAnnotation("" + vennDiagramResults.get("abc").size(), 0.15, 0.25); anotation.setToolTipText("<html>" + groupNames.get("a") + " ∩ " + groupNames.get("b") + " ∩ " + groupNames.get("c") + "</html>"); anotation.setFont(new Font(anotation.getFont().getFontName(), Font.BOLD, fontSizeValues)); plot.addAnnotation(anotation); tooltipToDatasetMap.put(anotation.getToolTipText(), "abc"); anotation = new XYTextAnnotation("" + vennDiagramResults.get("abcd").size(), 0.15, 0.15); anotation.setToolTipText("<html>" + groupNames.get("a") + " ∩ " + groupNames.get("b") + " ∩ " + groupNames.get("c") + " ∩ " + groupNames.get("d") + "</html>"); anotation.setFont(new Font(anotation.getFont().getFontName(), Font.BOLD, fontSizeValues)); plot.addAnnotation(anotation); tooltipToDatasetMap.put(anotation.getToolTipText(), "abcd"); anotation = new XYTextAnnotation("" + vennDiagramResults.get("abd").size(), 0.15, 0.05); anotation.setToolTipText("<html>" + groupNames.get("a") + " ∩ " + groupNames.get("b") + " ∩ " + groupNames.get("d") + "</html>"); anotation.setFont(new Font(anotation.getFont().getFontName(), Font.BOLD, fontSizeValues)); plot.addAnnotation(anotation); tooltipToDatasetMap.put(anotation.getToolTipText(), "abd"); anotation = new XYTextAnnotation("" + vennDiagramResults.get("ac").size(), 0.05, 0.25); anotation .setToolTipText("<html>" + groupNames.get("a") + " ∩ " + groupNames.get("c") + "</html>"); anotation.setFont(new Font(anotation.getFont().getFontName(), Font.BOLD, fontSizeValues)); plot.addAnnotation(anotation); tooltipToDatasetMap.put(anotation.getToolTipText(), "ac"); anotation = new XYTextAnnotation("" + vennDiagramResults.get("acd").size(), 0.05, 0.15); anotation.setToolTipText("<html>" + groupNames.get("a") + " ∩ " + groupNames.get("c") + " ∩ " + groupNames.get("d") + "</html>"); anotation.setFont(new Font(anotation.getFont().getFontName(), Font.BOLD, fontSizeValues)); plot.addAnnotation(anotation); tooltipToDatasetMap.put(anotation.getToolTipText(), "acd"); anotation = new XYTextAnnotation("" + vennDiagramResults.get("ad").size(), 0.05, 0.05); anotation .setToolTipText("<html>" + groupNames.get("a") + " ∩ " + groupNames.get("d") + "</html>"); anotation.setFont(new Font(anotation.getFont().getFontName(), Font.BOLD, fontSizeValues)); plot.addAnnotation(anotation); tooltipToDatasetMap.put(anotation.getToolTipText(), "ad"); anotation = new XYTextAnnotation("" + vennDiagramResults.get("b").size(), 0.25, 0.35); anotation.setToolTipText("<html>" + groupNames.get("b") + "</html>"); anotation.setFont(new Font(anotation.getFont().getFontName(), Font.BOLD, fontSizeValues)); plot.addAnnotation(anotation); tooltipToDatasetMap.put(anotation.getToolTipText(), "b"); anotation = new XYTextAnnotation("" + vennDiagramResults.get("bc").size(), 0.25, 0.25); anotation .setToolTipText("<html>" + groupNames.get("b") + " ∩ " + groupNames.get("c") + "</html>"); anotation.setFont(new Font(anotation.getFont().getFontName(), Font.BOLD, fontSizeValues)); plot.addAnnotation(anotation); tooltipToDatasetMap.put(anotation.getToolTipText(), "bc"); anotation = new XYTextAnnotation("" + vennDiagramResults.get("bcd").size(), 0.25, 0.15); anotation.setToolTipText("<html>" + groupNames.get("b") + " ∩ " + groupNames.get("c") + " ∩ " + groupNames.get("d") + "</html>"); anotation.setFont(new Font(anotation.getFont().getFontName(), Font.BOLD, fontSizeValues)); plot.addAnnotation(anotation); tooltipToDatasetMap.put(anotation.getToolTipText(), "bcd"); anotation = new XYTextAnnotation("" + vennDiagramResults.get("bd").size(), 0.25, 0.05); anotation .setToolTipText("<html>" + groupNames.get("b") + " ∩ " + groupNames.get("d") + "</html>"); anotation.setFont(new Font(anotation.getFont().getFontName(), Font.BOLD, fontSizeValues)); plot.addAnnotation(anotation); tooltipToDatasetMap.put(anotation.getToolTipText(), "bd"); anotation = new XYTextAnnotation("" + vennDiagramResults.get("c").size(), 0.35, 0.25); anotation.setToolTipText("<html>" + groupNames.get("c") + "</html>"); anotation.setFont(new Font(anotation.getFont().getFontName(), Font.BOLD, fontSizeValues)); plot.addAnnotation(anotation); tooltipToDatasetMap.put(anotation.getToolTipText(), "c"); anotation = new XYTextAnnotation("" + vennDiagramResults.get("cd").size(), 0.35, 0.15); anotation .setToolTipText("<html>" + groupNames.get("c") + " ∩ " + groupNames.get("d") + "</html>"); anotation.setFont(new Font(anotation.getFont().getFontName(), Font.BOLD, fontSizeValues)); plot.addAnnotation(anotation); tooltipToDatasetMap.put(anotation.getToolTipText(), "cd"); anotation = new XYTextAnnotation("" + vennDiagramResults.get("d").size(), 0.45, 0.15); anotation.setToolTipText("<html>" + groupNames.get("d") + "</html>"); anotation.setFont(new Font(anotation.getFont().getFontName(), Font.BOLD, fontSizeValues)); plot.addAnnotation(anotation); tooltipToDatasetMap.put(anotation.getToolTipText(), "d"); // legend if (showLegend) { anotation = new XYTextAnnotation(groupNames.get("a"), legendDatasetAFourWay.getX(), legendDatasetAFourWay.getY()); anotation.setTextAnchor(TextAnchor.BASELINE_LEFT); anotation.setFont(new Font(anotation.getFont().getFontName(), Font.BOLD, fontSizeLegend)); plot.addAnnotation(anotation); anotation = new XYTextAnnotation(groupNames.get("b"), legendDatasetBFourWay.getX(), legendDatasetBFourWay.getY()); anotation.setTextAnchor(TextAnchor.BASELINE_LEFT); anotation.setFont(new Font(anotation.getFont().getFontName(), Font.BOLD, fontSizeLegend)); plot.addAnnotation(anotation); anotation = new XYTextAnnotation(groupNames.get("c"), legendDatasetCFourWay.getX(), legendDatasetCFourWay.getY()); anotation.setTextAnchor(TextAnchor.BASELINE_LEFT); anotation.setFont(new Font(anotation.getFont().getFontName(), Font.BOLD, fontSizeLegend)); plot.addAnnotation(anotation); anotation = new XYTextAnnotation(groupNames.get("d"), legendDatasetDFourWay.getX(), legendDatasetDFourWay.getY()); anotation.setTextAnchor(TextAnchor.BASELINE_LEFT); anotation.setFont(new Font(anotation.getFont().getFontName(), Font.BOLD, fontSizeLegend)); plot.addAnnotation(anotation); } } // set up the renderer XYBubbleRenderer renderer = new XYBubbleRenderer(XYBubbleRenderer.SCALE_ON_RANGE_AXIS); renderer.setBaseToolTipGenerator(new StandardXYZToolTipGenerator()); plot.setRenderer(renderer); // make all datapoints semitransparent plot.setForegroundAlpha(0.5f); // remove space before/after the domain axis plot.getDomainAxis().setUpperMargin(0); plot.getDomainAxis().setLowerMargin(0); plot.setRangeGridlinePaint(Color.black); // hide unwanted chart details plot.setDomainGridlinesVisible(false); plot.setRangeGridlinesVisible(false); chart.getPlot().setOutlineVisible(false); // set background color chart.getPlot().setBackgroundPaint(Color.WHITE); chart.setBackgroundPaint(Color.WHITE); chartPanel = new ChartPanel(chart); // disable the pop up menu chartPanel.setPopupMenu(null); chartPanel.setBackground(Color.WHITE); // add the plot to the chart // plotPanel.add(chartPanel); // plotPanel.revalidate(); // plotPanel.repaint(); // // this.add(plotPanel); }
From source file:com.apatar.ui.JPublishToApatarDialog.java
private void setEnableShortDescription(boolean enable) { shortDescription.setEnabled(enable); if (enable)/* www. j a v a2 s . c om*/ shortDescription.setBackground(Color.WHITE); else shortDescription.setBackground(Color.LIGHT_GRAY); }
From source file:net.sf.jasperreports.chartthemes.spring.AegeanChartTheme.java
@Override protected JFreeChart createMeterChart() throws JRException { // Start by creating the plot that will hold the meter MeterPlot chartPlot = new MeterPlot((ValueDataset) getDataset()); JRMeterPlot jrPlot = (JRMeterPlot) getPlot(); // Set the shape MeterShapeEnum shape = jrPlot.getShapeValue() == null ? MeterShapeEnum.DIAL : jrPlot.getShapeValue(); switch (shape) { case CHORD:/* w w w . ja v a 2 s .c o m*/ chartPlot.setDialShape(DialShape.CHORD); break; case PIE: chartPlot.setDialShape(DialShape.PIE); break; case CIRCLE: chartPlot.setDialShape(DialShape.CIRCLE); break; case DIAL: default: return createDialChart(); } chartPlot.setDialOutlinePaint(Color.BLACK); int meterAngle = jrPlot.getMeterAngleInteger() == null ? 180 : jrPlot.getMeterAngleInteger(); // Set the size of the meter chartPlot.setMeterAngle(meterAngle); // Set the spacing between ticks. I hate the name "tickSize" since to me it // implies I am changing the size of the tick, not the spacing between them. double tickInterval = jrPlot.getTickIntervalDouble() == null ? 10.0 : jrPlot.getTickIntervalDouble(); chartPlot.setTickSize(tickInterval); JRFont tickLabelFont = jrPlot.getTickLabelFont(); Integer defaultBaseFontSize = (Integer) getDefaultValue(defaultChartPropertiesMap, ChartThemesConstants.BASEFONT_SIZE); Font themeTickLabelFont = getFont( (JRFont) getDefaultValue(defaultPlotPropertiesMap, ChartThemesConstants.PLOT_TICK_LABEL_FONT), tickLabelFont, defaultBaseFontSize); chartPlot.setTickLabelFont(themeTickLabelFont); // localizing the default format, can be overridden by display.getMask() chartPlot.setTickLabelFormat(NumberFormat.getInstance(getLocale())); Color tickColor = jrPlot.getTickColor() == null ? Color.BLACK : jrPlot.getTickColor(); chartPlot.setTickPaint(tickColor); int dialUnitScale = 1; Range range = convertRange(jrPlot.getDataRange()); if (range != null) { // Set the meter's range chartPlot.setRange(range); double bound = Math.max(Math.abs(range.getUpperBound()), Math.abs(range.getLowerBound())); dialUnitScale = ChartThemesUtilities.getScale(bound); if ((range.getLowerBound() == (int) range.getLowerBound() && range.getUpperBound() == (int) range.getUpperBound() && tickInterval == (int) tickInterval) || dialUnitScale > 1) { chartPlot.setTickLabelFormat( new DecimalFormat("#,##0", DecimalFormatSymbols.getInstance(getLocale()))); } else if (dialUnitScale == 1) { chartPlot.setTickLabelFormat( new DecimalFormat("#,##0.0", DecimalFormatSymbols.getInstance(getLocale()))); } else if (dialUnitScale <= 0) { chartPlot.setTickLabelFormat( new DecimalFormat("#,##0.00", DecimalFormatSymbols.getInstance(getLocale()))); } } chartPlot.setTickLabelsVisible(true); // Set all the colors we support Paint backgroundPaint = jrPlot.getOwnBackcolor() == null ? ChartThemesConstants.TRANSPARENT_PAINT : jrPlot.getOwnBackcolor(); chartPlot.setBackgroundPaint(backgroundPaint); GradientPaint gp = new GradientPaint(new Point(), Color.LIGHT_GRAY, new Point(), Color.BLACK, false); if (jrPlot.getMeterBackgroundColor() != null) { chartPlot.setDialBackgroundPaint(jrPlot.getMeterBackgroundColor()); } else { chartPlot.setDialBackgroundPaint(gp); } //chartPlot.setForegroundAlpha(1f); Paint needlePaint = jrPlot.getNeedleColor() == null ? new Color(191, 48, 0) : jrPlot.getNeedleColor(); chartPlot.setNeedlePaint(needlePaint); JRValueDisplay display = jrPlot.getValueDisplay(); if (display != null) { Color valueColor = display.getColor() == null ? Color.BLACK : display.getColor(); chartPlot.setValuePaint(valueColor); String pattern = display.getMask() != null ? display.getMask() : "#,##0.####"; if (pattern != null) chartPlot.setTickLabelFormat( new DecimalFormat(pattern, DecimalFormatSymbols.getInstance(getLocale()))); JRFont displayFont = display.getFont(); Font themeDisplayFont = getFont( (JRFont) getDefaultValue(defaultPlotPropertiesMap, ChartThemesConstants.PLOT_DISPLAY_FONT), displayFont, defaultBaseFontSize); if (themeDisplayFont != null) { chartPlot.setValueFont(themeDisplayFont); } } String label = getChart().hasProperties() ? getChart().getPropertiesMap().getProperty(DefaultChartTheme.PROPERTY_DIAL_LABEL) : null; if (label != null) { if (dialUnitScale < 0) label = new MessageFormat(label) .format(new Object[] { String.valueOf(Math.pow(10, dialUnitScale)) }); else if (dialUnitScale < 3) label = new MessageFormat(label).format(new Object[] { "1" }); else label = new MessageFormat(label) .format(new Object[] { String.valueOf((int) Math.pow(10, dialUnitScale - 2)) }); } // Set the units - this is just a string that will be shown next to the // value String units = jrPlot.getUnits() == null ? label : jrPlot.getUnits(); if (units != null && units.length() > 0) chartPlot.setUnits(units); chartPlot.setTickPaint(Color.BLACK); // Now define all of the intervals, setting their range and color List<JRMeterInterval> intervals = jrPlot.getIntervals(); if (intervals != null && intervals.size() > 0) { int size = Math.min(3, intervals.size()); int colorStep = 0; if (size > 3) colorStep = 255 / (size - 3); for (int i = 0; i < size; i++) { JRMeterInterval interval = intervals.get(i); Color color = i < 3 ? (Color) ChartThemesConstants.AEGEAN_INTERVAL_COLORS.get(i) : new Color(255 - colorStep * (i - 3), 0 + colorStep * (i - 3), 0); interval.setBackgroundColor(color); interval.setAlpha(1.0d); chartPlot.addInterval(convertInterval(interval)); } } // Actually create the chart around the plot JFreeChart jfreeChart = new JFreeChart(evaluateTextExpression(getChart().getTitleExpression()), null, chartPlot, getChart().getShowLegend() == null ? false : getChart().getShowLegend()); // Set all the generic options configureChart(jfreeChart, getPlot()); return jfreeChart; }
From source file:com.lp.client.frame.component.PanelDokumentenablage.java
private void jbInit() throws Throwable { if (LPMain.getInstance().getDesktop() .darfAnwenderAufZusatzfunktionZugreifen(MandantFac.ZUSATZFUNKTION_DOKUMENTENABLAGE)) { if (!(new HeliumDocPath()).equals(fullDocPath)) { bHatDokumentenablage = true; }/*from ww w . jav a 2s. c om*/ } if (bShowExitButton) { String[] aWhichButtonIUse = new String[] { PanelBasis.ACTION_NEW, PanelBasis.ACTION_UPDATE, PanelBasis.ACTION_SAVE, PanelBasis.ACTION_DISCARD }; enableToolsPanelButtons(aWhichButtonIUse); createAndSaveAndShowButton("/com/lp/client/res/scanner.png", "TWAIN-Import", BUTTON_SCAN, null); } dropArea.setCenterText(LPMain.getTextRespectUISPr("lp.datei.draganddrop.ablegen")); dropArea.setBackground(Color.LIGHT_GRAY); dropArea.setSupportFiles(true); dropArea.addDropListener(this); dropArea.setMinimumSize(new Dimension(200, 100)); JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT); JPanel leftPane = new JPanel(); JPanel rightPane = new JPanel(); JLayeredPane rightLayered = new JLayeredPane(); rightLayered.setLayout(new GridBagLayout()); rightLayered.add(rightPane, new GridBagConstraints(1, 1, 1, 1, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); // rightLayered.setLayer(rightPane, 0, 1); if (bShowExitButton && bHatDokumentenablage) rightLayered.add(dropArea, new GridBagConstraints(1, 2, 1, 1, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); // rightLayered.setLayer(dropArea, 1, 1); rightPane.setLayout(new GridBagLayout()); tree = new WrapperJTree(treeModel); tree.setEditable(false); tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION); tree.setShowsRootHandles(true); tree.setRowHeight(0); tree.setCellRenderer(new ToolTipCellRenderer()); ToolTipManager.sharedInstance().registerComponent(tree); tree.addTreeSelectionListener(this); refresh(); personalDto = DelegateFactory.getInstance().getPersonalDelegate() .personalFindByPrimaryKey(LPMain.getTheClient().getIDPersonal()); dokumentbelegartDto = DelegateFactory.getInstance().getJCRDocDelegate() .dokumentbelegartfindbyMandant(LPMain.getTheClient().getMandant()); for (int i = 0; i < dokumentbelegartDto.length; i++) { if (!JCRDocFac.DEFAULT_ARCHIV_BELEGART.equals(dokumentbelegartDto[i].getCNr())) wcbBelegart.addItem(dokumentbelegartDto[i].getCNr()); } dokumentgruppierungDto = DelegateFactory.getInstance().getJCRDocDelegate() .dokumentgruppierungfindbyMandant(LPMain.getTheClient().getMandant()); for (int i = 0; i < dokumentgruppierungDto.length; i++) { if (!JCRDocFac.DEFAULT_ARCHIV_GRUPPE.equals(dokumentgruppierungDto[i].getCNr()) || !JCRDocFac.DEFAULT_KOPIE_GRUPPE.equals(dokumentgruppierungDto[i].getCNr()) || !JCRDocFac.DEFAULT_VERSANDAUFTRAG_GRUPPE.equals(dokumentgruppierungDto[i].getCNr())) { wcbGruppierung.addItem(dokumentgruppierungDto[i].getCNr()); } } // Listen for when the selection changes. tree.addTreeExpansionListener(this); wcbVersteckteAnzeigen.setEnabled(true); wcbVersteckteAnzeigen.addActionListener(actionListener); wtfSuche.setEditable(true); wbuSuche.setEnabled(true); wbuSuche.addActionListener(actionListener); wbuPartner = new WrapperButton(); wbuPartner.setText(LPMain.getTextRespectUISPr("button.partner")); wbuPartner.setToolTipText(LPMain.getTextRespectUISPr("button.partner.tooltip")); wbuPartner.setActionCommand(ACTION_SPECIAL_PARTNER); wbuPartner.addActionListener(this); wbuChooseDoc.setActionCommand(ACTION_SPECIAL_CHOOSE); wbuChooseDoc.addActionListener(this); wbuShowDoc.setActionCommand(ACTION_SPECIAL_SHOW); wbuShowDoc.addActionListener(this); wbuSaveDoc.setActionCommand(ACTION_SPECIAL_SAVE); wbuSaveDoc.addActionListener(this); wtfPartner = new WrapperTextField(); wtfPartner.setColumnsMax(Facade.MAX_UNBESCHRAENKT); wtfPartner.setActivatable(false); wtfAnleger.setActivatable(false); wdfZeitpunkt.setActivatable(false); wtfBelegnummer.setActivatable(false); wtfTable.setActivatable(false); wtfRow.setActivatable(false); wtfFilename.setActivatable(false); wtfFilename.setColumnsMax(100); wtfMIME.setActivatable(false); wcbVersteckt.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { wtfSchlagworte.setMandatoryField(!wcbVersteckt.isSelected()); } }); if (bHatStufe0) { wcbSicherheitsstufe.addItem(JCRDocFac.SECURITY_NONE); } if (bHatStufe1) { wcbSicherheitsstufe.addItem(JCRDocFac.SECURITY_LOW); } if (bHatStufe2) { wcbSicherheitsstufe.addItem(JCRDocFac.SECURITY_MEDIUM); } if (bHatStufe3) { wcbSicherheitsstufe.addItem(JCRDocFac.SECURITY_HIGH); } if (bHatStufe99) { wcbSicherheitsstufe.addItem(JCRDocFac.SECURITY_ARCHIV); } wtfTable.setMandatoryField(true); wtfName.setMandatoryField(true); wtfName.setColumnsMax(200); wtfBelegnummer.setMandatoryField(true); wtfRow.setMandatoryField(true); wtfFilename.setMandatoryField(true); wtfMIME.setMandatoryField(true); wtfAnleger.setMandatoryField(true); wtfSchlagworte.setMandatoryField(true); wtfSchlagworte.setColumnsMax(300); wdfZeitpunkt.setMandatoryField(true); wtfPartner.setMandatoryField(true); treeView = new JScrollPane(tree); treeView.setMinimumSize(new Dimension(200, 10)); treeView.setPreferredSize(new Dimension(200, 10)); iZeile = 0; if (!bShowExitButton) { jpaWorkingOn.add(wtfSuche, new GridBagConstraints(0, iZeile, 1, 1, 0.2, 0.0, GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(2, 2, 2, 2), 0, 0)); jpaWorkingOn.add(wbuSuche, new GridBagConstraints(1, iZeile, 1, 1, 0.1, 0.0, GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(2, 2, 2, 2), 0, 0)); iZeile++; } jpaWorkingOn.add(wcbVersteckteAnzeigen, new GridBagConstraints(0, iZeile, 1, 1, 1, 0.0, GridBagConstraints.EAST, GridBagConstraints.BOTH, new Insets(2, 2, 2, 2), 0, 0)); iZeile++; leftPane.add(treeView); jpaWorkingOn.add(splitPane, new GridBagConstraints(0, iZeile, 3, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(2, 2, 2, 2), 0, 0)); iZeile = 0; rightPane.add(wlaName, new GridBagConstraints(0, iZeile, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(2, 2, 2, 2), 0, 0)); rightPane.add(wtfName, new GridBagConstraints(1, iZeile, 3, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(2, 2, 2, 2), 0, 0)); rightPane.add(wlaTable, new GridBagConstraints(4, iZeile, 1, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(2, 2, 2, 2), 0, 0)); rightPane.add(wtfTable, new GridBagConstraints(5, iZeile, 2, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(2, 2, 2, 2), 0, 0)); iZeile++; rightPane.add(wlaSchlagworte, new GridBagConstraints(0, iZeile, 1, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(2, 2, 2, 2), 0, 0)); rightPane.add(wtfSchlagworte, new GridBagConstraints(1, iZeile, 6, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(2, 2, 2, 2), 0, 0)); iZeile++; rightPane.add(wlaZeitpunkt, new GridBagConstraints(0, iZeile, 1, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(2, 2, 2, 2), 0, 0)); rightPane.add(wdfZeitpunkt, new GridBagConstraints(1, iZeile, 3, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(2, 2, 2, 2), 0, 0)); rightPane.add(wlaSicherheitsstufe, new GridBagConstraints(4, iZeile, 1, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(2, 2, 2, 2), 0, 0)); rightPane.add(wcbSicherheitsstufe, new GridBagConstraints(5, iZeile, 1, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(2, 2, 2, 2), 0, 0)); rightPane.add(wcbVersteckt, new GridBagConstraints(6, iZeile, 1, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(2, 2, 2, 2), 0, 0)); iZeile++; rightPane.add(wlaBelegnummer, new GridBagConstraints(0, iZeile, 1, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(2, 2, 2, 2), 0, 0)); rightPane.add(wtfBelegnummer, new GridBagConstraints(1, iZeile, 3, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(2, 2, 2, 2), 0, 0)); rightPane.add(wlaRow, new GridBagConstraints(4, iZeile, 1, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(2, 2, 2, 2), 0, 0)); rightPane.add(wtfRow, new GridBagConstraints(5, iZeile, 2, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(2, 2, 2, 2), 0, 0)); iZeile++; rightPane.add(wlaFilename, new GridBagConstraints(0, iZeile, 1, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(2, 2, 2, 2), 0, 0)); rightPane.add(wtfFilename, new GridBagConstraints(1, iZeile, 3, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(2, 2, 2, 2), 0, 0)); rightPane.add(wlaMIME, new GridBagConstraints(4, iZeile, 1, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(2, 2, 2, 2), 0, 0)); rightPane.add(wtfMIME, new GridBagConstraints(5, iZeile, 2, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(2, 2, 2, 2), 0, 0)); iZeile++; rightPane.add(wlaBelegart, new GridBagConstraints(0, iZeile, 1, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(2, 2, 2, 2), 0, 0)); rightPane.add(wcbBelegart, new GridBagConstraints(1, iZeile, 3, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(2, 2, 2, 2), 0, 0)); rightPane.add(wlaGruppierung, new GridBagConstraints(4, iZeile, 1, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(2, 2, 2, 2), 0, 0)); rightPane.add(wcbGruppierung, new GridBagConstraints(5, iZeile, 2, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(2, 2, 2, 2), 0, 0)); iZeile++; rightPane.add(wbuPartner, new GridBagConstraints(0, iZeile, 1, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(2, 2, 2, 2), 0, 0)); rightPane.add(wtfPartner, new GridBagConstraints(1, iZeile, 3, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(2, 2, 2, 2), 0, 0)); rightPane.add(wlaAnleger, new GridBagConstraints(4, iZeile, 1, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(2, 2, 2, 2), 0, 0)); rightPane.add(wtfAnleger, new GridBagConstraints(5, iZeile, 2, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(2, 2, 2, 2), 0, 0)); iZeile++; rightPane.add(wbuChooseDoc, new GridBagConstraints(0, iZeile, 3, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(2, 2, 2, 2), 0, 0)); rightPane.add(wbuShowDoc, new GridBagConstraints(3, iZeile, 2, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(2, 2, 2, 2), 0, 0)); rightPane.add(wbuSaveDoc, new GridBagConstraints(5, iZeile, 2, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(2, 2, 2, 2), 0, 0)); iZeile++; rightPane.add(wlaVorschau, new GridBagConstraints(0, iZeile, 1, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(2, 2, 2, 2), 0, 0)); iZeile++; rightPane.add(wmcMedia, new GridBagConstraints(0, iZeile, 7, 4, 1.0, 0.5, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(2, 2, 2, 2), 0, 0)); splitPane.setLeftComponent(treeView); splitPane.setRightComponent(rightLayered); }
From source file:com.rapidminer.gui.plotter.charts.StackedBarChartPlotter.java
@Override public void updatePlotter() { final int categoryCount = prepareData(); if (categoryCount <= MAX_CATEGORIES) { JFreeChart chart = ChartFactory.createStackedBarChart(null, // chart title null, // domain axis label null, // range axis label categoryDataSet, // usedCategoryDataSet, // data orientationIndex == ORIENTATION_TYPE_VERTICAL ? PlotOrientation.VERTICAL : PlotOrientation.HORIZONTAL, // orientation true, // include legend if group by column is set true, // tooltips false // URLs );// w ww . j a va2 s .c om // set the background color for the chart... chart.setBackgroundPaint(Color.WHITE); chart.getPlot().setBackgroundPaint(Color.WHITE); CategoryPlot plot = chart.getCategoryPlot(); plot.setDomainGridlinePaint(Color.LIGHT_GRAY); plot.setRangeGridlinePaint(Color.LIGHT_GRAY); CategoryAxis domainAxis = plot.getDomainAxis(); domainAxis.setLabelFont(LABEL_FONT_BOLD); domainAxis.setTickLabelFont(LABEL_FONT); String domainName = groupByColumn >= 0 ? dataTable.getColumnName(groupByColumn) : null; domainAxis.setLabel(domainName); // rotate labels if (isLabelRotating()) { plot.getDomainAxis().setTickLabelsVisible(true); plot.getDomainAxis().setCategoryLabelPositions( CategoryLabelPositions.createUpRotationLabelPositions(Math.PI / 2.0d)); } // set the range axis to display integers only... NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setLabelFont(LABEL_FONT_BOLD); rangeAxis.setTickLabelFont(LABEL_FONT); String rangeName = valueColumn >= 0 ? dataTable.getColumnName(valueColumn) : null; rangeAxis.setLabel(rangeName); // bar renderer int length = 0; // if ((groupByColumn >= 0) && this.dataTable.isNominal(groupByColumn)) { // length = this.dataTable.getNumberOfValues(groupByColumn); // } else { // length = categoryDataSet.getColumnCount(); // } if (stackGroupColumn >= 0 && this.dataTable.isNominal(stackGroupColumn)) { length = this.dataTable.getNumberOfValues(stackGroupColumn); } else { length = categoryDataSet.getRowCount(); } final double[] colorValues = new double[length]; for (int i = 0; i < colorValues.length; i++) { colorValues[i] = i; } BarRenderer renderer = new StackedBarRenderer() { private static final long serialVersionUID = 1912387984078591157L; private ColorProvider colorProvider = getColorProvider(true); private double minColor = Double.POSITIVE_INFINITY; private double maxColor = Double.NEGATIVE_INFINITY; { if (colorValues != null) { for (double d : colorValues) { this.minColor = MathFunctions.robustMin(this.minColor, d); this.maxColor = MathFunctions.robustMax(this.maxColor, d); } } } @Override public Paint getSeriesPaint(int series) { if (colorValues == null || minColor == maxColor || series >= colorValues.length) { return ColorProvider.reduceColorBrightness(Color.RED); } else { double normalized = (colorValues[series] - minColor) / (maxColor - minColor); return colorProvider.getPointColor(normalized); } } }; renderer.setBarPainter(new RapidBarPainter()); renderer.setDrawBarOutline(true); renderer.setShadowVisible(false); plot.setRenderer(renderer); // legend settings LegendTitle legend = chart.getLegend(); if (legend != null) { legend.setPosition(RectangleEdge.TOP); legend.setFrame(BlockBorder.NONE); legend.setHorizontalAlignment(HorizontalAlignment.LEFT); legend.setItemFont(LABEL_FONT); } if (panel instanceof AbstractChartPanel) { panel.setChart(chart); } else { panel = new AbstractChartPanel(chart, getWidth(), getHeight() - MARGIN); final ChartPanelShiftController controller = new ChartPanelShiftController(panel); panel.addMouseListener(controller); panel.addMouseMotionListener(controller); } // ATTENTION: WITHOUT THIS WE GET SEVERE MEMORY LEAKS!!! panel.getChartRenderingInfo().setEntityCollection(null); } else { LogService.getRoot().log(Level.INFO, "com.rapidminer.gui.plotter.charts.StackedBarChartPlotter.too_many_columns", new Object[] { categoryCount, MAX_CATEGORIES }); } }
From source file:it.unifi.rcl.chess.traceanalysis.gui.TracePanel.java
private void plotTrace() { XYSeriesCollection dataset = new XYSeriesCollection(); XYSeries xyBoundsPositive = null;/* ww w. j a va2 s . c o m*/ XYSeries xyBoundsNegative = null; Trace[] posNeg = null; dataset.addSeries(Plotter.traceToSeries(trace)); dataset.addSeries(Plotter.valueToSeries(trace.getMax(), "Max", trace.getSampleSize())); dataset.addSeries(Plotter.valueToSeries(trace.getAverage(), "Average", trace.getSampleSize())); dataset.addSeries(Plotter.valueToSeries(trace.getMin(), "Min", trace.getSampleSize())); int rows = tableWindowSize.getRowCount(); double coverage; int wsize; for (int i = 0; i < rows; i++) { try { wsize = (Integer) tableWindowSize.getValueAt(i, 0); coverage = (Double) tableWindowSize.getValueAt(i, 1); if (trace.hasNegativeValues()) { posNeg = trace.splitPositiveNegative(); xyBoundsPositive = Plotter.arrayToSeries(posNeg[0].getDynamicBound(coverage, wsize), "c=" + coverage + ",w=" + wsize, wsize - 1); xyBoundsNegative = Plotter.arrayToSeriesInvert(posNeg[1].getDynamicBound(coverage, wsize), "c=" + coverage + ",w=" + wsize + "(neg)", wsize - 1); dataset.addSeries(xyBoundsPositive); dataset.addSeries(xyBoundsNegative); } else { dataset.addSeries(Plotter.arrayToSeries(trace.getDynamicBound(coverage, wsize), "c=" + coverage + ",w=" + wsize, wsize - 1)); } } catch (NullPointerException e) { //Ignore: cell value is null ; } } // Generate the graph JFreeChart chart = ChartFactory.createXYLineChart(trace.getName(), // Title "Time Point", // x-axis Labels "Value", // y-axis Label dataset, // Dataset PlotOrientation.VERTICAL, // Plot Orientation true, // Show Legend true, // Use tooltips false // Configure chart to generate URLs? ); chart.setBackgroundPaint(Color.WHITE); chart.getXYPlot().setBackgroundPaint(ChartColor.VERY_LIGHT_YELLOW); chart.getXYPlot().setBackgroundAlpha(0.05f); chart.getXYPlot().setRangeGridlinePaint(Color.LIGHT_GRAY); chart.getXYPlot().setDomainGridlinePaint(Color.LIGHT_GRAY); chart.getTitle().setFont(new Font("Dialog", Font.BOLD, 14)); XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(); renderer.setDrawSeriesLineAsPath(true); chart.getXYPlot().setRenderer(renderer); renderer.setSeriesPaint(0, Color.BLACK); renderer.setSeriesPaint(1, ChartColor.DARK_BLUE); renderer.setSeriesPaint(2, ChartColor.DARK_GRAY); renderer.setSeriesPaint(3, ChartColor.DARK_BLUE); renderer.setSeriesPaint(4, ChartColor.RED); int nSeries = chart.getXYPlot().getSeriesCount(); for (int i = 0; i < nSeries; i++) { renderer.setSeriesShapesVisible(i, false); } if (posNeg != null) { renderer.setSeriesVisibleInLegend(5, false); renderer.setSeriesPaint(5, renderer.getSeriesPaint(4)); } Stroke plainStroke = new BasicStroke(1.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 1.0f); renderer.setSeriesStroke(0, plainStroke); renderer.setSeriesStroke(1, new BasicStroke(1.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 1.0f, new float[] { 6.0f, 3.0f }, 0.0f)); renderer.setSeriesStroke(2, new BasicStroke(1.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 1.0f, new float[] { 3.0f, 0.5f, 3.0f }, 0.0f)); renderer.setSeriesStroke(3, new BasicStroke(1.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 1.0f, new float[] { 6.0f, 3.0f }, 0.0f)); JPanel plotPanel = new ChartPanel(chart); JFrame plotFrame = new JFrame(); plotFrame.add(plotPanel); plotFrame.setVisible(true); plotFrame.pack(); plotFrame.setTitle(TracePanel.this.trace.getName()); plotFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); }
From source file:geovista.network.gui.NodeLinkView.java
private void doInit() { g = g_array[0]; // initial // graph/*from ww w . j a v a 2 s. c o m*/ layout = new AggregateLayout<Integer, Number>(new FRLayout<Integer, Number>((Graph<Integer, Number>) g)); vv = new VisualizationViewer<Integer, Number>(layout); // vv = new VisualizationViewer<Integer, Number>(new FRLayout(g)); // coordination part // nh = new NodeHighlight<String>(vv.getPickedVertexState()); // nh.ID = 1; // nh.node_no = g.getVertexCount(); // nh.node_count = nh.node_no; // nh.synchroFlag = syncFlag; // nh.synchroFlag=new ArrayList<Integer>(); // vv.getRenderContext().setVertexFillPaintTransformer(nh); // Node Part vv.getRenderContext().setVertexFillPaintTransformer(new Transformer<Integer, Paint>() { public Paint transform(Integer v) { if (vv.getPickedVertexState().isPicked(v)) { return Color.cyan; } else { return Color.red; } } }); // Filter vertex according to degree show_vertex = new VertexDisplayPredicate<Integer, Number>(false); vv.getRenderContext().setVertexIncludePredicate(show_vertex); // Node Score Label // Node Labels vv.getRenderer().getVertexLabelRenderer().setPosition(Renderer.VertexLabel.Position.W); nonvertexLabel = new ConstantTransformer(null); // vertexScores = new VertexScoreTransformer<Integer, // Double>(degreeScorer); degreeScorer = new DegreeScorer(g); transformerDegree = new VertexScoreTransformer<Integer, Double>(degreeScorer); vertexLabelDegree = new NumberFormattingTransformer<Integer>(transformerDegree); /* * vertexLabel= new Transformer <Integer, String>(){ public String * transform(Integer s){ return * degreeScorer.getVertexScore(s).toString(); //return * String.valueOf(degreeScorer.getVertexScore(s)); } }; */ barycenterScorer = new BarycenterScorer(g); transformerBarycenter = new VertexScoreTransformer<Integer, Double>(barycenterScorer); vertexLabelBarycenter = new NumberFormattingTransformer<Integer>(transformerBarycenter); /* * vertexLabelBarycenter= new Transformer <Integer, String>(){ public * String transform(Integer s){ return * barycenterScorer.getVertexScore(s).toString(); * * } }; */ betweennessCentrality = new BetweennessCentrality(g); transformerBetweenness = new VertexScoreTransformer<Integer, Double>(betweennessCentrality); vertexLabelBetweenness = new NumberFormattingTransformer<Integer>(transformerBetweenness); // final BarycenterScorer vertex_degree_scorer= new BarycenterScorer(g); /* * vertexLabelBetweenness= new Transformer <Integer, String>(){ public * String transform(Integer s){ return * betweennessCentrality.getVertexScore(s).toString(); * * } }; */ closenessCentrality = new ClosenessCentrality(g); transformerCloseness = new VertexScoreTransformer<Integer, Double>(closenessCentrality); vertexLabelCloseness = new NumberFormattingTransformer<Integer>(transformerCloseness); // final BarycenterScorer vertex_degree_scorer= new BarycenterScorer(g); /* * vertexLabelCloseness= new Transformer <Integer, String>(){ public * String transform(Integer s){ return * closenessCentrality.getVertexScore(s).toString(); * * } }; */ distanceCentralityScorer = new DistanceCentralityScorer(g, true); transformerDistanceCentrality = new VertexScoreTransformer<Integer, Double>(distanceCentralityScorer); vertexLabelDistanceCentrality = new NumberFormattingTransformer<Integer>(transformerDistanceCentrality); // final BarycenterScorer vertex_degree_scorer= new BarycenterScorer(g); /* * vertexLabelDistanceCentrality= new Transformer <Integer, String>(){ * public String transform(Integer s){ return * distanceCentralityScorer.getVertexScore(s).toString(); * * } }; */ eigenvectorCentrality = new EigenvectorCentrality(g); transformerEigenvector = new VertexScoreTransformer<Integer, Double>(eigenvectorCentrality); vertexLabelEigenvector = new NumberFormattingTransformer<Integer>(transformerEigenvector); // final BarycenterScorer vertex_degree_scorer= new BarycenterScorer(g); /* * vertexLabelEigenvector= new Transformer <Integer, String>(){ public * String transform(Integer s){ return * eigenvectorCentrality.getVertexScore(s).toString(); * * } }; */ // Collection<? extends Object> verts = g.getVertices(); // DegreeScorer vertex_degree_scorer= new DegreeScorer(g); // System.out.println(vertex_degree_scorer.getVertexScore(0)); // for(Integer v:verts){ // System.out.println(vertex_degree_scorer.getVertexScore(v)); // } // vertex_degree_scorer.getVertexScore(verts); // vv.getRenderContext().setVertexLabelTransformer(vertex_degree_scorer.getVertexScore(verts).toString()); // vv.getRenderContext().setVertexLabelTransformer(new // ToStringLabeller()); // Edge Part es_none = new ConstantTransformer(null); vv.getRenderContext().setEdgeLabelTransformer(es_none); // Set Edge Labels vv.getRenderContext().setEdgeLabelRenderer(new DefaultEdgeLabelRenderer(Color.cyan)); edge_label = new Transformer<Number, String>() { public String transform(Number e) { return "Edge:" + String.valueOf(e); } }; // Cluster Part // vv.getRenderContext().setVertexFillPaintTransformer(MapTransformer.<Integer,Paint>getInstance(vertexPaints)); /* * vv.getRenderContext().setVertexDrawPaintTransformer(new * Transformer<Integer,Paint>() { public Paint transform(Integer v) { * if(vv.getPickedVertexState().isPicked(v)) { return Color.cyan; } else * { return Color.BLACK; } } }); */ vv.getRenderContext().setEdgeDrawPaintTransformer(MapTransformer.<Number, Paint>getInstance(edgePaints)); vv.getRenderContext().setEdgeStrokeTransformer(new Transformer<Number, Stroke>() { protected final Stroke THIN = new BasicStroke(1); protected final Stroke THICK = new BasicStroke(2); public Stroke transform(Number e) { Paint c = edgePaints.get(e); if (c == Color.LIGHT_GRAY) { return THIN; } else { return THICK; } } }); // vv.getRenderContext().setEdgeLabelTransformer(stringer); // Satellite part /* * satellite = new SatelliteVisualizationViewer<String,Number>(vv, new * Dimension(200,200)); * satellite.getRenderContext().setEdgeDrawPaintTransformer(new * PickableEdgePaintTransformer<Number>(satellite.getPickedEdgeState(), * Color.black, Color.cyan)); * satellite.getRenderContext().setVertexFillPaintTransformer(new * PickableVertexPaintTransformer * <String>(satellite.getPickedVertexState(), Color.red, Color.yellow)); * * ScalingControl satelliteScaler = new CrossoverScalingControl(); * satellite.scaleToLayout(satelliteScaler); */ // Vertex // vssa = new VertexShapeSizeAspect<Integer,Number>(g, voltages); // PickedState<Integer> picked_state = vv.getPickedVertexState(); // vsh = new VertexStrokeHighlight<Integer,Number>(g, picked_state); // vv.getRenderContext().setVertexStrokeTransformer(vsh); // Control part addControls(this); /* * // Basic button part final ScalingControl scaler = new * CrossoverScalingControl(); * * JButton plus = new JButton("+"); plus.addActionListener(new * ActionListener() { public void actionPerformed(ActionEvent e) { * scaler.scale(vv, 1.1f, vv.getCenter()); } }); JButton minus = new * JButton("-"); minus.addActionListener(new ActionListener() { public * void actionPerformed(ActionEvent e) { scaler.scale(vv, 1 / 1.1f, * vv.getCenter()); } }); JButton reset = new JButton("reset"); * reset.addActionListener(new ActionListener() { public void * actionPerformed(ActionEvent e) { Layout<String, Number> layout = * vv.getGraphLayout(); layout.initialize(); Relaxer relaxer = * vv.getModel().getRelaxer(); if (relaxer != null) { relaxer.stop(); * relaxer.prerelax(); relaxer.relax(); } } }); * * * // Tranform and picking part final DefaultModalGraphMouse<Integer, * Number> graphMouse = new DefaultModalGraphMouse<Integer, Number>(); * vv.setGraphMouse(graphMouse); JComboBox modeBox = * graphMouse.getModeComboBox(); * modeBox.addItemListener(((DefaultModalGraphMouse<Integer, Number>) vv * .getGraphMouse()).getModeListener()); * * //JComboBox modeBox = graphMouse.getModeComboBox(); * //modeBox.addItemListener * (((DefaultModalGraphMouse)satellite.getGraphMouse * ()).getModeListener()); * * this.setBackground(Color.WHITE); this.setLayout(new BorderLayout()); * this.add(vv, BorderLayout.CENTER); Class[] combos = getCombos(); * final JComboBox jcb = new JComboBox(combos); jcb.setRenderer(new * DefaultListCellRenderer() { public Component * getListCellRendererComponent(JList list, Object value, int index, * boolean isSelected, boolean cellHasFocus) { String valueString = * value.toString(); valueString = valueString.substring(valueString * .lastIndexOf('.') + 1); return * super.getListCellRendererComponent(list, valueString, index, * isSelected, cellHasFocus); } }); * * jcb.addActionListener(new LayoutChooser(jcb, vv)); * jcb.setSelectedItem(FRLayout.class); * * JPanel control_panel = new JPanel(new GridLayout(2, 1)); JPanel * topControls = new JPanel(); JPanel bottomControls = new JPanel(); * control_panel.add(topControls); control_panel.add(bottomControls); * this.add(control_panel, BorderLayout.NORTH); * * final JComboBox graph_chooser = new JComboBox(g_names); * * graph_chooser.addActionListener(new GraphChooser(jcb)); * * topControls.add(jcb); topControls.add(graph_chooser); * bottomControls.add(plus); bottomControls.add(minus); * bottomControls.add(modeBox); bottomControls.add(reset); */ // Satellite part // this.add(satellite,BorderLayout.EAST); // Thread t = new Thread(this); // t.start(); }