List of usage examples for org.jfree.chart JFreeChart setTextAntiAlias
public void setTextAntiAlias(Object val)
From source file:org.jgrasstools.gears.ui.OmsMatrixCharter.java
@Execute public void chart() throws Exception { if (inData == null && inDataXY == null) { throw new ModelsIllegalargumentException("At least one of the datasets need to be valid.", this, pm); }/*from ww w . j a va 2s . c o m*/ if (doDump) { checkNull(inChartPath); } JFreeChart chart = null; if (pType == 0) { chart = doLineChart(); } else { chart = doBarChart(); } if (inSubTitle != null) { TextTitle subTitle = new TextTitle(inSubTitle); chart.addSubtitle(subTitle); } chart.setTextAntiAlias(true); if (doDump) { File chartFile = new File(inChartPath); if (!chartFile.getName().endsWith(".png")) { chartFile = FileUtilities.substituteExtention(chartFile, "png"); } BufferedImage bufferedImage = chart.createBufferedImage(pWidth, pHeight); ImageIO.write(bufferedImage, "png", chartFile); } if (doChart) { ChartPanel cp = new ChartPanel(chart); cp.setDomainZoomable(true); cp.setRangeZoomable(true); ApplicationFrame af = new ApplicationFrame(""); af.setContentPane(cp); af.setPreferredSize(new Dimension(pWidth, pHeight)); af.pack(); af.setVisible(true); RefineryUtilities.centerFrameOnScreen(af); } }
From source file:net.sf.eclipsecs.ui.stats.views.GraphStatsView.java
/** * Cre le graphe JFreeChart./* w w w. ja v a2 s . c o m*/ * * @param piedataset * : la source de donnes afficher * @return le diagramme */ private JFreeChart createChart(GraphPieDataset piedataset) { JFreeChart jfreechart = ChartFactory.createPieChart3D(null, piedataset, false, true, false); jfreechart.setAntiAlias(true); jfreechart.setTextAntiAlias(true); PiePlot pieplot3d = (PiePlot) jfreechart.getPlot(); pieplot3d.setInsets(new RectangleInsets(0, 0, 0, 0)); final double angle = 290D; pieplot3d.setStartAngle(angle); pieplot3d.setDirection(Rotation.CLOCKWISE); final float foreground = 0.5F; pieplot3d.setForegroundAlpha(foreground); pieplot3d.setNoDataMessage(Messages.GraphStatsView_noDataToDisplay); pieplot3d.setCircular(true); pieplot3d.setOutlinePaint(null); pieplot3d.setLabelFont(new Font("SansSerif", Font.PLAIN, 10)); pieplot3d.setLabelGap(0.02); pieplot3d.setLabelOutlinePaint(null); pieplot3d.setLabelShadowPaint(null); pieplot3d.setLabelBackgroundPaint(Color.WHITE); pieplot3d.setBackgroundPaint(Color.WHITE); pieplot3d.setInteriorGap(0.02); pieplot3d.setMaximumLabelWidth(0.20); return jfreechart; }
From source file:com.tocea.scertify.eclipse.scertifycode.ui.stats.views.GraphStatsView.java
/** * Cre le graphe JFreeChart./*from ww w . j av a2s. c o m*/ * * @param piedataset * : la source de donnes afficher * @return le diagramme */ private JFreeChart createChart(final GraphPieDataset piedataset) { final JFreeChart jfreechart = ChartFactory.createPieChart3D(null, piedataset, false, true, false); jfreechart.setAntiAlias(true); jfreechart.setTextAntiAlias(true); final PiePlot3D pieplot3d = (PiePlot3D) jfreechart.getPlot(); // pieplot3d.setInsets(new RectangleInsets(0, 0, 0, 0)); final double angle = 290D; pieplot3d.setStartAngle(angle); pieplot3d.setDirection(Rotation.CLOCKWISE); final float foreground = 0.5F; pieplot3d.setForegroundAlpha(foreground); pieplot3d.setBackgroundAlpha(0.0F); pieplot3d.setNoDataMessage(Messages.GraphStatsView_noDataToDisplay); pieplot3d.setOutlinePaint(null); pieplot3d.setLabelFont(new Font("SansSerif", Font.PLAIN, 10)); pieplot3d.setLabelGap(0.02); pieplot3d.setLabelOutlinePaint(null); pieplot3d.setLabelShadowPaint(null); pieplot3d.setLabelBackgroundPaint(Color.WHITE); pieplot3d.setBackgroundPaint(Color.WHITE); pieplot3d.setInteriorGap(0.02); pieplot3d.setMaximumLabelWidth(0.20); return jfreechart; }
From source file:eu.cassandra.platform.gui.GUI.java
public JFreeChart createChart(String title, final XYDataset dataset) { final JFreeChart chart = ChartFactory.createTimeSeriesChart(title, "Time", "Consumption (W)", dataset, false, true, true);/*from w ww . ja va 2 s . co m*/ DateAxis axis = (DateAxis) chart.getXYPlot().getDomainAxis(); axis.setTickUnit(new DateTickUnit(DateTickUnitType.DAY, 1)); axis.setTickMarkPosition(DateTickMarkPosition.START); axis.setDateFormatOverride(new SimpleDateFormat("dd")); // XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(); // BasicStroke basicStroke = new BasicStroke(1f); // renderer.setSeriesStroke(0, basicStroke); // chart.getXYPlot().setRenderer(renderer); chart.setAntiAlias(true); chart.setTextAntiAlias(true); return chart; }
From source file:org.deegree.graphics.charts.ChartsBuilder.java
/** * Initializes the chart with the values from the properties file config.properties * * @param chart//from w w w . j a v a2s .co m * @param chartConfigs * to configure the output chart * @return initialized chart */ protected JFreeChart configChart(JFreeChart chart, ChartConfig chartConfigs) { chart.setAntiAlias(chartConfigs.isGenAntiAliasing()); chart.setBorderVisible(chartConfigs.isGenBorderVisible()); String rectanglkeInsets = chartConfigs.getGenRectangleInsets(); if (!rectanglkeInsets.startsWith("!")) { String[] insets = rectanglkeInsets.split(","); if (insets.length == 4) { try { double top = Double.parseDouble(insets[0]); double left = Double.parseDouble(insets[1]); double buttom = Double.parseDouble(insets[2]); double right = Double.parseDouble(insets[3]); RectangleInsets rectInsets = new RectangleInsets(top, left, buttom, right); chart.setPadding(rectInsets); } catch (Exception e) { LOG.logError(Messages.getMessage("GRA_CHART_BAD_FORMAT_INSETS")); } } else { LOG.logError(Messages.getMessage("GRA_CHART_BAD_FORMAT_INSETS")); } } chart.setTextAntiAlias(chartConfigs.isGenTextAntiAlias()); chart.setBackgroundPaint(chartConfigs.getGenBackgroundColor()); chart.getPlot().setOutlineVisible(chartConfigs.isPlotOutlineVisible()); chart.getPlot().setForegroundAlpha((float) chartConfigs.getPlotForegroundOpacity()); chart.getPlot().setBackgroundPaint(chartConfigs.getPlotBackgroundColor()); return chart; }
From source file:edu.ku.brc.specify.utilapps.RegisterApp.java
/** * @param chartTitle/*from w w w . j a v a2 s . c o m*/ * @param xTitle * @param values */ private void createBarChart(final String chartTitle, final String xTitle, final Vector<Pair<String, Integer>> values) { String cat = ""; //$NON-NLS-1$ DefaultCategoryDataset dataset = new DefaultCategoryDataset(); for (Pair<String, Integer> p : values) { //System.out.println("["+p.second+"] ["+p.first+"]"); //System.out.println(" values.add(new Pair<String, Integer>(\""+p.first+"\", "+p.second+"));"); dataset.addValue(p.second, p.first, cat); } // create the chart... JFreeChart chart = ChartFactory.createBarChart3D(chartTitle, // chart title xTitle, // domain axis label "Occurrence", // range axis label dataset, // data PlotOrientation.VERTICAL, true, //maxStrLen > 4 || values.size() > 15, // include legend true, // tooltips? false // URLs? ); chart.setAntiAlias(true); chart.setTextAntiAlias(true); // create and display a frame... ChartPanel panel = new ChartPanel(chart, true, true, true, true, true); boolean wasVisible = false; boolean wasCreated = false; if (chartFrame == null) { panel.setPreferredSize(new Dimension(800, 600)); chartFrame = new CustomFrame("Statistics", CustomFrame.OK_BTN, null); chartFrame.setOkLabel("Close"); chartFrame.createUI(); wasCreated = true; } else { wasVisible = chartFrame.isVisible(); } chartFrame.setContentPane(panel); // Can't believe I have to do this Rectangle r = chartFrame.getBounds(); r.height++; chartFrame.setBounds(r); r.height--; //---- chartFrame.setBounds(r); if (wasCreated) { chartFrame.pack(); } if (!wasVisible) { UIHelper.centerAndShow(chartFrame); } }
From source file:net.sourceforge.processdash.ui.web.psp.TimeLogPhaseWaterfallChart.java
private JFreeChart createChart(IntervalXYDataset dataset, ProcessUtil process, List<String> phases, GapSkipTracker gaps) {/*from ww w. java 2 s. co m*/ JFreeChart result = ChartFactory.createXYBarChart(null, null, true, null, dataset, PlotOrientation.VERTICAL, false, true, false); XYPlot xyplot = (XYPlot) result.getPlot(); DateAxis dateAxis = new DateAxis(null); dateAxis.setTickMarksVisible(false); dateAxis.setTickLabelsVisible(false); dateAxis.setLowerMargin(0.01); dateAxis.setUpperMargin(0.01); setupGaps(gaps, dateAxis, xyplot); xyplot.setDomainAxis(dateAxis); String[] phaseNameList = new String[phases.size()]; for (int i = 0; i < phaseNameList.length; i++) phaseNameList[i] = Translator.translate(phases.get(i)); SymbolAxis symbolaxis = new SymbolAxis(null, phaseNameList); symbolaxis.setGridBandsVisible(false); xyplot.setRangeAxis(symbolaxis); final XYBarRenderer renderer = (XYBarRenderer) xyplot.getRenderer(); renderer.setUseYInterval(true); renderer.setDrawBarOutline(true); renderer.setBaseOutlinePaint(Color.black); new PhaseChartColorer(process, phases) { public void setItemColor(Object key, int pos, Color c) { renderer.setSeriesPaint(pos, c); } }.run(); int exceptionSeries = dataset.getSeriesCount() - 1; renderer.setSeriesPaint(exceptionSeries, EXCEPTION_PAINT); renderer.setSeriesFillPaint(exceptionSeries, EXCEPTION_PAINT); renderer.setSeriesOutlinePaint(exceptionSeries, EXCEPTION_PAINT); renderer.setBaseToolTipGenerator(new TooltipGenerator()); xyplot.setBackgroundPaint(Color.white); xyplot.setDomainGridlinesVisible(false); xyplot.setRangeGridlinePaint(Color.lightGray); xyplot.setDrawingSupplier(DRAWING_SUPPLIER_FACTORY.newDrawingSupplier()); result.setAntiAlias(false); result.setTextAntiAlias(true); parameters.put("title", resources.getString("Title")); return result; }
From source file:com.jtstand.swing.StatsPanel.java
public JFreeChart getChartValues(Iterator<TestStepInstance> values) { if (values == null || !values.hasNext()) { return null; }//w ww . j ava2s . co m XYSeriesCollection dataset = new XYSeriesCollection(); int count = 0; TreeMap<String, XYSeries> map = new TreeMap<String, XYSeries>(); while (values.hasNext()) { TestStepInstance step = values.next(); Number num = getNumber(step); if (num != null) { String groupName = getGroupName(step); XYSeries pop = map.get(groupName); if (pop == null) { pop = new XYSeries(groupName); map.put(groupName, pop); } pop.add(++count, num.doubleValue()); } } for (Iterator<XYSeries> it = map.values().iterator(); it.hasNext();) { dataset.addSeries(it.next()); } // NumberAxis xAxis = new NumberAxis("#"); NumberAxis xAxis = new NumberAxis(); xAxis.setAutoRangeIncludesZero(false); NumberAxis yAxis = new NumberAxis(getValueString()); yAxis.setAutoRangeIncludesZero(false); XYLineAndShapeRenderer renderer6 = new XYLineAndShapeRenderer(); XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer6); plot.setOrientation(PlotOrientation.VERTICAL); plot.setRangeCrosshairVisible(true); plot.setDomainCrosshairVisible(true); renderer6.setBaseToolTipGenerator(new StandardXYToolTipGenerator()); renderer6.setBaseSeriesVisibleInLegend(false); // StandardXYItemLabelGenerator itemlabels=new StandardXYItemLabelGenerator(); // renderer.setBaseItemLabelGenerator(itemlabels); // renderer.setBaseItemLabelsVisible(true); JFreeChart chart = new JFreeChart(null, JFreeChart.DEFAULT_TITLE_FONT, plot, isGrouping()); //chart.setTitle(title); placeLimitMarkers(plot, true); /* coloring */ if (isCategorization()) { // TreeMap<String, Color> cmap = new TreeMap<String, Color>(); int i = 0; for (Iterator<String> it = catstats.keySet().iterator(); it.hasNext(); i++) { String groupName = it.next(); Color c = ChartCategories.getColor(i); for (int j = 0; j < dataset.getSeriesCount(); j++) { XYSeries s = dataset.getSeries(j); if (s.getKey().equals(groupName)) { renderer6.setSeriesPaint(j, c); } } } } else { renderer6.setSeriesPaint(0, ChartCategories.getColor(0)); } chart.setTextAntiAlias(false); return chart; }
From source file:net.sf.fspdfs.chartthemes.simple.SimpleChartTheme.java
/** * *///w w w .jav a2 s .c o m protected void configureChart(JFreeChart jfreeChart, JRChartPlot jrPlot) throws JRException { ChartSettings chartSettings = getChartSettings(); setChartBackground(jfreeChart); setChartTitle(jfreeChart); setChartSubtitles(jfreeChart); setChartLegend(jfreeChart); setChartBorder(jfreeChart); Boolean chartAntiAlias = chartSettings.getAntiAlias(); if (chartAntiAlias != null) jfreeChart.setAntiAlias(chartAntiAlias.booleanValue()); Boolean textAntiAlias = chartSettings.getTextAntiAlias(); if (textAntiAlias != null) jfreeChart.setTextAntiAlias(textAntiAlias.booleanValue()); RectangleInsets padding = chartSettings.getPadding(); if (padding != null) { jfreeChart.setPadding(padding);//FIXMETHEME consider using linebox } configurePlot(jfreeChart.getPlot(), jrPlot); }
From source file:net.sf.jasperreports.chartthemes.simple.SimpleChartTheme.java
/** * */// www . j a v a2 s .c o m protected void configureChart(JFreeChart jfreeChart, JRChartPlot jrPlot) throws JRException { ChartSettings chartSettings = getChartSettings(); setChartBackground(jfreeChart); setChartTitle(jfreeChart); setChartSubtitles(jfreeChart); setChartLegend(jfreeChart); setChartBorder(jfreeChart); Boolean chartAntiAlias = chartSettings.getAntiAlias(); if (chartAntiAlias != null) jfreeChart.setAntiAlias(chartAntiAlias); Boolean textAntiAlias = chartSettings.getTextAntiAlias(); if (textAntiAlias != null) jfreeChart.setTextAntiAlias((boolean) textAntiAlias); RectangleInsets padding = chartSettings.getPadding(); if (padding != null) { jfreeChart.setPadding(padding);//FIXMETHEME consider using linebox } configurePlot(jfreeChart.getPlot(), jrPlot); }