public static void setLineRender(CategoryPlot plot, boolean isShowDataLabels, boolean isShapesVisible) { plot.setNoDataMessage(NO_DATA_MSG); plot.setInsets(new RectangleInsets(10, 10, 0, 10), false); LineAndShapeRenderer renderer = (LineAndShapeRenderer) plot.getRenderer(); renderer.setStroke(new BasicStroke(1.5F)); if (isShowDataLabels) { renderer.setBaseItemLabelsVisible(true); renderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator(StandardCategoryItemLabelGenerator.DEFAULT_LABEL_FORMAT_STRING, NumberFormat.getInstance())); renderer.setBasePositiveItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.OUTSIDE1, TextAnchor.BOTTOM_CENTER)); } renderer.setBaseShapesVisible(isShapesVisible); setXAixs(plot); setYAixs(plot); }
/** * Some checks for the generalLabel() method. */ public void testGenerateLabel() { StandardCategoryItemLabelGenerator g = new StandardCategoryItemLabelGenerator("{2}", new DecimalFormat("0.000")); DefaultCategoryDataset dataset = new DefaultCategoryDataset(); dataset.addValue(1.0, "R0", "C0"); dataset.addValue(2.0, "R0", "C1"); dataset.addValue(3.0, "R1", "C0"); dataset.addValue(null, "R1", "C1"); String s = g.generateLabel(dataset, 0, 0); assertEquals("1.000", s); // try a null value s = g.generateLabel(dataset, 1, 1); assertEquals("-", s); }
/** * Confirm that cloning works. */ @Test public void testCloning1() throws CloneNotSupportedException { AbstractCategoryItemRenderer r1 = new BarRenderer(); r1.setItemLabelGenerator(new StandardCategoryItemLabelGenerator()); AbstractCategoryItemRenderer r2 = (BarRenderer) r1.clone(); assertTrue(r1 != r2); assertTrue(r1.getClass() == r2.getClass()); assertTrue(r1.equals(r2)); r1 = new BarRenderer(); r1.setSeriesItemLabelGenerator(0, new StandardCategoryItemLabelGenerator()); r2 = (BarRenderer) r1.clone(); assertTrue(r1 != r2); assertTrue(r1.getClass() == r2.getClass()); assertTrue(r1.equals(r2)); r1 = new BarRenderer(); r1.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator()); r2 = (BarRenderer) r1.clone(); assertTrue(r1 != r2); assertTrue(r1.getClass() == r2.getClass()); assertTrue(r1.equals(r2)); }
/** * Confirm that cloning works. */ @Test public void testCloning1() throws CloneNotSupportedException { AbstractCategoryItemRenderer r1 = new BarRenderer(); AbstractCategoryItemRenderer r2 = (BarRenderer) r1.clone(); assertTrue(r1 != r2); assertTrue(r1.getClass() == r2.getClass()); assertTrue(r1.equals(r2)); r1 = new BarRenderer(); r1.setSeriesItemLabelGenerator(0, new StandardCategoryItemLabelGenerator()); r2 = (BarRenderer) r1.clone(); assertTrue(r1 != r2); assertTrue(r1.getClass() == r2.getClass()); assertTrue(r1.equals(r2)); r1 = new BarRenderer(); r1.setDefaultItemLabelGenerator(new StandardCategoryItemLabelGenerator()); r2 = (BarRenderer) r1.clone(); assertTrue(r1 != r2); assertTrue(r1.getClass() == r2.getClass()); assertTrue(r1.equals(r2)); }
/** * Confirm that cloning works. */ public void testCloning() { BarRenderer r1 = new BarRenderer(); r1.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator()); r1.setBarPainter(new GradientBarPainter(0.11, 0.22, 0.33)); BarRenderer r2 = null; try { r2 = (BarRenderer) r1.clone(); } catch (CloneNotSupportedException e) { e.printStackTrace(); } assertTrue(r1 != r2); assertTrue(r1.getClass() == r2.getClass()); assertTrue(r1.equals(r2)); }
/** * Some checks for the generalLabel() method. */ public void testGenerateLabel() { StandardCategoryItemLabelGenerator g = new StandardCategoryItemLabelGenerator("{2}", new DecimalFormat("0.000")); DefaultCategoryDataset dataset = new DefaultCategoryDataset(); dataset.addValue(1.0, "R0", "C0"); dataset.addValue(2.0, "R0", "C1"); dataset.addValue(3.0, "R1", "C0"); dataset.addValue(null, "R1", "C1"); String s = g.generateLabel(dataset, 0, 0); assertTrue(s.startsWith("1")); assertTrue(s.endsWith("000")); // try a null value s = g.generateLabel(dataset, 1, 1); assertEquals("-", s); }
/** Customize renderer. */ private void customizeRenderer(CategoryPlot plot) { BarRenderer renderer = (BarRenderer) plot.getRenderer(); renderer.setMaximumBarWidth(0.5); renderer.setSeriesPaint(0, Color.BLACK); renderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator()); renderer.setBaseItemLabelsVisible(true); renderer.setBaseItemLabelPaint(Color.white); renderer.setBasePositiveItemLabelPosition(new ItemLabelPosition( ItemLabelAnchor.CENTER, TextAnchor.CENTER, TextAnchor.CENTER, 0.0)); renderer.setBarPainter(new StandardBarPainter()); renderer.setShadowVisible(false); }
private JFreeChart createChart(CategoryDataset categorydataset) { JFreeChart jfreechart = ChartFactory.createStackedBarChart3D("Stacked Bar Chart 3D Demo 2 ", "Category ", "Value ", categorydataset, PlotOrientation.VERTICAL, true, true, false); CategoryPlot categoryplot = (CategoryPlot) jfreechart.getPlot(); StackedBarRenderer3D stackedbarrenderer3d = (StackedBarRenderer3D) categoryplot.getRenderer(); stackedbarrenderer3d.setRenderAsPercentages(true); stackedbarrenderer3d.setDrawBarOutline(false); stackedbarrenderer3d.setItemLabelGenerator(new StandardCategoryItemLabelGenerator("{3} ", NumberFormat .getIntegerInstance(), new DecimalFormat("0.0% "))); stackedbarrenderer3d.setItemLabelsVisible(true); stackedbarrenderer3d.setPositiveItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.CENTER, TextAnchor.CENTER)); stackedbarrenderer3d.setNegativeItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.CENTER, TextAnchor.CENTER)); return jfreechart; }
public static void setBarRenderer(CategoryPlot plot, boolean isShowDataLabels) { plot.setNoDataMessage(NO_DATA_MSG); plot.setInsets(new RectangleInsets(10, 10, 5, 10)); BarRenderer renderer = (BarRenderer) plot.getRenderer(); renderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator()); renderer.setMaximumBarWidth(0.075); if (isShowDataLabels) { renderer.setBaseItemLabelsVisible(true); } setXAixs(plot); setYAixs(plot); }
public static void setStackBarRender(CategoryPlot plot) { plot.setNoDataMessage(NO_DATA_MSG); plot.setInsets(new RectangleInsets(10, 10, 5, 10)); StackedBarRenderer renderer = (StackedBarRenderer) plot.getRenderer(); renderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator()); plot.setRenderer(renderer); setXAixs(plot); setYAixs(plot); }
private static JFreeChart createBarChart(String title,String category,String value, CategoryDataset dataset) { JFreeChart chart = ChartFactory.createBarChart3D(title, // chart title category, // domain axis label value, // range axis label dataset, // data PlotOrientation.VERTICAL, // 图标方向 true, // 是否显示legend true, // 是否显示tooltips false // 是否显示URLs ); CategoryPlot plot = chart.getCategoryPlot();//设置图的高级属性 plot.setBackgroundPaint(ChartColor.WHITE); NumberAxis na= (NumberAxis)plot.getRangeAxis(); // na.setAutoTickUnitSelection(false);//设置小数点位数 na.setNumberFormatOverride(df); // NumberTickUnit nt=new NumberTickUnit(1.22); // na.setTickUnit(nt); // plot.setRangeAxis(na); BarRenderer3D renderer = new BarRenderer3D();//3D属性修改 renderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator()); renderer.setBaseItemLabelsVisible(true); renderer.setItemLabelAnchorOffset(10); renderer.setBasePositiveItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12, TextAnchor.BASELINE_CENTER)); renderer.setSeriesPaint(0,new Color(34,139,34)); renderer.setSeriesPaint(1,new Color(154,205,50)); renderer.setSeriesPaint(2,new Color(0,255,0)); renderer.setSeriesPaint(3,new Color(127,255,212)); plot.setRenderer(renderer);//将修改后的属性值保存到图中 return chart; }
/** * A test for bug 1481087. */ public void testEquals1481087() { StandardCategoryItemLabelGenerator g1 = new StandardCategoryItemLabelGenerator("{0}", new DecimalFormat("0.00")); StandardCategoryToolTipGenerator g2 = new StandardCategoryToolTipGenerator("{0}", new DecimalFormat("0.00")); assertFalse(g1.equals(g2)); }
/** * A test for bug 1481087. */ public void testEquals1481087() { StandardCategoryToolTipGenerator g1 = new StandardCategoryToolTipGenerator("{0}", new DecimalFormat("0.00")); StandardCategoryItemLabelGenerator g2 = new StandardCategoryItemLabelGenerator("{0}", new DecimalFormat("0.00")); assertFalse(g1.equals(g2)); }
/** * Creates a new spider web plot with the given dataset. * * @param dataset the dataset. * @param extract controls how data is extracted ({@link TableOrder#BY_ROW} * or {@link TableOrder#BY_COLUMN}). */ public SpiderWebPlot(CategoryDataset dataset, TableOrder extract) { super(); if (extract == null) { throw new IllegalArgumentException("Null 'extract' argument."); } this.dataset = dataset; if (dataset != null) { dataset.addChangeListener(this); } this.dataExtractOrder = extract; this.headPercent = DEFAULT_HEAD; this.axisLabelGap = DEFAULT_AXIS_LABEL_GAP; this.axisLinePaint = Color.black; this.axisLineStroke = new BasicStroke(1.0f); this.interiorGap = DEFAULT_INTERIOR_GAP; this.startAngle = DEFAULT_START_ANGLE; this.direction = Rotation.CLOCKWISE; this.maxValue = DEFAULT_MAX_VALUE; this.seriesPaint = null; this.seriesPaintList = new PaintList(); this.baseSeriesPaint = null; this.seriesOutlinePaint = null; this.seriesOutlinePaintList = new PaintList(); this.baseSeriesOutlinePaint = DEFAULT_OUTLINE_PAINT; this.seriesOutlineStroke = null; this.seriesOutlineStrokeList = new StrokeList(); this.baseSeriesOutlineStroke = DEFAULT_OUTLINE_STROKE; this.labelFont = DEFAULT_LABEL_FONT; this.labelPaint = DEFAULT_LABEL_PAINT; this.labelGenerator = new StandardCategoryItemLabelGenerator(); this.legendItemShape = DEFAULT_LEGEND_ITEM_CIRCLE; }
/** * Confirm that cloning works. */ @Test public void testCloning() throws CloneNotSupportedException { BarRenderer r1 = new BarRenderer(); r1.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator()); r1.setBarPainter(new GradientBarPainter(0.11, 0.22, 0.33)); BarRenderer r2 = (BarRenderer) r1.clone(); assertTrue(r1 != r2); assertTrue(r1.getClass() == r2.getClass()); assertTrue(r1.equals(r2)); }
@Test public void testEquals_ObjectList() { BarRenderer r1 = new BarRenderer(); r1.setSeriesItemLabelGenerator(0, new StandardCategoryItemLabelGenerator()); BarRenderer r2 = new BarRenderer(); r2.setSeriesItemLabelGenerator(0, new StandardCategoryItemLabelGenerator()); assertEquals(r1, r2); r2.setSeriesItemLabelGenerator(1, new StandardCategoryItemLabelGenerator("X", new DecimalFormat("0.0"))); assertNotEquals(r1, r2); }
/** * Creates a new spider web plot with the given dataset. * * @param dataset the dataset. * @param extract controls how data is extracted ({@link TableOrder#BY_ROW} * or {@link TableOrder#BY_COLUMN}). */ public SpiderWebPlot(CategoryDataset dataset, TableOrder extract) { super(); ParamChecks.nullNotPermitted(extract, "extract"); this.dataset = dataset; if (dataset != null) { dataset.addChangeListener(this); } this.dataExtractOrder = extract; this.headPercent = DEFAULT_HEAD; this.axisLabelGap = DEFAULT_AXIS_LABEL_GAP; this.axisLinePaint = Color.black; this.axisLineStroke = new BasicStroke(1.0f); this.interiorGap = DEFAULT_INTERIOR_GAP; this.startAngle = DEFAULT_START_ANGLE; this.direction = Rotation.CLOCKWISE; this.maxValue = DEFAULT_MAX_VALUE; this.seriesPaint = null; this.seriesPaintList = new PaintList(); this.baseSeriesPaint = null; this.seriesOutlinePaint = null; this.seriesOutlinePaintList = new PaintList(); this.baseSeriesOutlinePaint = DEFAULT_OUTLINE_PAINT; this.seriesOutlineStroke = null; this.seriesOutlineStrokeList = new StrokeList(); this.baseSeriesOutlineStroke = DEFAULT_OUTLINE_STROKE; this.labelFont = DEFAULT_LABEL_FONT; this.labelPaint = DEFAULT_LABEL_PAINT; this.labelGenerator = new StandardCategoryItemLabelGenerator(); this.legendItemShape = DEFAULT_LEGEND_ITEM_CIRCLE; }
/** * Creates a new spider web plot with the given dataset. * * @param dataset the dataset. * @param extract controls how data is extracted ({@link TableOrder#BY_ROW} * or {@link TableOrder#BY_COLUMN}). */ public SpiderWebPlot(CategoryDataset dataset, TableOrder extract) { super(); Args.nullNotPermitted(extract, "extract"); this.dataset = dataset; if (dataset != null) { dataset.addChangeListener(this); } this.dataExtractOrder = extract; this.headPercent = DEFAULT_HEAD; this.axisLabelGap = DEFAULT_AXIS_LABEL_GAP; this.axisLinePaint = Color.BLACK; this.axisLineStroke = new BasicStroke(1.0f); this.interiorGap = DEFAULT_INTERIOR_GAP; this.startAngle = DEFAULT_START_ANGLE; this.direction = Rotation.CLOCKWISE; this.maxValue = DEFAULT_MAX_VALUE; this.seriesPaint = null; this.seriesPaintList = new PaintList(); this.baseSeriesPaint = null; this.seriesOutlinePaint = null; this.seriesOutlinePaintList = new PaintList(); this.baseSeriesOutlinePaint = DEFAULT_OUTLINE_PAINT; this.seriesOutlineStroke = null; this.seriesOutlineStrokeList = new StrokeList(); this.baseSeriesOutlineStroke = DEFAULT_OUTLINE_STROKE; this.labelFont = DEFAULT_LABEL_FONT; this.labelPaint = DEFAULT_LABEL_PAINT; this.labelGenerator = new StandardCategoryItemLabelGenerator(); this.legendItemShape = DEFAULT_LEGEND_ITEM_CIRCLE; }
/** * Confirm that cloning works. */ @Test public void testCloning() throws CloneNotSupportedException { BarRenderer r1 = new BarRenderer(); r1.setDefaultItemLabelGenerator(new StandardCategoryItemLabelGenerator()); r1.setBarPainter(new GradientBarPainter(0.11, 0.22, 0.33)); BarRenderer r2 = (BarRenderer) r1.clone(); assertTrue(r1 != r2); assertTrue(r1.getClass() == r2.getClass()); assertTrue(r1.equals(r2)); }
/** * not in use yet. This method generates labels above each bar. At this very moment, these labels just show the value of the underlying data * (which is not very usefull). It could be used to display for example n-values. * @param plot */ @SuppressWarnings("unused") private void setItemLabels(final CategoryPlot plot) { final BarRenderer renderer = (BarRenderer) plot.getRenderer(); renderer.setItemLabelGenerator(new StandardCategoryItemLabelGenerator()); // TODO change to a custom ItemLabelGenerator; see JFreeChart // developer Guide, version 0.9.18 (april 2004), page 80 and // following pages renderer.setItemLabelsVisible(true); renderer.setItemLabelFont(new Font("SansSerif", Font.PLAIN, 9)); renderer.setItemLabelPaint(null); renderer.setSeriesItemLabelPaint(0, renderer.getSeriesPaint(0)); renderer.setSeriesItemLabelPaint(1, renderer.getSeriesPaint(1)); }
private void setPlotStyle(JFreeChart chart) throws ChartException { if (chart == null) throw new ChartException("chart未正确创建,设置图表样式时异常!"); // 获得线性图的Plot对象 CategoryPlot localCategoryPlot = (CategoryPlot)chart.getPlot(); localCategoryPlot.setBackgroundAlpha(this.getAlpha()); BasicStroke stroke = new BasicStroke(); localCategoryPlot.setRangeGridlinesVisible(true) ;//数据轴网格是否可见 localCategoryPlot.setRangeGridlinePaint(Color.black) ;//数据轴网格线条颜色 //localCategoryPlot.setRangeGridlineStroke(stroke) ;//数据轴网格线条笔触 //localCategoryPlot.setDomainGridlinesVisible(true) ;//数据轴网格是否可见 //localCategoryPlot.setDomainGridlinePaint(Color.black) ;//数据轴网格线条颜色 //localCategoryPlot.setDomainGridlineStroke(stroke); CategoryAxis localCategoryXAxis = (CategoryAxis)localCategoryPlot.getDomainAxis(); NumberAxis localNumberYAxis = (NumberAxis)localCategoryPlot.getRangeAxis(); localCategoryXAxis.setTickLabelFont(new Font("宋体", Font.PLAIN, 12)); localCategoryXAxis.setLabelFont(new Font("宋体", Font.PLAIN, 12)); localNumberYAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); localNumberYAxis.setTickLabelFont(new Font("宋体", Font.PLAIN, 12)); localNumberYAxis.setLabelFont(new Font("宋体", Font.PLAIN, 12)); LineAndShapeRenderer localLineAndShapeRenderer = (LineAndShapeRenderer)localCategoryPlot.getRenderer(); //localLineAndShapeRenderer.setDrawLines(true);// 是否折线的数据点之间用线连 //localLineAndShapeRenderer.setDrawShapes(true);// 是否折线的数据点根据分类使用不同的形状 localLineAndShapeRenderer.setStroke(new BasicStroke(this.getStrok()));//这个是设置线条的粗细 if("1".equals(this.getDisplayNumber())){ localLineAndShapeRenderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator());//折线上显示数字 localLineAndShapeRenderer.setBaseItemLabelsVisible(true); } localLineAndShapeRenderer.setBaseShapesVisible(true); localLineAndShapeRenderer.setBaseShapesFilled(true); localLineAndShapeRenderer.setDrawOutlines(true); localLineAndShapeRenderer.setUseFillPaint(true); localLineAndShapeRenderer.setBaseFillPaint(Color.white); }
/** * Creates a sample chart. * * @param dataset the dataset. * * @return a sample chart. */ protected JFreeChart createChart(CategoryDataset dataset) { JFreeChart chart = ChartFactory.createStackedBarChart( chartTitle, domainLabel, // domain axis label rangeLabel, // range axis label dataset, // data PlotOrientation.HORIZONTAL, // the plot orientation !legendPanelOn, // include legend true, // tooltips false // urls ); /* CategoryPlot plot = (CategoryPlot) chart.getPlot(); StackedBarRenderer renderer = (StackedBarRenderer) plot.getRenderer(); renderer.setItemLabelsVisible(true);*/ CategoryPlot plot = chart.getCategoryPlot(); CategoryItemRenderer renderer = new ExtendedStackedBarRenderer(); renderer.setBaseItemLabelsVisible(true); renderer.setBaseItemLabelGenerator( new StandardCategoryItemLabelGenerator()); renderer.setBaseToolTipGenerator(new StandardCategoryToolTipGenerator()); plot.setRenderer(renderer); ValueAxis rangeAxis = plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); rangeAxis.setLowerMargin(0.15); rangeAxis.setUpperMargin(0.15); StackedBarRenderer renderer2 = (StackedBarRenderer) plot.getRenderer(); renderer2.setLegendItemLabelGenerator(new SOCRCategorySeriesLabelGenerator()); setCategorySummary(dataset); return chart; }
/** * Creates a sample chart. * * @param dataset the dataset for the chart. * * @return a sample chart. */ protected JFreeChart createChart(CategoryDataset dataset) { JFreeChart chart = ChartFactory.createStackedBarChart( chartTitle, // chart title domainLabel, // domain axis label rangeLabel, // range axis label dataset, // data PlotOrientation.VERTICAL, // the plot orientation !legendPanelOn, // legend true, // tooltips false // urls ); chart.setBackgroundPaint(Color.white); CategoryPlot plot = (CategoryPlot) chart.getPlot(); plot.setBackgroundPaint(Color.lightGray); plot.setRangeGridlinePaint(Color.white); StackedBarRenderer renderer = (StackedBarRenderer) plot.getRenderer(); renderer.setDrawBarOutline(false); renderer.setBaseItemLabelsVisible(true); renderer.setSeriesItemLabelGenerator(0, new StandardCategoryItemLabelGenerator()); renderer.setLegendItemLabelGenerator(new SOCRCategorySeriesLabelGenerator()); setCategorySummary(dataset); return chart; }
/** * Creates a sample chart. * * @param dataset the dataset for the chart. * * @return a sample chart. */ protected JFreeChart createChart(CategoryDataset dataset) { JFreeChart chart = ChartFactory.createStackedBarChart( chartTitle, // chart title domainLabel, // domain axis label rangeLabel, // range axis label dataset, // data PlotOrientation.VERTICAL, // the plot orientation !legendPanelOn, // legend false, // tooltips false // urls ); CategoryPlot plot = chart.getCategoryPlot(); CategoryItemRenderer renderer = new ExtendedStackedBarRenderer(); renderer.setBaseItemLabelsVisible(true); renderer.setBaseItemLabelGenerator( new StandardCategoryItemLabelGenerator()); renderer.setBaseToolTipGenerator(new StandardCategoryToolTipGenerator()); plot.setRenderer(renderer); ValueAxis rangeAxis = plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); rangeAxis.setLowerMargin(0.15); rangeAxis.setUpperMargin(0.15); StackedBarRenderer renderer2 = (StackedBarRenderer) plot.getRenderer(); renderer2.setLegendItemLabelGenerator(new SOCRCategorySeriesLabelGenerator()); setCategorySummary(dataset); return chart; }
/** * Returns the chart. * * @param dataset the dataset. * * @return The chart. */ protected JFreeChart createChart(CategoryDataset dataset) { JFreeChart chart = ChartFactory.createBarChart( chartTitle, domainLabel, rangeLabel, dataset, PlotOrientation.VERTICAL, false, //!legendPanelOn, true, false ); chart.setBackgroundPaint(Color.white); CategoryPlot plot = chart.getCategoryPlot(); plot.setBackgroundPaint(Color.lightGray); plot.setRangeGridlinePaint(Color.white); plot.setRangeGridlinesVisible(true); plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0)); ValueAxis rangeAxis = plot.getRangeAxis(); BarRenderer renderer = (BarRenderer) plot.getRenderer(); renderer.setDrawBarOutline(false); renderer.setLegendItemLabelGenerator(new SOCRCategorySeriesLabelGenerator()); DecimalFormat labelFormatter = new DecimalFormat("##,###.##"); labelFormatter.setNegativePrefix("("); labelFormatter.setNegativeSuffix(")"); renderer.setBaseItemLabelGenerator( new StandardCategoryItemLabelGenerator("{2}", labelFormatter) ); renderer.setBaseItemLabelsVisible(true); //setCategorySummary(dataset); return chart; }
private JFreeChart createChart(IntervalCategoryDataset paramIntervalCategoryDataset) { JFreeChart localJFreeChart = ChartFactory.createGanttChart(this.chartTitle, this.domainAxisLabel, this.rangeAxisLabel, paramIntervalCategoryDataset, true, true, false); CategoryPlot localCategoryPlot = (CategoryPlot) localJFreeChart.getPlot(); GanttRenderer localGanttRenderer = (GanttRenderer) localCategoryPlot.getRenderer(); ChartUtil.hideLegend(localCategoryPlot); StandardCategoryItemLabelGenerator localStandardCategoryItemLabelGenerator = new StandardCategoryItemLabelGenerator(); localGanttRenderer.setBaseItemLabelGenerator(localStandardCategoryItemLabelGenerator); localGanttRenderer.setBaseItemLabelsVisible(true); ItemLabelPosition localItemLabelPosition = new ItemLabelPosition(ItemLabelAnchor.CENTER, TextAnchor.CENTER); localGanttRenderer.setBasePositiveItemLabelPosition(localItemLabelPosition); ChartUtil.setNiceSeriesColors(paramIntervalCategoryDataset, localGanttRenderer); return localJFreeChart; }