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:org.vast.stt.renderer.JFreeChart.XYPlotBuilder.java
public void createPlot(ChartScene scene) { this.scene = scene; // scene contains the axis info, so passing it in here for now datasetCount = 0;/*from w ww.j ava 2 s .com*/ rangeAxisCount = 0; currentItem = null; axisTable.clear(); plot = new XYPlot(); plot.setBackgroundPaint(Color.lightGray); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); String axisName = "Time (s)"; NumberAxis domainAxis = new NumberAxis(axisName); domainAxis.setAutoRangeIncludesZero(false); domainAxis.setAutoRange(false); domainAxis.setNumberFormatOverride(new DateFormat()); domainAxis.setTickLabelInsets(new RectangleInsets(0, 30, 0, 30)); domainAxis.setLowerBound(scene.getDomainMin()); domainAxis.setUpperBound(scene.getDomainMax()); plot.setDomainAxis(datasetCount, domainAxis); }
From source file:edu.unibonn.plotting.TimeSeriesPlotter_Sensors.java
private JFreeChart createChart(final XYDataset dataset) { final JFreeChart chart = ChartFactory.createTimeSeriesChart("Sensors", "Time", "Erlang", dataset, false, true, false);/*from ww w .ja v a 2s .co m*/ chart.setBackgroundPaint(Color.white); // final StandardLegend sl = (StandardLegend) chart.getLegend(); // sl.setDisplaySeriesShapes(true); final XYPlot plot = chart.getXYPlot(); plot.setBackgroundPaint(Color.lightGray); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); // plot.setAxisOffset(new Spacer(Spacer.ABSOLUTE, 5.0, 5.0, 5.0, 5.0)); plot.setDomainCrosshairVisible(true); plot.setRangeCrosshairVisible(true); final XYItemRenderer renderer = plot.getRenderer(); if (renderer instanceof StandardXYItemRenderer) { final StandardXYItemRenderer rr = (StandardXYItemRenderer) renderer; //rr.setPlotShapes(true); rr.setShapesFilled(true); rr.setItemLabelsVisible(true); } final DateAxis axis = (DateAxis) plot.getDomainAxis(); axis.setDateFormatOverride(new SimpleDateFormat("dd-MM-yyyy hh:mm")); return chart; }
From source file:com.robertolosanno.cdt_maven.Cdt.java
public Cdt() { //Ontologia//www.j a va 2s . c om OntModel m = ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM); loadModel(m); ExtendedIterator<OntClass> iter = m.listHierarchyRootClasses(); // create a simple graph graph = new DelegateTree<String, String>(); createTree(iter); //Vincoli System.out.println("--- CONSTRAINTS ---"); ExtendedIterator<ObjectProperty> iterProp = m.listObjectProperties(); while (iterProp.hasNext()) { ObjectProperty objProp = iterProp.next(); plotConstraint(objProp); } treeLayout = new TreeLayout<String, String>(graph); vv = new VisualizationViewer<String, String>(treeLayout, new Dimension(1200, 600)); vv.setBackground(Color.white); vv.getRenderContext().setEdgeShapeTransformer(new EdgeShape.Line()); vv.getRenderContext().setArrowFillPaintTransformer(new ConstantTransformer(Color.lightGray)); //***************** MODIFICA COLORE VERTICE ************************ Transformer<String, Paint> vertexColor = new Transformer<String, Paint>() { public Paint transform(String s) { String[] ss = s.split("#"); String type = ss[1]; if (type.equals("root")) return Color.lightGray; if (type.equals("dim")) return Color.BLACK; if (type.equals("val")) return Color.WHITE; if (type.equals("par_val")) return Color.WHITE; if (type.equals("par_dim")) return Color.WHITE; return Color.GREEN; } }; vv.getRenderContext().setVertexFillPaintTransformer(vertexColor); //**************** MODIFICA FORMA VERTICE *************************** //Dati per creare un triangolo (lo creaiamo attraverso la classe Polygon) final int[] xShape = new int[4]; final int[] yShape = new int[4]; final int nShape; // count of points // Make a shape xShape[0] = -10; xShape[1] = 0; xShape[2] = 10; yShape[0] = 0; yShape[1] = 20; yShape[2] = 0; nShape = 3; Transformer<String, Shape> vertexShape = new Transformer<String, Shape>() { private final Shape[] styles = { new Rectangle(-10, -10, 20, 20), new Ellipse2D.Double(-10, -10, 20, 20), new Polygon(xShape, yShape, nShape) //Triangolo }; @Override public Shape transform(String i) { String[] type = i.split("#"); if (type[1].equals("par_val")) { return styles[0]; } else if (type[1].equals("par_dim")) { return styles[2]; } else { return styles[1]; } } }; vv.getRenderContext().setVertexShapeTransformer(vertexShape); // vv.getRenderer().setVertexRenderer(new MyRenderer()); //**************** MODIFICA FONT LABEL *************************** vv.getRenderContext().setVertexFontTransformer(new Transformer<String, Font>() { @Override public Font transform(String arg0) { Font font = new Font("Arial Unicode MS", Font.PLAIN, 11); return font; } }); // ********************** POSIZIONA LA LABEL SOTTO IL VERTICE **************************** vv.getRenderer().getVertexLabelRenderer().setPosition(Renderer.VertexLabel.Position.CNTR); vv.getRenderer().getVertexLabelRenderer().setPosition(Renderer.VertexLabel.Position.S); //******************** RIMUOVE DAL TESTO DELLA LABEL DEL VERTICE IL TIPO DI VERTICE ************************ Transformer<String, String> transformer = new Transformer<String, String>() { @Override public String transform(String arg0) { String[] node = arg0.split("#"); return node[0]; } }; vv.getRenderContext().setVertexLabelTransformer(transformer); Container content = getContentPane(); final GraphZoomScrollPane panel = new GraphZoomScrollPane(vv); content.add(panel); final DefaultModalGraphMouse graphMouse = new DefaultModalGraphMouse(); vv.setGraphMouse(graphMouse); JComboBox modeBox = graphMouse.getModeComboBox(); modeBox.addItemListener(graphMouse.getModeListener()); graphMouse.setMode(ModalGraphMouse.Mode.TRANSFORMING); 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()); } }); JPanel scaleGrid = new JPanel(new GridLayout(1, 0)); scaleGrid.setBorder(BorderFactory.createTitledBorder("Zoom")); JPanel controls = new JPanel(); scaleGrid.add(plus); scaleGrid.add(minus); controls.add(scaleGrid); controls.add(modeBox); content.add(controls, BorderLayout.SOUTH); }
From source file:smarthouse_server.LineChart.java
/** * Creates a sample chart.// w ww . j av a2 s. co m * * @param dataset a dataset. * * @return The chart. */ private JFreeChart createChart(CategoryDataset dataset) { // create the chart... chart = ChartFactory.createLineChart("Room Monitor #", // chart title "Time", // 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... // StandardLegend legend = (StandardLegend) chart.getLegend(); // legend.setDisplaySeriesShapes(true); // legend.setShapeScaleX(1.5); // legend.setShapeScaleY(1.5); //legend.setDisplaySeriesLines(true); chart.setBackgroundPaint(Color.white); CategoryPlot plot = (CategoryPlot) chart.getPlot(); plot.setBackgroundPaint(Color.lightGray); plot.setRangeGridlinePaint(Color.white); plot.getDomainAxis().setVisible(false); // customise the range axis... NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); rangeAxis.setAutoRangeIncludesZero(true); // **************************************************************************** // * JFREECHART DEVELOPER GUIDE * // * The JFreeChart Developer Guide, written by David Gilbert, is available * // * to purchase from Object Refinery Limited: * // * * // * http://www.object-refinery.com/jfreechart/guide.html * // * * // * Sales are used to provide funding for the JFreeChart project - please * // * support us so that we can continue developing free software. * // **************************************************************************** // customise the renderer... LineAndShapeRenderer renderer = (LineAndShapeRenderer) plot.getRenderer(); // renderer.setDrawShapes(true); renderer.setSeriesStroke(0, new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 1.0f, new float[] { 10.0f, 6.0f }, 0.0f)); renderer.setSeriesStroke(1, new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 1.0f, new float[] { 6.0f, 6.0f }, 0.0f)); /* renderer.setSeriesStroke( 2, new BasicStroke( 2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 1.0f, new float[] {2.0f, 6.0f}, 0.0f ) );*/ // OPTIONAL CUSTOMISATION COMPLETED. return chart; }
From source file:org.micromanager.CRISP.CRISPFrame.java
/** * Create a frame with a plot of the data given in XYSeries *///from w w w . j a v a 2 s . c o m public static void plotData(String title, XYSeries data, String xTitle, String yTitle, int xLocation, int yLocation) { // JFreeChart code XYSeriesCollection dataset = new XYSeriesCollection(); dataset.addSeries(data); JFreeChart chart = ChartFactory.createScatterPlot(title, // Title xTitle, // x-axis Label yTitle, // y-axis Label dataset, // Dataset PlotOrientation.VERTICAL, // Plot Orientation false, // Show Legend true, // Use tooltips false // Configure chart to generate URLs? ); XYPlot plot = (XYPlot) chart.getPlot(); plot.setBackgroundPaint(Color.white); plot.setRangeGridlinePaint(Color.lightGray); XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) plot.getRenderer(); renderer.setBaseShapesVisible(true); renderer.setSeriesPaint(0, Color.black); renderer.setSeriesFillPaint(0, Color.white); renderer.setSeriesLinesVisible(0, true); Shape circle = new Ellipse2D.Float(-2.0f, -2.0f, 4.0f, 4.0f); renderer.setSeriesShape(0, circle, false); renderer.setUseFillPaint(true); ChartFrame graphFrame = new ChartFrame(title, chart); graphFrame.getChartPanel().setMouseWheelEnabled(true); graphFrame.pack(); graphFrame.setLocation(xLocation, yLocation); graphFrame.setVisible(true); }
From source file:AnimatedMetadataGraph.java
@Override public void init() { //create a graph Graph<String, String> ig = Graphs .<String, String>synchronizedDirectedGraph(new DirectedSparseMultigraph<String, String>()); ObservableGraph<String, String> og = new ObservableGraph<String, String>(ig); og.addGraphEventListener(new GraphEventListener<String, String>() { public void handleGraphEvent(GraphEvent<String, String> evt) { System.err.println("got " + evt); }//from ww w . j av a 2s. c o m }); this.g = og; //create a graphdraw layout = new FRLayout<String, String>(g); layout.setSize(new Dimension(600, 600)); Relaxer relaxer = new VisRunner((IterativeContext) layout); relaxer.stop(); relaxer.prerelax(); Layout<String, String> staticLayout = new StaticLayout<String, String>(g, layout); vv = new VisualizationViewer<String, String>(staticLayout, new Dimension(600, 600)); JRootPane rp = this.getRootPane(); rp.putClientProperty("defeatSystemEventQueueCheck", Boolean.TRUE); getContentPane().setLayout(new BorderLayout()); getContentPane().setBackground(java.awt.Color.lightGray); getContentPane().setFont(new Font("Serif", Font.PLAIN, 12)); vv.setGraphMouse(new DefaultModalGraphMouse<Number, Number>()); vv.getRenderer().getVertexLabelRenderer().setPosition(Renderer.VertexLabel.Position.CNTR); vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller<String>()); vv.setForeground(Color.black); vv.addComponentListener(new ComponentAdapter() { /** * @see java.awt.event.ComponentAdapter#componentResized(java.awt.event.ComponentEvent) */ @Override public void componentResized(ComponentEvent arg0) { super.componentResized(arg0); System.err.println("resized"); layout.setSize(arg0.getComponent().getSize()); } }); getContentPane().add(vv); switchLayout = new JButton("Switch to SpringLayout"); switchLayout.addActionListener(new ActionListener() { @SuppressWarnings("unchecked") public void actionPerformed(ActionEvent ae) { Dimension d = vv.getSize();//new Dimension(600,600); if (switchLayout.getText().indexOf("Spring") > 0) { switchLayout.setText("Switch to FRLayout"); layout = new SpringLayout<String, String>(g, new ConstantTransformer(EDGE_LENGTH)); layout.setSize(d); Relaxer relaxer = new VisRunner((IterativeContext) layout); relaxer.stop(); relaxer.prerelax(); StaticLayout<String, String> staticLayout = new StaticLayout<String, String>(g, layout); LayoutTransition<String, String> lt = new LayoutTransition<String, String>(vv, vv.getGraphLayout(), staticLayout); Animator animator = new Animator(lt); animator.start(); // vv.getRenderContext().getMultiLayerTransformer().setToIdentity(); vv.repaint(); } else { switchLayout.setText("Switch to SpringLayout"); layout = new FRLayout<String, String>(g, d); layout.setSize(d); Relaxer relaxer = new VisRunner((IterativeContext) layout); relaxer.stop(); relaxer.prerelax(); StaticLayout<String, String> staticLayout = new StaticLayout<String, String>(g, layout); LayoutTransition<String, String> lt = new LayoutTransition<String, String>(vv, vv.getGraphLayout(), staticLayout); Animator animator = new Animator(lt); animator.start(); // vv.getRenderContext().getMultiLayerTransformer().setToIdentity(); vv.repaint(); } } }); getContentPane().add(switchLayout, BorderLayout.SOUTH); timer = new Timer(); }
From source file:org.hammurapi.inspectors.metrics.reporting.LocCharts.java
private void customizeChartBars(JFreeChart chart) { // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART... // set the background color for the chart... chart.setBackgroundPaint(new Color(0xBBBBDD)); // get a reference to the plot for further customisation... XYPlot plot = chart.getXYPlot();/*from ww w .j a va 2s . c o m*/ // set the range axis to display integers only... NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); // disable bar outlines... XYItemRenderer renderer = (XYItemRenderer) plot.getRenderer(); // renderer.ssetDrawBarOutline(false); GradientPaint gp1 = new GradientPaint(0.0f, 0.0f, Color.green, 0.0f, 0.0f, Color.lightGray); GradientPaint gp2 = new GradientPaint(0.0f, 0.0f, Color.red, 0.0f, 0.0f, Color.lightGray); renderer.setSeriesPaint(0, gp1); renderer.setSeriesPaint(1, gp2); ValueAxis domainAxis = plot.getDomainAxis(); //domainAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_90); //domainAxis.setMaxCategoryLabelWidthRatio(5.0f); // OPTIONAL CUSTOMISATION COMPLETED. }
From source file:edu.ucla.stat.SOCR.chart.demo.StackedAreaChartDemo.java
/** * Creates a sample chart./*w w w . j av a 2 s . c o m*/ * * @param dataset the dataset. * * @return A sample chart. */ protected JFreeChart createChart(CategoryDataset dataset) { JFreeChart chart = ChartFactory.createStackedAreaChart(chartTitle, // chart title domainLabel, // domain axis label rangeLabel, // range axis label dataset, // data PlotOrientation.VERTICAL, // orientation !legendPanelOn, // include legend true, false); chart.setBackgroundPaint(Color.white); CategoryPlot plot = (CategoryPlot) chart.getPlot(); plot.setForegroundAlpha(0.85f); plot.setBackgroundPaint(Color.lightGray); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); CategoryAxis domainAxis = plot.getDomainAxis(); domainAxis.setLowerMargin(0.0); domainAxis.setUpperMargin(0.0); // change the auto tick unit selection to integer units only... NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); CategoryItemRenderer renderer = plot.getRenderer(); renderer.setBaseItemLabelsVisible(true); AreaRenderer renderer2 = (AreaRenderer) plot.getRenderer(); renderer2.setLegendItemLabelGenerator(new SOCRCategorySeriesLabelGenerator()); return chart; }
From source file:livecanvas.mesheditor.MeshEditor.java
public MeshEditor() { super("Mesh Editor", new ImageIcon(clazz.getResource("res/mesh_editor.png")), new BorderLayout()); setPreferredSize(new Dimension(1024, 600)); setBackground(Color.darkGray); tools = createTools();//from w w w . j a v a 2 s . c o m add(tools, BorderLayout.WEST); selectedColor = Color.black; JPanel east = new JPanel(new BorderLayout()); east.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); Layer rootLayer = new Layer("ROOT"); rootLayer.addSubLayer(new Layer("Layer1")); layersView = new LayersView(rootLayer); chain(layersView); layersView.addListener(this); east.add(layersView, BorderLayout.NORTH); propertiesPanel = new JPanel(new BorderLayout()); east.add(propertiesPanel); viewpointsView = new ViewpointsView(layersView.getSelectedLayer()); viewpointsView.addListener(this); east.add(viewpointsView, BorderLayout.SOUTH); add(east, BorderLayout.EAST); JPanel center = new JPanel(new BorderLayout()); center.setBackground(Color.lightGray); canvas = new CanvasMesh(800, 600); canvas.setCurrLayer(getRootLayer()); pointerHandler = new AffineTransformPointerHandler(canvas); canvas.setPointerHandler(pointerHandler); canvasContainer = new CanvasContainer(canvas); rootLayer.setCanvas(canvas); center.add(canvasContainer); renderImageSettings = new RenderImageSettings(); settings = new MeshEditorSettings(canvas.getSettings(), layersView.getSettings(), renderImageSettings); add(center); layersView.layersList.setSelectedIndex(1); setSelectedToolType(TOOLS_BRUSH); }
From source file:edu.turtlekit2.tools.chart.ChartWindow.java
/** * Creates a chart. Local use./* w ww. j av a 2 s .c o m*/ * @param dataset - the data for the chart. * @param title - the name of the chart * @param xName - the name of the x-axis. * @param yName - the name of the y-axis. * @return a chart. */ private JFreeChart createChart(final XYDataset dataset, String title, String xName, String yName) { // create the chart... final JFreeChart chart = ChartFactory.createXYLineChart(title, // chart title xName, // x axis label yName, // y axis label dataset, // data PlotOrientation.VERTICAL, true, // include legend true, // tooltips false // urls ); // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART... chart.setBackgroundPaint(Color.white); // get a reference to the plot for further customisation... final XYPlot plot = chart.getXYPlot(); plot.setBackgroundPaint(Color.lightGray); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); final XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(); // final XYAreaRenderer2 renderer = new XYAreaRenderer2(); renderer.setSeriesShapesVisible(0, false); renderer.setSeriesShapesVisible(1, false); renderer.setSeriesShapesVisible(2, false); plot.setRenderer(renderer); // renderer.setSeriesStroke( // 0, new BasicStroke( // 2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, // 1.0f, new float[] {1.0f, 6.0f}, 0.0f // ) // ); // renderer.setSeriesStroke( // 1, new BasicStroke( // 2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, // 1.0f, new float[] {1.0f, 6.0f}, 0.0f // ) // ); // renderer.setSeriesStroke( // 2, new BasicStroke( // 2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, // 1.0f, new float[] {1.0f, 6.0f}, 0.0f // ) // ); // // change the auto tick unit selection to integer units only... final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); return chart; }