List of usage examples for org.jfree.ui RectangleInsets ZERO_INSETS
RectangleInsets ZERO_INSETS
To view the source code for org.jfree.ui RectangleInsets ZERO_INSETS.
Click Source Link
From source file:org.jfree.chart.demo.SparklineDemo1.java
public static void main(String args[]) { XYSeries xyseries = new XYSeries("Series 1"); xyseries.add(1.0D, 1.0D);/*w w w . ja v a 2 s.c o m*/ xyseries.add(2D, 3D); xyseries.add(3D, 2D); xyseries.add(4D, 4D); XYSeriesCollection xyseriescollection = new XYSeriesCollection(); xyseriescollection.addSeries(xyseries); JFreeChart jfreechart = ChartFactory.createXYLineChart(null, "X", "Y", xyseriescollection, PlotOrientation.VERTICAL, false, false, false); XYPlot xyplot = (XYPlot) jfreechart.getPlot(); xyplot.setInsets(RectangleInsets.ZERO_INSETS); xyplot.setDomainGridlinesVisible(false); xyplot.setRangeGridlinesVisible(false); xyplot.setOutlinePaint(null); xyplot.getDomainAxis().setVisible(false); xyplot.getRangeAxis().setVisible(false); try { ChartUtilities.saveChartAsPNG(new File("Sparky.png"), jfreechart, 100, 20); } catch (IOException ioexception) { ioexception.printStackTrace(); } }
From source file:com.ivli.roim.controls.DomainMarker.java
public DomainMarker(double aV, XYSeries aS) { super(aV);//ww w . jav a 2s .com iSeries = aS; iSeries.addChangeListener(this); setLabel(String.format(LABEL_FORMAT, aV)); setLabelAnchor(RectangleAnchor.CENTER); setLabelOffset(RectangleInsets.ZERO_INSETS); setAlpha(1.0f); setPaint(Color.BLACK); setStroke(new BasicStroke(1.0f)); setOutlinePaint(Color.CYAN); setOutlineStroke(new BasicStroke(.0f)); }
From source file:org.sonar.server.charts.deprecated.PieChart.java
private void configurePlot() { PiePlot plot = (PiePlot) jfreechart.getPlot(); plot.setNoDataMessage(DEFAULT_MESSAGE_NODATA); plot.setInsets(RectangleInsets.ZERO_INSETS); plot.setDataset(dataset);/* www .j ava 2 s .c om*/ plot.setBackgroundAlpha(0.0f); plot.setCircular(true); plot.setLabelGenerator(null); plot.setIgnoreNullValues(true); plot.setIgnoreZeroValues(true); plot.setShadowPaint(null); plot.setLabelLinkMargin(0.0); plot.setInteriorGap(0.02); plot.setMaximumLabelWidth(0.10); }
From source file:com.ivli.roim.controls.DomainMarker.java
public void setLinkedMarker(ValueMarker aM) { iLink = aM;/*w w w. j a va 2 s . com*/ iLink.setValue(XYSeriesUtilities.getNearestY(iSeries, getValue())); iLink.setLabelAnchor(RectangleAnchor.BOTTOM); iLink.setLabelOffset(RectangleInsets.ZERO_INSETS); }
From source file:org.sonar.server.charts.deprecated.CustomBarChart.java
@Override protected void configureCategoryPlot() { CategoryPlot plot = jfreechart.getCategoryPlot(); plot.setNoDataMessage(DEFAULT_MESSAGE_NODATA); plot.setInsets(RectangleInsets.ZERO_INSETS); // To remove inner space around chart plot.setDataset(dataset);/*from w ww. j av a 2 s . c om*/ plot.setDomainAxis(categoryAxis); plot.setRenderer(renderer); plot.setRangeAxis(numberAxis); }
From source file:org.sonar.server.charts.deprecated.BarChart.java
protected void configureCategoryPlot() { CategoryPlot plot = jfreechart.getCategoryPlot(); plot.setNoDataMessage(DEFAULT_MESSAGE_NODATA); plot.setInsets(RectangleInsets.ZERO_INSETS); // To remove inner space around chart plot.setDataset(dataset);//from w w w. j av a 2 s .c om plot.setDomainAxis(categoryAxis); plot.setRenderer(renderer); plot.setRangeAxis(numberAxis); }
From source file:it.marcoberri.mbmeteo.action.chart.GetLastUDial.java
/** * Processes requests for both HTTP/*from w ww.j av a 2 s. c o m*/ * <code>GET</code> and * <code>POST</code> methods. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { log.debug("start : " + this.getClass().getName()); final HashMap<String, String> params = getParams(request.getParameterMap()); final Integer dimy = Default.toInteger(params.get("dimy"), 600); final Integer dimx = Default.toInteger(params.get("dimx"), 800); Meteolog meteolog = ds.find(Meteolog.class).order("-time").limit(1).get(); DefaultValueDataset dataset = new DefaultValueDataset(meteolog.getOutdoorHumidity()); // get data for diagrams DialPlot plot = new DialPlot(); plot.setInsets(RectangleInsets.ZERO_INSETS); //plot.setView(0.1, 0.1, 0.9, 0.9); // plot.set plot.setDataset(0, dataset); GradientPaint gp = new GradientPaint(new Point(), new Color(255, 255, 255), new Point(), new Color(170, 170, 220)); DialBackground db = new DialBackground(gp); db.setGradientPaintTransformer( new StandardGradientPaintTransformer(GradientPaintTransformType.CENTER_HORIZONTAL)); plot.setBackground(db); StandardDialScale scale = new StandardDialScale(); scale.setLowerBound(0); scale.setUpperBound(100); scale.setTickLabelOffset(0.14); scale.setTickLabelFont(new Font("Dialog", Font.PLAIN, 10)); plot.addScale(0, scale); plot.setInsets(RectangleInsets.ZERO_INSETS); DialPointer needle = new DialPointer.Pointer(0); plot.addLayer(needle); JFreeChart chart1 = new JFreeChart(plot); chart1.setTitle("Humidity %"); final File f = File.createTempFile("mbmeteo", ".jpg"); ChartUtilities.saveChartAsJPEG(f, chart1, dimx, dimy); response.setContentType("image/jpeg"); response.setHeader("Content-Length", "" + f.length()); response.setHeader("Content-Disposition", "inline; filename=\"" + f.getName() + "\""); final OutputStream out = response.getOutputStream(); final FileInputStream in = new FileInputStream(f.toString()); final int size = in.available(); final byte[] content = new byte[size]; in.read(content); out.write(content); in.close(); out.close(); }
From source file:org.jfree.chart.demo.AxisOffsetsDemo1.java
public static JPanel createDemoPanel() { JFreeChart jfreechart = createChart("Axis Offsets: 0", createDataset()); CategoryPlot categoryplot = (CategoryPlot) jfreechart.getPlot(); categoryplot.setAxisOffset(RectangleInsets.ZERO_INSETS); ChartPanel chartpanel = new ChartPanel(jfreechart); chartpanel.setMinimumDrawWidth(0);/* w w w. j av a2 s. c o m*/ chartpanel.setMinimumDrawHeight(0); JFreeChart jfreechart1 = createChart("Axis Offsets: 5", createDataset()); ChartPanel chartpanel1 = new ChartPanel(jfreechart1); chartpanel1.setMinimumDrawWidth(0); chartpanel1.setMinimumDrawHeight(0); CategoryPlot categoryplot1 = (CategoryPlot) jfreechart1.getPlot(); categoryplot1.setAxisOffset(new RectangleInsets(5D, 5D, 5D, 5D)); DemoPanel demopanel = new DemoPanel(new GridLayout(2, 1)); demopanel.add(chartpanel); demopanel.add(chartpanel1); demopanel.addChart(jfreechart); demopanel.addChart(jfreechart1); return demopanel; }
From source file:org.sonar.plugins.scmstats.charts.PieChart3D.java
@Override protected Plot getPlot(ChartParameters params) { PiePlot3D plot = new PiePlot3D(); String[] colorsHex = params.getValues(PARAM_COLORS, ",", true); String[] serie = params.getValues(PARAM_VALUES, ";", true); DefaultPieDataset set = new DefaultPieDataset(); Color[] colors = COLORS;//from w w w .ja va 2 s.com if (colorsHex != null && colorsHex.length > 0) { colors = new Color[colorsHex.length]; for (int i = 0; i < colorsHex.length; i++) { colors[i] = Color.decode("#" + colorsHex[i]); } } String[] keyValue = null; for (int i = 0; i < serie.length; i++) { if (!StringUtils.isEmpty(serie[i])) { keyValue = StringUtils.split(serie[i], "="); set.setValue(keyValue[0], Double.parseDouble(keyValue[1])); plot.setSectionPaint(keyValue[0], colors[i]); } } plot.setDataset(set); plot.setStartAngle(180); plot.setCircular(true); plot.setDirection(Rotation.CLOCKWISE); plot.setNoDataMessage(DEFAULT_MESSAGE_NODATA); plot.setInsets(RectangleInsets.ZERO_INSETS); plot.setForegroundAlpha(1.0f); plot.setBackgroundAlpha(0.0f); plot.setIgnoreNullValues(true); plot.setIgnoreZeroValues(true); plot.setOutlinePaint(Color.WHITE); plot.setShadowPaint(Color.GREEN); plot.setDarkerSides(true); plot.setLabelFont(DEFAULT_FONT); plot.setLabelPaint(Color.BLACK); plot.setLabelBackgroundPaint(Color.WHITE); plot.setLabelOutlinePaint(Color.WHITE); plot.setLabelShadowPaint(Color.GRAY); plot.setLabelPadding(new RectangleInsets(1, 1, 1, 1)); plot.setInteriorGap(0.01); plot.setMaximumLabelWidth(0.25); return plot; }
From source file:org.sonar.plugins.abacus.chart.PieChart3D.java
@Override protected Plot getPlot(ChartParameters params) { PiePlot3D plot = new PiePlot3D(); String[] colorsHex = params.getValues(PARAM_COLORS, ",", true); String[] serie = params.getValues(PARAM_VALUES, ";", true); DefaultPieDataset set = new DefaultPieDataset(); Color[] colors = COLORS;/*from www .j a v a2 s .c o m*/ if (colorsHex != null && colorsHex.length > 0) { colors = new Color[colorsHex.length]; for (int i = 0; i < colorsHex.length; i++) { colors[i] = Color.decode("#" + colorsHex[i]); } } String[] keyValue = null; for (int i = 0; i < serie.length; i++) { if (!StringUtils.isEmpty(serie[i])) { keyValue = StringUtils.split(serie[i], "="); set.setValue(keyValue[0], Double.parseDouble(keyValue[1])); plot.setSectionPaint(keyValue[0], colors[i]); } } plot.setDataset(set); plot.setStartAngle(360); plot.setCircular(true); plot.setDirection(Rotation.CLOCKWISE); plot.setNoDataMessage(DEFAULT_MESSAGE_NODATA); plot.setInsets(RectangleInsets.ZERO_INSETS); plot.setForegroundAlpha(1.0f); plot.setBackgroundAlpha(0.0f); plot.setIgnoreNullValues(true); plot.setIgnoreZeroValues(true); plot.setOutlinePaint(Color.WHITE); plot.setShadowPaint(Color.WHITE); plot.setDarkerSides(false); plot.setLabelFont(DEFAULT_FONT); plot.setLabelPaint(Color.BLACK); plot.setLabelBackgroundPaint(Color.WHITE); plot.setLabelOutlinePaint(Color.WHITE); plot.setLabelShadowPaint(Color.WHITE); plot.setLabelPadding(new RectangleInsets(1, 1, 1, 1)); plot.setInteriorGap(0.02); plot.setMaximumLabelWidth(0.15); return plot; }