List of usage examples for org.jfree.chart.title TextTitle setPaint
public void setPaint(Paint paint)
From source file:org.jfree.chart.demo.SurveyResultsDemo1.java
private static JFreeChart createChart(CategoryDataset categorydataset) { JFreeChart jfreechart = ChartFactory.createBarChart(null, null, null, categorydataset, PlotOrientation.HORIZONTAL, false, true, false); jfreechart.setBackgroundPaint(Color.white); TextTitle texttitle = new TextTitle( "Figure 7 | I. Resources - The site offers users relevant, informative and educational resources"); texttitle.setHorizontalAlignment(HorizontalAlignment.LEFT); texttitle.setBackgroundPaint(Color.red); texttitle.setPaint(Color.white); jfreechart.setTitle(texttitle);/*ww w. j ava2 s .c o m*/ CategoryPlot categoryplot = (CategoryPlot) jfreechart.getPlot(); categoryplot.setOutlinePaint(null); categoryplot.setDomainGridlinesVisible(true); categoryplot.setDomainGridlinePosition(CategoryAnchor.END); categoryplot.setDomainGridlineStroke(new BasicStroke(0.5F)); categoryplot.setDomainGridlinePaint(Color.black); categoryplot.setRangeGridlinesVisible(false); categoryplot.clearRangeMarkers(); CategoryAxis categoryaxis = categoryplot.getDomainAxis(); categoryaxis.setVisible(false); categoryaxis.setCategoryMargin(0.5D); categoryplot.getRangeAxis().setVisible(false); BarRenderer barrenderer = (BarRenderer) categoryplot.getRenderer(); barrenderer.setSeriesPaint(0, new Color(156, 164, 74)); barrenderer.setDrawBarOutline(false); barrenderer.setBaseItemLabelsVisible(true); barrenderer.setBaseItemLabelFont(new Font("SansSerif", 1, 10)); ItemLabelPosition itemlabelposition = new ItemLabelPosition(ItemLabelAnchor.INSIDE3, TextAnchor.CENTER_RIGHT); barrenderer.setBasePositiveItemLabelPosition(itemlabelposition); CategoryTextAnnotation categorytextannotation = new CategoryTextAnnotation("1. White papers are available.", "Category 1", 0.0D); categorytextannotation.setFont(new Font("SansSerif", 1, 12)); categorytextannotation.setTextAnchor(TextAnchor.BOTTOM_LEFT); categorytextannotation.setCategoryAnchor(CategoryAnchor.START); categoryplot.addAnnotation(categorytextannotation); CategoryTextAnnotation categorytextannotation1 = new CategoryTextAnnotation( "2. White papers enhance users understanding of the firm and its expertise.", "Category 2", 0.0D); categorytextannotation1.setFont(new Font("SansSerif", 0, 12)); categorytextannotation1.setTextAnchor(TextAnchor.BOTTOM_LEFT); categorytextannotation1.setCategoryAnchor(CategoryAnchor.START); categoryplot.addAnnotation(categorytextannotation1); CategoryTextAnnotation categorytextannotation2 = new CategoryTextAnnotation( "3. White papers are relevant to the firm's prospects and clients.", "Category 3", 0.0D); categorytextannotation2.setFont(new Font("SansSerif", 0, 12)); categorytextannotation2.setTextAnchor(TextAnchor.BOTTOM_LEFT); categorytextannotation2.setCategoryAnchor(CategoryAnchor.START); categoryplot.addAnnotation(categorytextannotation2); CategoryTextAnnotation categorytextannotation3 = new CategoryTextAnnotation( "4. White papers are relevant to the firm's positioning.", "Category 4", 0.0D); categorytextannotation3.setFont(new Font("SansSerif", 0, 12)); categorytextannotation3.setTextAnchor(TextAnchor.BOTTOM_LEFT); categorytextannotation3.setCategoryAnchor(CategoryAnchor.START); categoryplot.addAnnotation(categorytextannotation3); CategoryTextAnnotation categorytextannotation4 = new CategoryTextAnnotation( "5. Case studies are available.", "Category 5", 0.0D); categorytextannotation4.setFont(new Font("SansSerif", 1, 12)); categorytextannotation4.setTextAnchor(TextAnchor.BOTTOM_LEFT); categorytextannotation4.setCategoryAnchor(CategoryAnchor.START); categoryplot.addAnnotation(categorytextannotation4); CategoryTextAnnotation categorytextannotation5 = new CategoryTextAnnotation( "6. Case studies enhance users understanding of the firm and its expertise.", "Category 6", 0.0D); categorytextannotation5.setFont(new Font("SansSerif", 0, 12)); categorytextannotation5.setTextAnchor(TextAnchor.BOTTOM_LEFT); categorytextannotation5.setCategoryAnchor(CategoryAnchor.START); categoryplot.addAnnotation(categorytextannotation5); CategoryTextAnnotation categorytextannotation6 = new CategoryTextAnnotation( "7. Case studies are relevant to the firm's prospects and clients.", "Category 7", 0.0D); categorytextannotation6.setFont(new Font("SansSerif", 0, 12)); categorytextannotation6.setTextAnchor(TextAnchor.BOTTOM_LEFT); categorytextannotation6.setCategoryAnchor(CategoryAnchor.START); categoryplot.addAnnotation(categorytextannotation6); CategoryTextAnnotation categorytextannotation7 = new CategoryTextAnnotation( "8. White papers are relevant to the firm's positioning.", "Category 8", 0.0D); categorytextannotation7.setFont(new Font("SansSerif", 0, 12)); categorytextannotation7.setTextAnchor(TextAnchor.BOTTOM_LEFT); categorytextannotation7.setCategoryAnchor(CategoryAnchor.START); categoryplot.addAnnotation(categorytextannotation7); CategoryTextAnnotation categorytextannotation8 = new CategoryTextAnnotation( "9. Case studies are available.", "Category 9", 0.0D); categorytextannotation8.setFont(new Font("SansSerif", 1, 12)); categorytextannotation8.setTextAnchor(TextAnchor.BOTTOM_LEFT); categorytextannotation8.setCategoryAnchor(CategoryAnchor.START); categoryplot.addAnnotation(categorytextannotation8); CategoryTextAnnotation categorytextannotation9 = new CategoryTextAnnotation( "10. Case studies enhance users understanding of the firm and its expertise.", "Category 10", 0.0D); categorytextannotation9.setFont(new Font("SansSerif", 0, 12)); categorytextannotation9.setTextAnchor(TextAnchor.BOTTOM_LEFT); categorytextannotation9.setCategoryAnchor(CategoryAnchor.START); categoryplot.addAnnotation(categorytextannotation9); CategoryTextAnnotation categorytextannotation10 = new CategoryTextAnnotation( "11. Case studies are relevant to the firm's prospects and clients.", "Category 11", 0.0D); categorytextannotation10.setFont(new Font("SansSerif", 0, 12)); categorytextannotation10.setTextAnchor(TextAnchor.BOTTOM_LEFT); categorytextannotation10.setCategoryAnchor(CategoryAnchor.START); categoryplot.addAnnotation(categorytextannotation10); CategoryTextAnnotation categorytextannotation11 = new CategoryTextAnnotation( "12. White papers are relevant to the firm's positioning.", "Category 12", 0.0D); categorytextannotation11.setFont(new Font("SansSerif", 0, 12)); categorytextannotation11.setTextAnchor(TextAnchor.BOTTOM_LEFT); categorytextannotation11.setCategoryAnchor(CategoryAnchor.START); categoryplot.addAnnotation(categorytextannotation11); CategoryTextAnnotation categorytextannotation12 = new CategoryTextAnnotation( "13. Users can easily access resources based on viewer interest.", "Category 13", 0.0D); categorytextannotation12.setFont(new Font("SansSerif", 1, 12)); categorytextannotation12.setTextAnchor(TextAnchor.BOTTOM_LEFT); categorytextannotation12.setCategoryAnchor(CategoryAnchor.START); categoryplot.addAnnotation(categorytextannotation12); CategoryTextAnnotation categorytextannotation13 = new CategoryTextAnnotation( "14. Access to additional hyperlinks enhances users's ability to find relevant information.", "Category 14", 0.0D); categorytextannotation13.setFont(new Font("SansSerif", 1, 12)); categorytextannotation13.setTextAnchor(TextAnchor.BOTTOM_LEFT); categorytextannotation13.setCategoryAnchor(CategoryAnchor.START); categoryplot.addAnnotation(categorytextannotation13); CategoryTextAnnotation categorytextannotation14 = new CategoryTextAnnotation("15. OVERALL EFFECTIVENESS.", "Overall", 0.0D); categorytextannotation14.setFont(new Font("SansSerif", 1, 12)); categorytextannotation14.setTextAnchor(TextAnchor.BOTTOM_LEFT); categorytextannotation14.setCategoryAnchor(CategoryAnchor.START); categoryplot.addAnnotation(categorytextannotation14); return jfreechart; }
From source file:net.sf.jasperreports.components.spiderchart.SpiderChartDesignEvaluator.java
/** * /* w w w .j a v a2 s .co m*/ */ public static JRRenderable evaluateRenderer(ReportConverter reportConverter, JRComponentElement element) { SpiderChartComponent chartComponent = (SpiderChartComponent) element.getComponent(); ChartSettings chartSettings = chartComponent.getChartSettings(); SpiderPlot plot = chartComponent.getPlot(); SpiderWebPlot spiderWebPlot = new SpiderWebPlot(getSampleDataset()); if (plot.getAxisLineColor() != null) { spiderWebPlot.setAxisLinePaint(plot.getAxisLineColor()); } if (plot.getAxisLineWidth() != null) { spiderWebPlot.setAxisLineStroke(new BasicStroke(plot.getAxisLineWidth())); } if (plot.getBackcolor() != null) { spiderWebPlot.setBackgroundPaint(plot.getBackcolor()); } if (plot.getBackgroundAlpha() != null) { spiderWebPlot.setBackgroundAlpha(plot.getBackgroundAlpha()); } if (plot.getForegroundAlpha() != null) { spiderWebPlot.setForegroundAlpha(plot.getForegroundAlpha()); } if (plot.getHeadPercent() != null) { spiderWebPlot.setHeadPercent(plot.getHeadPercent()); } if (plot.getInteriorGap() != null) { spiderWebPlot.setInteriorGap(plot.getInteriorGap()); } if (plot.getLabelColor() != null) { spiderWebPlot.setLabelPaint(plot.getLabelColor()); } if (plot.getLabelFont() != null) { spiderWebPlot.setLabelFont(JRFontUtil.getAwtFont(plot.getLabelFont(), Locale.getDefault())); } if (plot.getLabelGap() != null) { spiderWebPlot.setAxisLabelGap(plot.getLabelGap()); } spiderWebPlot.setMaxValue(MAX_VALUE); if (plot.getRotation() != null) { spiderWebPlot.setDirection(plot.getRotation().getRotation()); } if (plot.getStartAngle() != null) { spiderWebPlot.setStartAngle(plot.getStartAngle()); } if (plot.getTableOrder() != null) { spiderWebPlot.setDataExtractOrder(plot.getTableOrder().getOrder()); } if (plot.getWebFilled() != null) { spiderWebPlot.setWebFilled(plot.getWebFilled()); } spiderWebPlot.setToolTipGenerator(new StandardCategoryToolTipGenerator()); spiderWebPlot.setLabelGenerator(new StandardCategoryItemLabelGenerator()); String titleText = JRExpressionUtil.getExpressionText(chartSettings.getTitleExpression()); Font titleFont = chartSettings.getTitleFont() != null ? JRFontUtil.getAwtFont(chartSettings.getTitleFont(), Locale.getDefault()) : TextTitle.DEFAULT_FONT; JFreeChart jfreechart = new JFreeChart(titleText, titleFont, spiderWebPlot, true); if (chartSettings.getBackcolor() != null) { jfreechart.setBackgroundPaint(chartSettings.getBackcolor()); } RectangleEdge titleEdge = getEdge(chartSettings.getTitlePosition(), RectangleEdge.TOP); if (titleText != null) { TextTitle title = jfreechart.getTitle(); title.setText(titleText); if (chartSettings.getTitleColor() != null) { title.setPaint(chartSettings.getTitleColor()); } title.setFont(titleFont); title.setPosition(titleEdge); jfreechart.setTitle(title); } String subtitleText = JRExpressionUtil.getExpressionText(chartSettings.getSubtitleExpression()); if (subtitleText != null) { TextTitle subtitle = new TextTitle(subtitleText); subtitle.setText(subtitleText); if (chartSettings.getSubtitleColor() != null) { subtitle.setPaint(chartSettings.getSubtitleColor()); } if (chartSettings.getSubtitleColor() != null) { Font subtitleFont = chartSettings.getSubtitleFont() != null ? JRFontUtil.getAwtFont(chartSettings.getSubtitleFont(), Locale.getDefault()) : TextTitle.DEFAULT_FONT; subtitle.setFont(subtitleFont); } subtitle.setPosition(titleEdge); jfreechart.addSubtitle(subtitle); } // Apply all of the legend formatting options LegendTitle legend = jfreechart.getLegend(); if (legend != null) { legend.setVisible((chartSettings.getShowLegend() == null || chartSettings.getShowLegend())); if (legend.isVisible()) { if (chartSettings.getLegendColor() != null) { legend.setItemPaint(chartSettings.getLegendColor()); } if (chartSettings.getLegendBackgroundColor() != null) { legend.setBackgroundPaint(chartSettings.getLegendBackgroundColor()); } if (chartSettings.getLegendFont() != null) { legend.setItemFont(JRFontUtil.getAwtFont(chartSettings.getLegendFont(), Locale.getDefault())); } legend.setPosition(getEdge(chartSettings.getLegendPosition(), RectangleEdge.BOTTOM)); } } Rectangle2D rectangle = new Rectangle2D.Double(0, 0, element.getWidth(), element.getHeight()); String renderType = chartSettings.getRenderType(); if (renderType == null) { renderType = JRProperties.getProperty(reportConverter.getReport(), JRChart.PROPERTY_CHART_RENDER_TYPE); } return ChartUtil.getChartRendererFactory(renderType).getRenderer(jfreechart, null, rectangle); }
From source file:net.sf.jasperreports.components.spiderchart.SpiderChartRendererEvaluator.java
/** * //from ww w .j a va 2 s . c o m */ public static Renderable evaluateRenderable(JasperReportsContext jasperReportsContext, JRComponentElement element, SpiderChartSharedBean spiderchartBean, ChartCustomizer chartCustomizer, String defaultRenderType, String datasetType) { SpiderChartComponent chartComponent = (SpiderChartComponent) element.getComponent(); ChartSettings chartSettings = chartComponent.getChartSettings(); SpiderPlot plot = (SpiderPlot) chartComponent.getPlot(); DefaultCategoryDataset dataset = null; StandardCategoryItemLabelGenerator labelGenerator = null; if (FILL_DATASET.equals(datasetType)) { dataset = ((FillSpiderDataset) spiderchartBean.getDataset()).getCustomDataset(); labelGenerator = ((FillSpiderDataset) spiderchartBean.getDataset()).getLabelGenerator(); } else { dataset = getSampleDataset(); labelGenerator = new StandardCategoryItemLabelGenerator(); } SpiderWebPlot spiderWebPlot = new SpiderWebPlot(dataset); if (plot.getAxisLineColor() != null) { spiderWebPlot.setAxisLinePaint(plot.getAxisLineColor()); } if (plot.getAxisLineWidth() != null) { spiderWebPlot.setAxisLineStroke(new BasicStroke(plot.getAxisLineWidth())); } if (plot.getBackcolor() != null) { spiderWebPlot.setBackgroundPaint(plot.getBackcolor()); } if (plot.getBackgroundAlpha() != null) { spiderWebPlot.setBackgroundAlpha(plot.getBackgroundAlpha()); } if (plot.getForegroundAlpha() != null) { spiderWebPlot.setForegroundAlpha(plot.getForegroundAlpha()); } if (plot.getHeadPercent() != null) { spiderWebPlot.setHeadPercent(plot.getHeadPercent()); } if (plot.getInteriorGap() != null) { spiderWebPlot.setInteriorGap(plot.getInteriorGap()); } if (plot.getLabelColor() != null) { spiderWebPlot.setLabelPaint(plot.getLabelColor()); } if (plot.getLabelFont() != null) { spiderWebPlot.setLabelFont(FontUtil.getInstance(jasperReportsContext).getAwtFont(plot.getLabelFont(), Locale.getDefault())); } if (plot.getLabelGap() != null) { spiderWebPlot.setAxisLabelGap(plot.getLabelGap()); } if (spiderchartBean.getMaxValue() != null) { spiderWebPlot.setMaxValue(spiderchartBean.getMaxValue()); } if (plot.getRotation() != null) { spiderWebPlot.setDirection(plot.getRotation().getRotation()); } if (plot.getStartAngle() != null) { spiderWebPlot.setStartAngle(plot.getStartAngle()); } if (plot.getTableOrder() != null) { spiderWebPlot.setDataExtractOrder(plot.getTableOrder().getOrder()); } if (plot.getWebFilled() != null) { spiderWebPlot.setWebFilled(plot.getWebFilled()); } spiderWebPlot.setToolTipGenerator(new StandardCategoryToolTipGenerator()); spiderWebPlot.setLabelGenerator(labelGenerator); Font titleFont = chartSettings.getTitleFont() != null ? FontUtil.getInstance(jasperReportsContext) .getAwtFont(chartSettings.getTitleFont(), Locale.getDefault()) : TextTitle.DEFAULT_FONT; String titleText = spiderchartBean.getTitleText(); JFreeChart jfreechart = new JFreeChart(titleText, titleFont, spiderWebPlot, true); Color backcolor = chartSettings.getBackcolor() != null ? chartSettings.getBackcolor() : element.getBackcolor(); if (backcolor != null) { jfreechart.setBackgroundPaint(backcolor); } RectangleEdge titleEdge = getEdge(chartSettings.getTitlePosition(), RectangleEdge.TOP); if (titleText != null) { TextTitle title = jfreechart.getTitle(); title.setText(titleText); if (chartSettings.getTitleColor() != null) { title.setPaint(chartSettings.getTitleColor()); } title.setFont(titleFont); title.setPosition(titleEdge); jfreechart.setTitle(title); } String subtitleText = spiderchartBean.getSubtitleText(); if (subtitleText != null) { TextTitle subtitle = new TextTitle(subtitleText); subtitle.setText(subtitleText); if (chartSettings.getSubtitleColor() != null) { subtitle.setPaint(chartSettings.getSubtitleColor()); } if (chartSettings.getSubtitleColor() != null) { Font subtitleFont = chartSettings.getSubtitleFont() != null ? FontUtil.getInstance(jasperReportsContext).getAwtFont(chartSettings.getSubtitleFont(), Locale.getDefault()) : TextTitle.DEFAULT_FONT; subtitle.setFont(subtitleFont); } subtitle.setPosition(titleEdge); jfreechart.addSubtitle(subtitle); } // Apply all of the legend formatting options LegendTitle legend = jfreechart.getLegend(); if (legend != null) { legend.setVisible((chartSettings.getShowLegend() == null || chartSettings.getShowLegend())); if (legend.isVisible()) { if (chartSettings.getLegendColor() != null) { legend.setItemPaint(chartSettings.getLegendColor()); } if (chartSettings.getLegendBackgroundColor() != null) { legend.setBackgroundPaint(chartSettings.getLegendBackgroundColor()); } if (chartSettings.getLegendFont() != null) { legend.setItemFont(FontUtil.getInstance(jasperReportsContext) .getAwtFont(chartSettings.getLegendFont(), Locale.getDefault())); } legend.setPosition(getEdge(chartSettings.getLegendPosition(), RectangleEdge.BOTTOM)); } } String renderType = chartSettings.getRenderType() == null ? defaultRenderType : chartSettings.getRenderType(); Rectangle2D rectangle = new Rectangle2D.Double(0, 0, element.getWidth(), element.getHeight()); if (chartCustomizer != null) { chartCustomizer.customize(jfreechart, chartComponent); } return ChartUtil.getInstance(jasperReportsContext).getChartRenderableFactory(renderType) .getRenderable(jasperReportsContext, jfreechart, spiderchartBean.getHyperlinkProvider(), rectangle); }
From source file:net.relet.freimap.NodeInfo.java
private void sexupLayout(JFreeChart chart) { chart.setAntiAlias(true);// w ww. j a v a2s . co m chart.setBackgroundPaint(VisorFrame.bgcolor); chart.setBorderVisible(false); TextTitle title = chart.getTitle(); title.setFont(VisorFrame.smallerfont); title.setPaint(VisorFrame.fgcolor); XYPlot plot = chart.getXYPlot(); plot.setBackgroundPaint(VisorFrame.bgcolor); plot.setDomainAxis(new DateAxis()); sexupAxis(plot.getDomainAxis()); sexupAxis(plot.getRangeAxis()); }
From source file:com.greenpepper.confluence.macros.historic.AbstractChartBuilder.java
protected void customizeTitle(TextTitle title, Font font) { title.setFont(font);//from w ww .j a v a 2 s . c o m title.setTextAlignment(HorizontalAlignment.LEFT); title.setPaint(Color.BLACK); title.setBackgroundPaint(TRANSPARENT_COLOR); }
From source file:com.xilinx.kintex7.ThermoPlot.java
public void createPlot() { dset = new DefaultValueDataset(50); plot = new ThermometerPlot(dset); plot.setRange(0, 125);/*from w w w . ja v a 2 s . co m*/ //plot.setFollowDataInSubranges(true); //plot.setUseSubrangePaint(false); plot.setThermometerStroke(new BasicStroke(2.0f)); plot.setSubrange(ThermometerPlot.NORMAL, 0, 60); plot.setSubrange(ThermometerPlot.WARNING, 60, 85); plot.setSubrange(ThermometerPlot.CRITICAL, 86, 125); plot.setThermometerPaint(Color.BLACK); plot.setOutlineVisible(false); plot.setBackgroundAlpha(0); plot.setMercuryPaint(Color.ORANGE); plot.setUnits(ThermometerPlot.UNITS_NONE); chart = new JFreeChart("", plot); TextTitle ttitle = new TextTitle("Temperature (\u2103)", new Font("Temperature (\u2103)", Font.BOLD, 15)); ttitle.setPaint(Color.WHITE); chart.setTitle(ttitle); chart.setBackgroundPaint(new Color(133, 133, 133)); //chart.setTitle(""); }
From source file:com.xilinx.ultrascale.gui.DMABarChart.java
private void makeChart() { dataset = new DefaultCategoryDataset(); chart = ChartFactory.createBarChart("", "Time Interval", "Throughput (Gbps)", dataset, PlotOrientation.VERTICAL, true, true, false); chart.setBackgroundPaint(bg);// ww w .j a v a 2 s . c om TextTitle ttitle = new TextTitle(title, new Font(title, Font.BOLD, 15)); ttitle.setPaint(Color.WHITE); chart.setTitle(ttitle); CategoryPlot plot = chart.getCategoryPlot(); BarRenderer renderer = (BarRenderer) plot.getRenderer(); renderer.setDrawBarOutline(false); ValueAxis axis = plot.getRangeAxis(); axis.setUpperBound(64.0); axis.setLowerBound(0.0); axis.setTickLabelPaint(new Color(185, 185, 185)); axis.setLabelPaint(new Color(185, 185, 185)); CategoryAxis caxis = plot.getDomainAxis(); caxis.setTickLabelPaint(new Color(185, 185, 185)); caxis.setLabelPaint(new Color(185, 185, 185)); renderer.setItemMargin(0); renderer.setSeriesPaint(0, new Color(0x2e, 0x90, 0x18));//(0x17, 0x7b, 0x7c)); renderer.setSeriesPaint(1, new Color(0x12, 0x45, 0x73));//(0xa2, 0x45, 0x73) renderer.setSeriesPaint(3, new Color(0xff, 0x80, 0x40)); renderer.setSeriesPaint(2, new Color(0x6f, 0x2c, 0x85)); renderer.setSeriesPaint(4, new Color(0xa1, 0x60, 0x98)); renderer.setBaseToolTipGenerator( new StandardCategoryToolTipGenerator("{0}:{2}", new DecimalFormat("0.000"))); //renderer.setMaximumBarWidth(0.05); // addDummy(); }
From source file:daylightchart.options.chart.TitleOptions.java
/** * {@inheritDoc}//from w w w . j a v a2 s.c om * * @see BaseChartOptions#updateChart(org.jfree.chart.JFreeChart) */ @Override public void updateChart(final JFreeChart chart) { if (hideTitle) { final TextTitle title = chart.getTitle(); if (title != null) { title.setFont(titleFont); title.setPaint(titlePaint); title.setText(titleText); } } else { chart.setTitle((TextTitle) null); } }
From source file:com.xilinx.ultrascale.gui.PowerChart.java
private void makeChart() { dataset = new DefaultCategoryDataset(); chart = ChartFactory.createBarChart("", "Time Interval", "", dataset, PlotOrientation.HORIZONTAL, true, true, false);//from w ww. j a v a2s .c o m TextTitle ttitle = new TextTitle(title, new Font(title, Font.BOLD, 15)); ttitle.setPaint(Color.WHITE); chart.setTitle(ttitle); chart.setBackgroundPaint(bg); CategoryPlot plot = chart.getCategoryPlot(); plot.setDomainGridlinesVisible(false); plot.setRangeGridlinesVisible(false); BarRenderer renderer = (BarRenderer) plot.getRenderer(); renderer.setDrawBarOutline(false); ValueAxis axis = plot.getRangeAxis(); // axis.setUpperBound(6); axis.setAutoRange(true); axis.setLowerMargin(0); axis.setUpperMargin(.40); // TickUnits tickUnits = new TickUnits(); // tickUnits.add(new NumberTickUnit(1)); // axis.setStandardTickUnits(tickUnits); // axis.setLowerBound(0.0); axis.setTickLabelPaint(new Color(185, 185, 185)); CategoryAxis caxis = plot.getDomainAxis(); caxis.setTickLabelPaint(new Color(185, 185, 185)); caxis.setLabelPaint(new Color(185, 185, 185)); renderer.setItemMargin(0); renderer.setSeriesPaint(0, new Color(0x2e, 0x90, 0x18));//(0x17, 0x7b, 0x7c)); renderer.setSeriesPaint(1, new Color(0x12, 0x45, 0x73));//(0xa2, 0x45, 0x73) renderer.setSeriesPaint(2, new Color(0xff, 0x80, 0x40)); renderer.setSeriesPaint(3, new Color(0x6f, 0x2c, 0x85)); renderer.setBaseToolTipGenerator( new StandardCategoryToolTipGenerator("{0}:{2}", new DecimalFormat("0.000"))); addDummy(); }
From source file:com.xilinx.kintex7.DMABarChart.java
private void makeChart() { dataset = new DefaultCategoryDataset(); chart = ChartFactory.createBarChart("", "Time Interval", "Throughput (Gbps)", dataset, PlotOrientation.VERTICAL, true, true, false); chart.setBackgroundPaint(bg);// w ww . j a v a 2 s . c o m TextTitle ttitle = new TextTitle(title, new Font(title, Font.BOLD, 15)); ttitle.setPaint(Color.WHITE); chart.setTitle(ttitle); CategoryPlot plot = chart.getCategoryPlot(); BarRenderer renderer = (BarRenderer) plot.getRenderer(); renderer.setDrawBarOutline(false); ValueAxis axis = plot.getRangeAxis(); axis.setUpperBound(30.0); axis.setLowerBound(0.0); axis.setTickLabelPaint(new Color(185, 185, 185)); axis.setLabelPaint(new Color(185, 185, 185)); CategoryAxis caxis = plot.getDomainAxis(); caxis.setTickLabelPaint(new Color(185, 185, 185)); caxis.setLabelPaint(new Color(185, 185, 185)); renderer.setItemMargin(0); renderer.setSeriesPaint(0, new Color(0, 0, 0x80)); renderer.setSeriesPaint(1, new Color(0, 0x80, 0xff)); renderer.setSeriesPaint(2, new Color(0xa2, 0x45, 0x73)); renderer.setBaseToolTipGenerator( new StandardCategoryToolTipGenerator("{0}:{2}", new DecimalFormat("0.000"))); //renderer.setMaximumBarWidth(0.05); addDummy(); }