List of usage examples for java.awt Color lightGray
Color lightGray
To view the source code for java.awt Color lightGray.
Click Source Link
From source file:sanger.team16.gui.genevar.eqtl.query.SNPGeneAssocPlot.java
public SNPGeneAssocPlot(List<Tuple> tuples, double max, double min) throws ArrayIndexOutOfBoundsException { JPanel mainPanel = new JPanel(new GridLayout(0, 3)); mainPanel.setBackground(Color.white); int size = tuples.size(); for (int i = 0; i < size; i++) { Tuple tuple = tuples.get(i);/* w w w. j a v a 2 s. c o m*/ String populationName = tuple.populationName; // if (trait.expressionRanks != null) { // BUG FIXED 02/02/10 if (tuple.phenotypes != null && tuple.phenotypes.length != 0) { CategoryDataset dataset = this.createDataset(tuple); JFreeChart chart = createChart(populationName, dataset, max, min); chart.setBackgroundPaint(Color.white); TextTitle textTitle = new TextTitle(tuple.subtitle); textTitle.setFont(new Font("SansSerif", Font.PLAIN, 12)); //subtitle1.setPosition(RectangleEdge.BOTTOM); textTitle.setHorizontalAlignment(HorizontalAlignment.CENTER); chart.addSubtitle(textTitle); ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setPreferredSize(this.getAutoPreferredSize()); // Original Dimension(680, 420) mainPanel.add(chartPanel); } else { BaseJPane empty = new BaseJPane(2, 50, 0, 0); empty.setPreferredSize(this.getAutoPreferredSize()); BaseJPane na = new BaseJPane(); na.setLayout(new BorderLayout()); JLabel name = new JLabel(" " + populationName); name.setFont(new Font("Arial", Font.BOLD, 12)); name.setForeground(Color.gray); na.add(name, BorderLayout.PAGE_START); JLabel message = new JLabel("Not Available"); message.setForeground(Color.lightGray); na.add(message, BorderLayout.CENTER); empty.add(Box.createHorizontalGlue()); empty.add(na); empty.add(Box.createHorizontalGlue()); empty.setBaseSpringBox(); mainPanel.add(empty); } } this.add(mainPanel); }
From source file:de.fischer.thotti.reportgen.diagram.ChartGenerator.java
private JFreeChart createChart(final String chartTitle, final XYDataset xyDataset) { JFreeChart chart = ChartFactory.createTimeSeriesChart(chartTitle, // title "Date", // x-axis label "Seconds", // y-axis label xyDataset, // data true, // create legend? false, // generate tooltips? false // generate URLs? );/*from ww w .j a v a 2 s .c o m*/ // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART... chart.setBackgroundPaint(Color.white); // final StandardLegend legend = (StandardLegend) chart.getLegend(); // legend.setDisplaySeriesShapes(true); // get a reference to the plot for further customisation... final XYPlot plot = chart.getXYPlot(); plot.setBackgroundPaint(Color.WHITE); // plot.setAxisOffset(new Spacer(Spacer.ABSOLUTE, 5.0, 5.0, 5.0, 5.0)); plot.setDomainGridlinePaint(Color.gray); plot.setRangeGridlinePaint(Color.lightGray); final XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(); //renderer.setSeriesLinesVisible(1, false); //renderer.setSeriesLinesVisible(0, false); plot.setRenderer(renderer); // change the auto tick unit selection to integer units only... final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); // OPTIONAL CUSTOMISATION COMPLETED. DateAxis axis = (DateAxis) plot.getDomainAxis(); axis.setDateFormatOverride(new SimpleDateFormat("dd-MM-yyyy")); return chart; }
From source file:com.orange.atk.graphAnalyser.CreateGraph.java
public CreateGraph() { // jfreechart = ChartFactory.createXYLineChart("Performances", // "time (min)", null, null, PlotOrientation.VERTICAL, false, true, // false);/*from w w w .j av a 2 s . com*/ jfreechart = ChartFactory.createTimeSeriesChart("Performances", "Time (min:sec)", null, null, false, true, false); jfreechart.setBackgroundPaint(Color.white); xyplot = jfreechart.getXYPlot(); xyplot.setOrientation(PlotOrientation.VERTICAL); xyplot.setBackgroundPaint(Color.white); xyplot.setDomainGridlinePaint(Color.lightGray); xyplot.setRangeGridlinePaint(Color.lightGray); chartPanel = new ChartPanel(jfreechart); mapColor = new HashMap<String, Color>(); setMapcolor(); xyplot.setDomainCrosshairVisible(true); xyplot.setDomainCrosshairLockedOnData(false); xyplot.setRangeCrosshairVisible(false); mapPerfGraph = new HashMap<String, PerformanceGraph>(); mapAction = new HashMap<String, GraphMarker>(); }
From source file:com.google.code.facebook.graph.sna.applet.UnicodeLabelDemo.java
public UnicodeLabelDemo() { // create a simple graph for the demo graph = new DirectedSparseGraph<Integer, Number>(); Integer[] v = createVertices(10); createEdges(v);// w w w . ja va 2 s .c om vv = new VisualizationViewer<Integer, Number>(new FRLayout<Integer, Number>(graph)); vv.getRenderContext().setVertexLabelTransformer(new UnicodeVertexStringer<Integer>(v)); vv.getRenderContext().setVertexLabelRenderer(new DefaultVertexLabelRenderer(Color.cyan)); vv.getRenderContext().setEdgeLabelRenderer(new DefaultEdgeLabelRenderer(Color.cyan)); VertexIconShapeTransformer<Integer> vertexIconShapeFunction = new VertexIconShapeTransformer<Integer>( new EllipseVertexShapeTransformer<Integer>()); DefaultVertexIconTransformer<Integer> vertexIconFunction = new DefaultVertexIconTransformer<Integer>(); vv.getRenderContext().setVertexShapeTransformer(vertexIconShapeFunction); vv.getRenderContext().setVertexIconTransformer(vertexIconFunction); loadImages(v, vertexIconFunction.getIconMap()); vertexIconShapeFunction.setIconMap(vertexIconFunction.getIconMap()); vv.getRenderContext().setVertexFillPaintTransformer( new PickableVertexPaintTransformer<Integer>(vv.getPickedVertexState(), Color.white, Color.yellow)); vv.getRenderContext().setEdgeDrawPaintTransformer( new PickableEdgePaintTransformer<Number>(vv.getPickedEdgeState(), Color.black, Color.lightGray)); vv.setBackground(Color.white); // add my listener for ToolTips vv.setVertexToolTipTransformer(new ToStringLabeller<Integer>()); // create a frome to hold the graph final JFrame frame = new JFrame(); Container content = frame.getContentPane(); final GraphZoomScrollPane panel = new GraphZoomScrollPane(vv); content.add(panel); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); final ModalGraphMouse gm = new DefaultModalGraphMouse<Integer, Number>(); vv.setGraphMouse(gm); 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()); } }); JCheckBox lo = new JCheckBox("Show Labels"); lo.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { showLabels = e.getStateChange() == ItemEvent.SELECTED; vv.repaint(); } }); lo.setSelected(true); JPanel controls = new JPanel(); controls.add(plus); controls.add(minus); controls.add(lo); controls.add(((DefaultModalGraphMouse<Integer, Number>) gm).getModeComboBox()); content.add(controls, BorderLayout.SOUTH); frame.pack(); frame.setVisible(true); }
From source file:graphs.ResultsGraphs.java
/** * Creates a sample chart.// w ww. ja v a 2 s . c o m * * @param dataset the dataset. * * @return The chart. */ private JFreeChart createChart(final CategoryDataset dataset) { // create the chart... final JFreeChart chart = ChartFactory.createBarChart("Mashup Language Sentiment Algorithm Performance ", // chart title "Performance Metric", // domain axis label "Value", // range axis label dataset, // data PlotOrientation.VERTICAL, // orientation true, // include legend true, // tooltips? false // URLs? ); // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART... // set the background color for the chart... chart.setBackgroundPaint(Color.white); // get a reference to the plot for further customisation... final CategoryPlot plot = chart.getCategoryPlot(); plot.setBackgroundPaint(Color.lightGray); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); // set the range axis to display integers only... final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); // disable bar outlines... final BarRenderer renderer = (BarRenderer) plot.getRenderer(); renderer.setDrawBarOutline(false); // set up gradient paints for series... final GradientPaint gp0 = new GradientPaint(0.0f, 0.0f, Color.blue, 0.0f, 0.0f, Color.lightGray); final GradientPaint gp1 = new GradientPaint(0.0f, 0.0f, Color.green, 0.0f, 0.0f, Color.lightGray); final GradientPaint gp2 = new GradientPaint(0.0f, 0.0f, Color.red, 0.0f, 0.0f, Color.lightGray); renderer.setSeriesPaint(0, gp0); renderer.setSeriesPaint(1, gp1); renderer.setSeriesPaint(2, gp2); final CategoryAxis domainAxis = plot.getDomainAxis(); domainAxis.setCategoryLabelPositions(CategoryLabelPositions.createUpRotationLabelPositions(Math.PI / 6.0)); // OPTIONAL CUSTOMISATION COMPLETED. return chart; }
From source file:edu.uci.ics.jung.samples.UnicodeLabelDemo.java
@SuppressWarnings("unchecked") public UnicodeLabelDemo() { // create a simple graph for the demo graph = new DirectedSparseGraph<Integer, Number>(); Integer[] v = createVertices(10); createEdges(v);// w w w . j a v a 2 s. c o m vv = new VisualizationViewer<Integer, Number>(new FRLayout<Integer, Number>(graph)); vv.getRenderContext().setVertexLabelTransformer(new UnicodeVertexStringer<Integer>(v)); vv.getRenderContext().setVertexLabelRenderer(new DefaultVertexLabelRenderer(Color.cyan)); vv.getRenderContext().setEdgeLabelRenderer(new DefaultEdgeLabelRenderer(Color.cyan)); VertexIconShapeTransformer<Integer> vertexIconShapeFunction = new VertexIconShapeTransformer<Integer>( new EllipseVertexShapeTransformer<Integer>()); DefaultVertexIconTransformer<Integer> vertexIconFunction = new DefaultVertexIconTransformer<Integer>(); vv.getRenderContext().setVertexShapeTransformer(vertexIconShapeFunction); vv.getRenderContext().setVertexIconTransformer(vertexIconFunction); loadImages(v, vertexIconFunction.getIconMap()); vertexIconShapeFunction.setIconMap(vertexIconFunction.getIconMap()); vv.getRenderContext().setVertexFillPaintTransformer( new PickableVertexPaintTransformer<Integer>(vv.getPickedVertexState(), Color.white, Color.yellow)); vv.getRenderContext().setEdgeDrawPaintTransformer( new PickableEdgePaintTransformer<Number>(vv.getPickedEdgeState(), Color.black, Color.lightGray)); vv.setBackground(Color.white); // add my listener for ToolTips vv.setVertexToolTipTransformer(new ToStringLabeller<Integer>()); // create a frome to hold the graph final JFrame frame = new JFrame(); Container content = frame.getContentPane(); final GraphZoomScrollPane panel = new GraphZoomScrollPane(vv); content.add(panel); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); final ModalGraphMouse gm = new DefaultModalGraphMouse<Integer, Number>(); vv.setGraphMouse(gm); 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()); } }); JCheckBox lo = new JCheckBox("Show Labels"); lo.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { showLabels = e.getStateChange() == ItemEvent.SELECTED; vv.repaint(); } }); lo.setSelected(true); JPanel controls = new JPanel(); controls.add(plus); controls.add(minus); controls.add(lo); controls.add(((DefaultModalGraphMouse<Integer, Number>) gm).getModeComboBox()); content.add(controls, BorderLayout.SOUTH); frame.pack(); frame.setVisible(true); }
From source file:edu.cmu.sv.modelinference.eventtool.charting.DataChart.java
private JFreeChart createChart(String yLabel) { //Create the chart final JFreeChart chart = ChartFactory.createXYLineChart("Chart", "Time", yLabel, null); chart.setBackgroundPaint(Color.white); XYPlot plot = chart.getXYPlot();/*from w ww .j a v a 2 s.co m*/ plot.setBackgroundPaint(Color.lightGray); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(); plot.setRenderer(renderer); // change the auto tick unit selection to integer units only... final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); return chart; }
From source file:j2se.jfreechart.barchart.BarChartDemo5.java
/** * Creates a chart.//from www.j ava2 s .c o m * * @param dataset the dataset. * * @return A chart. */ private JFreeChart createChart(final CategoryDataset dataset) { // create the chart... final JFreeChart chart = ChartFactory.createBarChart("Bar Chart", // chart title "Category", // domain axis label "Score (%)", // range axis label dataset, // data PlotOrientation.HORIZONTAL, // orientation true, // include legend true, false); // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART... chart.setBackgroundPaint(Color.lightGray); // get a reference to the plot for further customisation... final CategoryPlot plot = chart.getCategoryPlot(); plot.getRenderer().setSeriesPaint(0, new Color(0, 0, 255)); plot.getRenderer().setSeriesPaint(1, new Color(75, 75, 255)); plot.getRenderer().setSeriesPaint(2, new Color(150, 150, 255)); // change the auto tick unit selection to integer units only... final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setRange(0.0, 100.0); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); // NumberAxis hna = rangeAxis; // MarkerAxisBand band = new MarkerAxisBand(hna, 2.0, 2.0, 2.0, 2.0, // new Font("SansSerif", Font.PLAIN, 9)); // IntervalMarker m1 = new IntervalMarker(0.0, 33.0, "Low", Color.gray, // new BasicStroke(0.5f), Color.green, 0.75f); // IntervalMarker m2 = new IntervalMarker(33.0, 66.0, "Medium", Color.gray, // new BasicStroke(0.5f), Color.orange, 0.75f); // IntervalMarker m3 = new IntervalMarker(66.0, 100.0, "High", Color.gray, // new BasicStroke(0.5f), Color.red, 0.75f); // band.addMarker(m1); // band.addMarker(m2); // band.addMarker(m3); // hna.setMarkerBand(band); // OPTIONAL CUSTOMISATION COMPLETED. return chart; }
From source file:arduinoserialread.SerialRead.java
private void initGUI() { // init the frame frame.setTitle("Arduino Serial Read"); frame.setBounds(100, 100, 600, 500); frame.setMinimumSize(new Dimension(600, 500)); frame.setLocationRelativeTo(null);/*from w w w . j a v a 2s .c o m*/ frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // init control panel JPanel ctrlPanel = new JPanel(); ctrlPanel.setLayout(new FlowLayout()); // init the serial connection panel serialCOM = new SerialConnectionPanel(); ctrlPanel.add(serialCOM); frame.getContentPane().add(ctrlPanel, BorderLayout.SOUTH); // init the connection status ConnectionStatus connectionStatus = new ConnectionStatus(); ctrlPanel.add(connectionStatus); // init connect and disconnect button connect = new JButton("connect"); ctrlPanel.add(connect); disconnect = new JButton("disconnect"); ctrlPanel.add(disconnect); // init real time chart TimeSeries series = new TimeSeries("DATA"); DateAxis timeAxis = new DateAxis("Time"); dataset = new TimeSeriesCollection(series); NumberAxis rangeAxis = new NumberAxis("Data"); rangeAxis.setAutoRangeIncludesZero(false); rangeAxis.setAutoRange(true); XYPlot plot = new XYPlot(dataset, timeAxis, rangeAxis, new StandardXYItemRenderer()); plot.setBackgroundPaint(Color.white); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); plot.getRenderer().setSeriesPaint(0, new Color(0, 142, 192)); ValueAxis domainAxis = plot.getDomainAxis(); domainAxis.setAutoRange(true); domainAxis.setFixedAutoRange(30000.0); // 30 seconds // init the JFreeChart JFreeChart chart = new JFreeChart("Real-Time Data Chart", plot); chart.setBorderPaint(Color.lightGray); chart.setBorderVisible(true); chart.setBackgroundPaint(Color.white); chart.removeLegend(); // add real time chart to the frame ChartPanel chartPanel = new ChartPanel(chart); frame.getContentPane().add(chartPanel, BorderLayout.CENTER); }
From source file:org.jfree.chart.demo.StackedAreaChartDemo.java
/** * Creates a sample chart.//from w w w. ja v a2s. co m * * @param dataset the dataset. * * @return A sample chart. */ public JFreeChart createChart(CategoryDataset dataset) { final JFreeChart chart = ChartFactory.createStackedAreaChart("Stacked Area Chart", // chart title "Category", // domain axis label "Value", // range axis label dataset, // data PlotOrientation.VERTICAL, // orientation true, // include legend true, false); chart.setBackgroundPaint(Color.white); final CategoryPlot plot = (CategoryPlot) chart.getPlot(); plot.setForegroundAlpha(0.5f); plot.setBackgroundPaint(Color.lightGray); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); final CategoryAxis domainAxis = plot.getDomainAxis(); domainAxis.setLowerMargin(0.0); domainAxis.setUpperMargin(0.0); // change the auto tick unit selection to integer units only... final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); final CategoryItemRenderer renderer = plot.getRenderer(); renderer.setItemLabelsVisible(true); return chart; }