List of usage examples for java.awt BasicStroke BasicStroke
public BasicStroke(float width)
From source file:Componentes.TermometroMin.java
@Override public void pintar(javax.swing.JPanel p, int pos) { p.removeAll();/* ww w.j a v a 2 s .c o m*/ DefaultValueDataset data = new DefaultValueDataset(new Double(ventana.getGraphdata().getTmin())); ThermometerPlot plot = new ThermometerPlot(data); chart = new JFreeChart("Temperatura Mnima, \nMES: " + Calculos.get_mes(ventana.getMonthdata().getdata()), // chart title JFreeChart.DEFAULT_TITLE_FONT, plot, // plot false); Color Darkorange = new Color(255, 140, 0); Color Crimson = new Color(220, 20, 60); Color Aquamarine = new Color(127, 255, 212); Color Darkslategray = new Color(47, 79, 79); plot.setMercuryPaint(Aquamarine); plot.setSubrange(NORMAL, 0, 2.5); plot.setSubrange(WARNING, 2.6, 7.5); plot.setSubrange(CRITICAL, 7.6, 20); plot.setSubrangePaint(NORMAL, Aquamarine); plot.setSubrangePaint(WARNING, Darkorange); plot.setSubrangePaint(CRITICAL, Crimson); plot.setThermometerStroke(new BasicStroke(2.0f)); plot.setThermometerPaint(Darkslategray); plot.setDisplayRange(2, Calculos.get_min(datos.getTmin()), Calculos.get_max(datos.getTmin())); plot.setRange(Calculos.get_min(datos.getTmin()), Calculos.get_max(datos.getTmin())); panel = new ChartPanel(chart); panel.setBounds(5, 5, 300, 300); panel.repaint(); p.add(panel); // jPanel1.repaint(); p.updateUI(); // aoIndex=aoAux; ///aoAux = 0; }
From source file:org.jfree.chart.demo.XYDrawableAnnotationDemo1.java
private static JFreeChart createChart(XYDataset xydataset) { JFreeChart jfreechart = ChartFactory.createTimeSeriesChart("XYDrawableAnnotationDemo1", null, "$ million", xydataset, true, true, false); XYPlot xyplot = (XYPlot) jfreechart.getPlot(); xyplot.setDomainPannable(true);//from w w w . j a v a 2s.co m xyplot.setRangePannable(true); DateAxis dateaxis = (DateAxis) xyplot.getDomainAxis(); dateaxis.setLowerMargin(0.20000000000000001D); dateaxis.setUpperMargin(0.20000000000000001D); dateaxis.setStandardTickUnits(createStandardDateTickUnits()); NumberAxis numberaxis = (NumberAxis) xyplot.getRangeAxis(); numberaxis.setLowerMargin(0.20000000000000001D); numberaxis.setUpperMargin(0.20000000000000001D); XYLineAndShapeRenderer xylineandshaperenderer = new XYLineAndShapeRenderer(); xylineandshaperenderer.setBaseShapesVisible(true); xylineandshaperenderer.setBaseLinesVisible(true); xylineandshaperenderer.setSeriesShape(0, new java.awt.geom.Ellipse2D.Double(-5D, -5D, 10D, 10D)); xylineandshaperenderer.setSeriesShape(1, new java.awt.geom.Ellipse2D.Double(-5D, -5D, 10D, 10D)); xylineandshaperenderer.setSeriesStroke(0, new BasicStroke(3F)); xylineandshaperenderer.setSeriesStroke(1, new BasicStroke(3F, 1, 1, 5F, new float[] { 10F, 5F }, 0.0F)); xylineandshaperenderer.setSeriesFillPaint(0, Color.white); xylineandshaperenderer.setSeriesFillPaint(1, Color.white); xylineandshaperenderer.setUseFillPaint(true); xylineandshaperenderer.setBaseToolTipGenerator(new StandardXYToolTipGenerator()); xylineandshaperenderer.setDefaultEntityRadius(6); xylineandshaperenderer.addAnnotation(new XYDrawableAnnotation((new Month(4, 2005)).getFirstMillisecond(), 600D, 180D, 100D, 3D, createPieChart())); xylineandshaperenderer.addAnnotation(new XYDrawableAnnotation((new Month(9, 2007)).getFirstMillisecond(), 1250D, 120D, 100D, 2D, createBarChart())); xyplot.setRenderer(xylineandshaperenderer); return jfreechart; }
From source file:org.schreibubi.JCombinations.jfreechart.ArbitraryMarker.java
/** * Constructor/*from w w w . j a v a2 s. c o m*/ * * @param domainVal * x-values of range * @param rangeLow * lower y-values of range * @param rangeHigh * upper y-values of range */ public ArbitraryMarker(ArrayList<Double> domainVal, ArrayList<Double> rangeLow, ArrayList<Double> rangeHigh) { this(domainVal, rangeLow, rangeHigh, new Color(222, 222, 255, 240), new BasicStroke(0.5f), new Color(222, 222, 255, 240), new BasicStroke(0.5f), 0.5f); }
From source file:org.jfree.chart.demo.PeriodAxisDemo1.java
private static JFreeChart createChart(XYDataset xydataset) { JFreeChart jfreechart = ChartFactory.createTimeSeriesChart("Legal & General Unit Trust Prices", "Date", "Price Per Unit", xydataset, true, true, false); jfreechart.setBackgroundPaint(Color.white); XYPlot xyplot = (XYPlot) jfreechart.getPlot(); xyplot.setBackgroundPaint(Color.lightGray); xyplot.setDomainGridlinePaint(Color.white); xyplot.setRangeGridlinePaint(Color.white); xyplot.setAxisOffset(new RectangleInsets(5D, 5D, 5D, 5D)); xyplot.setDomainCrosshairVisible(true); xyplot.setRangeCrosshairVisible(true); org.jfree.chart.renderer.xy.XYItemRenderer xyitemrenderer = xyplot.getRenderer(); if (xyitemrenderer instanceof XYLineAndShapeRenderer) { XYLineAndShapeRenderer xylineandshaperenderer = (XYLineAndShapeRenderer) xyitemrenderer; xylineandshaperenderer.setBaseShapesVisible(true); xylineandshaperenderer.setBaseShapesFilled(true); xylineandshaperenderer.setBaseItemLabelsVisible(true); }//from w ww . j a v a 2 s .com PeriodAxis periodaxis = new PeriodAxis("Date"); periodaxis.setTimeZone(TimeZone.getTimeZone("Pacific/Auckland")); periodaxis.setAutoRangeTimePeriodClass(org.jfree.data.time.Month.class); periodaxis.setMajorTickTimePeriodClass(org.jfree.data.time.Month.class); PeriodAxisLabelInfo aperiodaxislabelinfo[] = new PeriodAxisLabelInfo[2]; aperiodaxislabelinfo[0] = new PeriodAxisLabelInfo(org.jfree.data.time.Month.class, new SimpleDateFormat("MMM"), new RectangleInsets(2D, 2D, 2D, 2D), new Font("SansSerif", 1, 10), Color.blue, false, new BasicStroke(0.0F), Color.lightGray); aperiodaxislabelinfo[1] = new PeriodAxisLabelInfo(org.jfree.data.time.Year.class, new SimpleDateFormat("yyyy")); periodaxis.setLabelInfo(aperiodaxislabelinfo); xyplot.setDomainAxis(periodaxis); return jfreechart; }
From source file:com.mycompany.istudy.principalservices.GraphicalView.java
/** * Overwrites the method of createXYLineChart from ChartFactory interface * and creates a XYLine Chart.//from w w w . ja v a 2 s . c om * @param applicationTitle * @param chartTitle * @param investedHoursPerWeek * @param hoursToBeInvested */ public GraphicalView(String applicationTitle, String chartTitle, Map<Double, Double> investedHoursPerWeek, Map<Double, Double> hoursToBeInvested) { super(applicationTitle); xylineChart = ChartFactory.createXYLineChart(chartTitle, "Calender Weeks", "Invested Study-hours", createDataset(investedHoursPerWeek, hoursToBeInvested), PlotOrientation.VERTICAL, true, true, false); ChartPanel chartPanel = new ChartPanel(xylineChart); chartPanel.setPreferredSize(new java.awt.Dimension(560, 367)); final XYPlot plot = xylineChart.getXYPlot(); XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(); renderer.setSeriesPaint(0, Color.BLUE); renderer.setSeriesPaint(1, Color.RED); renderer.setSeriesStroke(0, new BasicStroke(4.0f)); plot.setRenderer(renderer); setContentPane(chartPanel); }
From source file:org.jfree.chart.demo.PeriodAxisDemo2.java
private static JFreeChart createChart(XYDataset xydataset) { JFreeChart jfreechart = ChartFactory.createTimeSeriesChart("Legal & General Unit Trust Prices", "Date", "Price Per Unit", xydataset, true, true, false); jfreechart.setBackgroundPaint(Color.white); XYPlot xyplot = (XYPlot) jfreechart.getPlot(); xyplot.setBackgroundPaint(Color.lightGray); xyplot.setDomainGridlinePaint(Color.white); xyplot.setRangeGridlinePaint(Color.white); xyplot.setAxisOffset(new RectangleInsets(5D, 5D, 5D, 5D)); xyplot.setDomainCrosshairVisible(true); xyplot.setRangeCrosshairVisible(true); org.jfree.chart.renderer.xy.XYItemRenderer xyitemrenderer = xyplot.getRenderer(); if (xyitemrenderer instanceof XYLineAndShapeRenderer) { XYLineAndShapeRenderer xylineandshaperenderer = (XYLineAndShapeRenderer) xyitemrenderer; xylineandshaperenderer.setBaseShapesVisible(true); xylineandshaperenderer.setBaseShapesFilled(true); xylineandshaperenderer.setBaseItemLabelsVisible(true); }/* w w w. j av a 2s . c o m*/ PeriodAxis periodaxis = new PeriodAxis("Date"); periodaxis.setTimeZone(TimeZone.getTimeZone("Pacific/Auckland")); periodaxis.setAutoRangeTimePeriodClass(org.jfree.data.time.Day.class); PeriodAxisLabelInfo aperiodaxislabelinfo[] = new PeriodAxisLabelInfo[3]; aperiodaxislabelinfo[0] = new PeriodAxisLabelInfo(org.jfree.data.time.Day.class, new SimpleDateFormat("d")); aperiodaxislabelinfo[1] = new PeriodAxisLabelInfo(org.jfree.data.time.Month.class, new SimpleDateFormat("MMM"), new RectangleInsets(2D, 2D, 2D, 2D), new Font("SansSerif", 1, 10), Color.blue, false, new BasicStroke(0.0F), Color.lightGray); aperiodaxislabelinfo[2] = new PeriodAxisLabelInfo(org.jfree.data.time.Year.class, new SimpleDateFormat("yyyy")); periodaxis.setLabelInfo(aperiodaxislabelinfo); xyplot.setDomainAxis(periodaxis); return jfreechart; }
From source file:Main.java
public void paint(Graphics g) { Graphics2D g2 = (Graphics2D) g; g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); int cx = getSize().width / 2; int cy = getSize().height / 2; g2.translate(cx, cy);/*from w w w .ja va 2 s . co m*/ g2.rotate(theta * Math.PI / 180); Shape oldClip = g2.getClip(); Shape e = new Ellipse2D.Float(-cx, -cy, cx * 2, cy * 2); g2.clip(e); Shape c = new Ellipse2D.Float(-cx, -cy, cx * 3 / 4, cy * 2); g2.setPaint(new GradientPaint(40, 40, Color.blue, 60, 50, Color.white, true)); g2.fill(c); g2.setPaint(Color.yellow); g2.fillOval(cx / 4, 0, cx, cy); g2.setClip(oldClip); g2.setFont(new Font("Times New Roman", Font.PLAIN, 64)); g2.setPaint(new GradientPaint(-cx, 0, Color.red, cx, 0, Color.black, false)); g2.drawString("Hello, 2D!", -cx * 3 / 4, cy / 4); AlphaComposite ac = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, (float) .75); g2.setComposite(ac); Shape r = new RoundRectangle2D.Float(0, -cy * 3 / 4, cx * 3 / 4, cy * 3 / 4, 20, 20); g2.setStroke(new BasicStroke(4)); g2.setPaint(Color.magenta); g2.fill(r); g2.setPaint(Color.green); g2.draw(r); g2.drawImage(image, -cx / 2, -cy / 2, this); }
From source file:cs.register.geraGrafico.java
public geraGrafico(String title, int type, List<partida> L) { super(title); JFreeChart chart = null;//from w w w . ja v a 2s . c om switch (type) { case 0: chart = ChartFactory.createXYLineChart(title, "X", "y", datakill(L), PlotOrientation.VERTICAL, true, true, false); case 1: chart = ChartFactory.createXYLineChart(title, "X", "y", datakda(L), PlotOrientation.VERTICAL, true, true, false); case 2: chart = ChartFactory.createXYLineChart(title, "X", "y", datawld(L), PlotOrientation.VERTICAL, true, true, false); case 3: chart = ChartFactory.createXYLineChart(title, "X", "y", datasocore(L), PlotOrientation.VERTICAL, true, true, false); case 4: chart = ChartFactory.createXYLineChart(title, "X", "y", datarank(L), PlotOrientation.VERTICAL, true, true, false); } graf = new ChartPanel(chart); graf.setPreferredSize(new java.awt.Dimension(560, 367)); XYPlot plot = chart.getXYPlot(); XYLineAndShapeRenderer rendrer = new XYLineAndShapeRenderer(); rendrer.setSeriesPaint(0, Color.GREEN); rendrer.setSeriesStroke(0, new BasicStroke(4.0f)); plot.setRenderer(rendrer); setContentPane(graf); }
From source file:org.openmrs.module.pmtct.web.view.chart.AbstractChartView.java
/** * @see org.springframework.web.servlet.view.AbstractView *//* w w w. ja v a 2 s. c o m*/ @Override @SuppressWarnings("unchecked") protected void renderMergedOutputModel(Map model, HttpServletRequest request, HttpServletResponse response) throws Exception { // Respond as a PNG image response.setContentType("image/png"); // Disable caching response.setHeader("Pragma", "No-cache"); response.setDateHeader("Expires", 0); response.setHeader("Cache-Control", "no-cache"); int width = 400; int height = 300; JFreeChart chart = createChart(model, request); chart.setBackgroundPaint(Color.WHITE); chart.getPlot().setOutlineStroke(new BasicStroke(0)); chart.getPlot().setOutlinePaint(getBackgroundColor()); chart.getPlot().setBackgroundPaint(getBackgroundColor()); chart.getPlot().setNoDataMessage("No data available"); ChartUtilities.writeChartAsPNG(response.getOutputStream(), chart, width, height); }
From source file:view.FuzzySetView.java
private void setupRenderer() { XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(); renderer.setShapesVisible(false);/*from ww w .ja va 2 s . co m*/ plot = getChart().getXYPlot(); int termCount = plot.getSeriesCount(); for (int i = 0; i < termCount; i++) { renderer.setSeriesPaint(i, colors[i]); } BasicStroke stroke = new BasicStroke(3f); for (int i = 0; i < termCount; i++) { renderer.setSeriesStroke(i, stroke); } plot.setRenderer(renderer); setupPlotAxes(); }