List of usage examples for org.jfree.chart.axis ValueAxis setTickLabelFont
public void setTickLabelFont(Font font)
From source file:playground.dgrether.analysis.charts.DgDefaultAxisBuilder.java
public ValueAxis createValueAxis(String yLabel) { ValueAxis valueAxis = new NumberAxis(yLabel); valueAxis.setLabelFont(labelFont);/*from w ww. j av a 2 s . c o m*/ valueAxis.setTickLabelFont(axisFont); return valueAxis; }
From source file:gsn.charts.GsnChartJfreechart.java
public JFreeChart createChart(Collection<Data> datas) { TimeSeries t1 = new TimeSeries("S1"); Iterator<Data> iter = datas.iterator(); Data data;//from w w w . j av a 2 s . co m while (iter.hasNext()) { data = iter.next(); t1.addOrUpdate(RegularTimePeriod.createInstance(Millisecond.class, new Date((Long) data.getP2()), TimeZone.getDefault()), data.getValue()); } XYDataset dataset = new TimeSeriesCollection(t1); JFreeChart chart = ChartFactory.createTimeSeriesChart(null, null, null, dataset, false, false, false); chart.setAntiAlias(true); chart.setTextAntiAlias(true); chart.setBackgroundPaint(Color.WHITE); // XYPlot plot = (XYPlot) chart.getPlot(); plot.setNoDataMessage("No Data to Display"); plot.setDomainGridlinesVisible(true); plot.setBackgroundPaint(Color.WHITE); plot.setInsets(new RectangleInsets(5, 14, 0, 5)); // DateAxis axis = (DateAxis) plot.getDomainAxis(); axis.setDateFormatOverride(ssdf); axis.setTickLabelFont(TICK_FONT); ValueAxis rangeAxis = plot.getRangeAxis(); rangeAxis.setTickLabelFont(TICK_FONT); // return chart; }
From source file:net.bioclipse.jasper.charCustomizers.DoseResponseChartCustomizer.java
@Override public void customize(JFreeChart chart, JRChart jasperchart) { ValueAxis domainAxis = new LogarithmicAxis("Concentration"); ValueAxis rangeAxis = new NumberAxis("SI%"); domainAxis.setTickLabelFont(small); rangeAxis.setTickLabelFont(small);//from w w w.ja v a 2 s . c om domainAxis.setLabelFont(normalsize); rangeAxis.setLabelFont(normalsize); rangeAxis.setRange(0, 110); chart.getXYPlot().setDomainAxis(domainAxis); chart.getXYPlot().setRangeAxis(rangeAxis); chart.getXYPlot().setDomainGridlinesVisible(false); chart.getXYPlot().getRenderer().setSeriesShape(0, new Ellipse2D.Double(-1, -1, 2, 2)); }
From source file:com.tencent.wstt.apt.chart.CPURealTimeChart.java
@Override public JFreeChart createChart() { final JFreeChart chart = ChartFactory.createTimeSeriesChart("CPU", "", "CPU%", dataset, true, true, false);/* ww w .j av a 2 s . c o m*/ //?? chart.getTitle().setFont(new Font("", Font.BOLD, 20)); XYPlot xyPlot = (XYPlot) chart.getXYPlot(); ValueAxis domainAxis = xyPlot.getDomainAxis(); ValueAxis rangeAxis = xyPlot.getRangeAxis(); domainAxis.setLabelFont(new Font("", Font.BOLD, 14)); domainAxis.setTickLabelFont(new Font("", Font.BOLD, 12)); rangeAxis.setLabelFont(new Font("", Font.BOLD, 14)); rangeAxis.setTickLabelFont(new Font("", Font.BOLD, 12)); return chart; }
From source file:com.tencent.wstt.apt.chart.MemoryRealTimeChart.java
@Override public JFreeChart createChart() { final JFreeChart chart = ChartFactory.createTimeSeriesChart("", "", "kB", dataset, true, true, false); //??/*from w ww . ja va 2s . c o m*/ chart.getTitle().setFont(new Font("", Font.BOLD, 20)); XYPlot xyPlot = (XYPlot) chart.getXYPlot(); ValueAxis domainAxis = xyPlot.getDomainAxis(); ValueAxis rangeAxis = xyPlot.getRangeAxis(); domainAxis.setLabelFont(new Font("", Font.BOLD, 14)); domainAxis.setTickLabelFont(new Font("", Font.BOLD, 12)); rangeAxis.setLabelFont(new Font("", Font.BOLD, 14)); rangeAxis.setTickLabelFont(new Font("", Font.BOLD, 12)); //rangeAxis.setAutoRange(true); //rangeAxis.setAutoTickUnitSelection(true); return chart; }
From source file:net.relet.freimap.NodeInfo.java
private void sexupAxis(ValueAxis axis) { axis.setLabelFont(VisorFrame.smallerfont); axis.setLabelPaint(VisorFrame.fgcolor); axis.setTickLabelFont(VisorFrame.smallerfont); axis.setTickLabelPaint(VisorFrame.fgcolor); }
From source file:org.talend.dataprofiler.chart.ChartDecorator.java
/** * DOC bZhou Comment method "decorateXYPlot". * /*from w w w . j a va 2 s .c o m*/ * @param chart */ private static void decorateXYPlot(JFreeChart chart) { Font font = null; XYPlot plot = chart.getXYPlot(); XYItemRenderer render = plot.getRenderer(); ValueAxis domainAxis = plot.getDomainAxis(); ValueAxis valueAxis = plot.getRangeAxis(); font = new Font("Tahoma", Font.BOLD, BASE_ITEM_LABEL_SIZE);//$NON-NLS-1$ render.setBaseItemLabelFont(font); font = new Font("sans-serif", Font.BOLD, BASE_LABEL_SIZE);//$NON-NLS-1$ domainAxis.setLabelFont(font); font = new Font("sans-serif", Font.BOLD, BASE_LABEL_SIZE);//$NON-NLS-1$ valueAxis.setLabelFont(font); font = new Font("sans-serif", Font.PLAIN, BASE_TICK_LABEL_SIZE);//$NON-NLS-1$ domainAxis.setTickLabelFont(font); valueAxis.setTickLabelFont(font); setLegendFont(chart); font = new Font("sans-serif", Font.BOLD, BASE_TITLE_LABEL_SIZE);//$NON-NLS-1$ TextTitle title = chart.getTitle(); if (title != null) { title.setFont(font); } font = null; }
From source file:org.yardstickframework.report.jfreechart.JFreeChartGraphPlotter.java
/** * @param folderToWrite Folder to write the resulted charts. * @param plots Collections of plots./*from w w w .ja v a 2 s . c o m*/ * @param infoMap Map with additional plot info. * @param mode Generation mode. * @throws Exception If failed. */ private static void processPlots(File folderToWrite, Collection<List<PlotData>> plots, Map<String, List<JFreeChartPlotInfo>> infoMap, JFreeChartGenerationMode mode) throws Exception { ChartRenderingInfo info = new ChartRenderingInfo(new StandardEntityCollection()); XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(true, false); int idx = -1; while (true) { idx++; DefaultXYDataset dataSet = new DefaultXYDataset(); List<JFreeChartPlotInfo> infoList = new ArrayList<>(); String xAxisLabel = ""; String yAxisLabel = ""; String plotName = ""; int cnt = 0; for (List<PlotData> plotData0 : plots) { if (plotData0.size() <= idx) continue; PlotData plotData = plotData0.get(idx); dataSet.addSeries(plotData.plotName() + "_" + cnt++, plotData.series().data); xAxisLabel = plotData.xAxisLabel; yAxisLabel = plotData.yAxisLabel; plotName = plotData.plotName(); infoList.add(info(plotData.series(), mode)); } if (infoList.isEmpty()) break; JFreeChart chart = ChartFactory.createXYLineChart("", xAxisLabel, yAxisLabel, dataSet, PlotOrientation.VERTICAL, false, false, false); AxisSpace as = new AxisSpace(); as.add(150, RectangleEdge.LEFT); XYPlot plot = (XYPlot) chart.getPlot(); BasicStroke stroke = new BasicStroke(1); plot.setRenderer(renderer); plot.setBackgroundPaint(WHITE); plot.setRangeGridlinePaint(GRAY); plot.setDomainGridlinePaint(GRAY); plot.setFixedRangeAxisSpace(as); plot.setOutlineStroke(stroke); for (int i = 0; i < infoList.size(); i++) { Color color = PLOT_COLORS[i % PLOT_COLORS.length]; renderer.setSeriesPaint(i, color); renderer.setSeriesStroke(i, new BasicStroke(3)); // Line thickness. infoList.get(i).color(Integer.toHexString(color.getRGB()).substring(2)); } ValueAxis axis = plot.getRangeAxis(); Font font = new Font("Helvetica,Arial,sans-serif", Font.BOLD, axis.getTickLabelFont().getSize() + 5); axis.setTickLabelFont(font); axis.setLabelFont(font); plot.getDomainAxis().setTickLabelFont(font); plot.getDomainAxis().setLabelFont(font); chart.setTitle(new TextTitle(yAxisLabel, new Font(font.getName(), font.getStyle(), 30))); File res = new File(folderToWrite, plotName + ".png"); ChartUtilities.saveChartAsPNG(res, chart, 1000, 500, info); infoMap.put(res.getAbsolutePath(), infoList); println("Chart is saved to file: ", res); } }
From source file:fr.ign.cogit.simplu3d.rjmcmc.generic.visitor.StatsVisitor.java
/** * Creates a sample chart./*from w w w. j a va2 s . co m*/ * * @param dataset * the dataset. * @return A sample chart. */ private JFreeChart createChart(final XYDataset dataset) { final JFreeChart result = ChartFactory.createXYLineChart("volution de l'nergie", "Itration", "nergie", dataset, PlotOrientation.VERTICAL, true, true, true); result.setBorderPaint(Color.white); result.setBackgroundPaint(Color.white); final XYPlot plot = result.getXYPlot(); Font font = new Font("Verdana", Font.PLAIN, 32); Font font2 = new Font("Verdana", Font.PLAIN, 28); // axe x ValueAxis axis = plot.getDomainAxis(); axis.setLabelFont(font); axis.setTickLabelFont(font2); axis.setAutoRange(true); // axis.setFixedAutoRange(60000.0); // 60 seconds axis = plot.getRangeAxis(); // axe y ValueAxis axis2 = plot.getRangeAxis(); axis2.setLabelFont(font); axis2.setTickLabelFont(font2); axis2.setAutoRange(true); // axis.setFixedAutoRange(60000.0); // 60 seconds axis2 = plot.getRangeAxis(); plot.setRangeGridlinePaint(Color.LIGHT_GRAY); plot.setDomainGridlinePaint(Color.LIGHT_GRAY); plot.setBackgroundPaint(Color.white); XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) plot.getRenderer(); renderer.setSeriesPaint(0, new Color(255, 0, 0)); renderer.setSeriesStroke(0, new BasicStroke(3.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 1.0f)); renderer.setLegendTextFont(0, font2); renderer.setSeriesPaint(1, new Color(2, 157, 116)); renderer.setSeriesStroke(1, new BasicStroke(3.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 1.0f)); renderer.setLegendTextFont(1, font2); renderer.setSeriesPaint(2, new Color(112, 147, 219)); renderer.setSeriesStroke(2, new BasicStroke(3.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 1.0f)); renderer.setLegendTextFont(2, font2); renderer.setSeriesPaint(3, new Color(140, 23, 23)); renderer.setSeriesStroke(3, new BasicStroke(3.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 1.0f, new float[] { 6.0f, 6.0f }, 0.0f)); renderer.setLegendTextFont(3, font2); // axis.setRange(0.0, 200.0); return result; }
From source file:org.talend.dataprofiler.chart.util.TopChartFactory.java
private static void decorateCategoryPlot(JFreeChart chart) { XYPlot plot = chart.getXYPlot();/*from w w w . j a va 2s .com*/ XYItemRenderer render = plot.getRenderer(); ValueAxis domainAxis = plot.getDomainAxis(); ValueAxis valueAxis = plot.getRangeAxis(); Font font = new Font("Tahoma", Font.BOLD, BASE_ITEM_LABEL_SIZE); //$NON-NLS-1$ render.setBaseItemLabelFont(font); font = new Font("sans-serif", Font.BOLD, BASE_LABEL_SIZE); //$NON-NLS-1$ domainAxis.setLabelFont(font); font = new Font("sans-serif", Font.BOLD, BASE_LABEL_SIZE); //$NON-NLS-1$ valueAxis.setLabelFont(font); font = new Font("sans-serif", Font.PLAIN, BASE_TICK_LABEL_SIZE); //$NON-NLS-1$ domainAxis.setTickLabelFont(font); valueAxis.setTickLabelFont(font); font = new Font("Tahoma", Font.PLAIN, BASE_LEGEND_LABEL_SIZE); //$NON-NLS-1$ LegendTitle legend = chart.getLegend(); if (legend != null) { legend.setItemFont(font); } font = new Font("sans-serif", Font.BOLD, BASE_TITLE_LABEL_SIZE); //$NON-NLS-1$ TextTitle title = chart.getTitle(); if (title != null) { title.setFont(font); } font = null; if (render instanceof BarRenderer) { int rowCount = chart.getCategoryPlot().getDataset().getRowCount(); domainAxis.setUpperMargin(0.1); // domainAxis.setMaximumCategoryLabelLines(10); ((BarRenderer) render).setItemMargin(-0.40 * rowCount); } // set color int rowCount = chart.getXYPlot().getDataset().getSeriesCount(); for (int i = 0; i < rowCount; i++) { plot.getRenderer().setSeriesPaint(i, Color.RED); } }