本文整理汇总了Java中org.jfree.chart.renderer.category.GanttRenderer类的典型用法代码示例。如果您正苦于以下问题:Java GanttRenderer类的具体用法?Java GanttRenderer怎么用?Java GanttRenderer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GanttRenderer类属于org.jfree.chart.renderer.category包,在下文中一共展示了GanttRenderer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testEquals
import org.jfree.chart.renderer.category.GanttRenderer; //导入依赖的package包/类
/**
* Check that the equals() method distinguishes all fields.
*/
public void testEquals() {
GanttRenderer r1 = new GanttRenderer();
GanttRenderer r2 = new GanttRenderer();
assertEquals(r1, r2);
r1.setCompletePaint(Color.yellow);
assertFalse(r1.equals(r2));
r2.setCompletePaint(Color.yellow);
assertTrue(r1.equals(r2));
r1.setIncompletePaint(Color.green);
assertFalse(r1.equals(r2));
r2.setIncompletePaint(Color.green);
assertTrue(r1.equals(r2));
r1.setStartPercent(0.11);
assertFalse(r1.equals(r2));
r2.setStartPercent(0.11);
assertTrue(r1.equals(r2));
r1.setEndPercent(0.88);
assertFalse(r1.equals(r2));
r2.setEndPercent(0.88);
assertTrue(r1.equals(r2));
}
示例2: testEquals
import org.jfree.chart.renderer.category.GanttRenderer; //导入依赖的package包/类
/**
* Check that the equals() method distinguishes all fields.
*/
public void testEquals() {
GanttRenderer r1 = new GanttRenderer();
GanttRenderer r2 = new GanttRenderer();
assertEquals(r1, r2);
r1.setCompletePaint(Color.yellow);
assertFalse(r1.equals(r2));
r2.setCompletePaint(Color.yellow);
assertTrue(r1.equals(r2));
r1.setIncompletePaint(Color.green);
assertFalse(r1.equals(r2));
r2.setIncompletePaint(Color.green);
assertTrue(r1.equals(r2));
r1.setStartPercent(0.11);
assertFalse(r1.equals(r2));
r2.setStartPercent(0.11);
assertTrue(r1.equals(r2));
r1.setEndPercent(0.88);
assertFalse(r1.equals(r2));
r2.setEndPercent(0.88);
assertTrue(r1.equals(r2));
}
示例3: createGanttChart
import org.jfree.chart.renderer.category.GanttRenderer; //导入依赖的package包/类
/**
* Creates a Gantt chart using the supplied attributes plus default values
* where required. The chart object returned by this method uses a
* {@link CategoryPlot} instance as the plot, with a {@link CategoryAxis}
* for the domain axis, a {@link DateAxis} as the range axis, and a
* {@link GanttRenderer} as the renderer.
*
* @param title the chart title (<code>null</code> permitted).
* @param categoryAxisLabel the label for the category axis
* (<code>null</code> permitted).
* @param dateAxisLabel the label for the date axis
* (<code>null</code> permitted).
* @param dataset the dataset for the chart (<code>null</code> permitted).
* @param legend a flag specifying whether or not a legend is required.
*
* @return A Gantt chart.
*/
public static JFreeChart createGanttChart(String title,
String categoryAxisLabel, String dateAxisLabel,
IntervalCategoryDataset dataset, boolean legend) {
CategoryAxis categoryAxis = new CategoryAxis(categoryAxisLabel);
DateAxis dateAxis = new DateAxis(dateAxisLabel);
CategoryItemRenderer renderer = new GanttRenderer();
renderer.setBaseToolTipGenerator(
new IntervalCategoryToolTipGenerator(
"{3} - {4}", DateFormat.getDateInstance()));
CategoryPlot plot = new CategoryPlot(dataset, categoryAxis, dateAxis,
renderer);
plot.setOrientation(PlotOrientation.HORIZONTAL);
JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
plot, legend);
currentTheme.apply(chart);
return chart;
}
示例4: createGanttChart
import org.jfree.chart.renderer.category.GanttRenderer; //导入依赖的package包/类
/**
* Creates a Gantt chart using the supplied attributes plus default values where required.
* <P>
* The chart object returned by this method uses a {@link CategoryPlot} instance as the
* plot, with a {@link CategoryAxis} for the domain axis, a {@link DateAxis} as the
* range axis, and a {@link GanttRenderer} as the renderer.
*
* @param title the chart title (<code>null</code> permitted).
* @param categoryAxisLabel the label for the category axis (<code>null</code> permitted).
* @param dateAxisLabel the label for the date axis (<code>null</code> permitted).
* @param dataset the dataset for the chart (<code>null</code> permitted).
* @param legend a flag specifying whether or not a legend is required.
* @param tooltips configure chart to generate tool tips?
* @param urls configure chart to generate URLs?
*
* @return A Gantt chart.
*/
public static JFreeChart createGanttChart(String title,
String categoryAxisLabel,
String dateAxisLabel,
IntervalCategoryDataset dataset,
boolean legend,
boolean tooltips,
boolean urls) {
CategoryAxis categoryAxis = new CategoryAxis(categoryAxisLabel);
DateAxis dateAxis = new DateAxis(dateAxisLabel);
CategoryItemRenderer renderer = new GanttRenderer();
if (tooltips) {
renderer.setToolTipGenerator(
new IntervalCategoryToolTipGenerator("{3} - {4}", DateFormat.getDateInstance())
);
}
if (urls) {
renderer.setItemURLGenerator(new StandardCategoryURLGenerator());
}
CategoryPlot plot = new CategoryPlot(dataset, categoryAxis, dateAxis, renderer);
plot.setOrientation(PlotOrientation.HORIZONTAL);
JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend);
return chart;
}
示例5: testEquals
import org.jfree.chart.renderer.category.GanttRenderer; //导入依赖的package包/类
/**
* Problem that the equals(...) method distinguishes all fields.
*/
public void testEquals() {
GanttRenderer r1 = new GanttRenderer();
GanttRenderer r2 = new GanttRenderer();
assertEquals(r1, r2);
}
示例6: testHashcode
import org.jfree.chart.renderer.category.GanttRenderer; //导入依赖的package包/类
/**
* Two objects that are equal are required to return the same hashCode.
*/
public void testHashcode() {
GanttRenderer r1 = new GanttRenderer();
GanttRenderer r2 = new GanttRenderer();
assertTrue(r1.equals(r2));
int h1 = r1.hashCode();
int h2 = r2.hashCode();
assertEquals(h1, h2);
}
示例7: createGanttChart
import org.jfree.chart.renderer.category.GanttRenderer; //导入依赖的package包/类
/**
* Creates a Gantt chart using the supplied attributes plus default values
* where required. The chart object returned by this method uses a
* {@link CategoryPlot} instance as the plot, with a {@link CategoryAxis}
* for the domain axis, a {@link DateAxis} as the range axis, and a
* {@link GanttRenderer} as the renderer.
*
* @param title the chart title (<code>null</code> permitted).
* @param categoryAxisLabel the label for the category axis
* (<code>null</code> permitted).
* @param dateAxisLabel the label for the date axis
* (<code>null</code> permitted).
* @param dataset the dataset for the chart (<code>null</code> permitted).
* @param legend a flag specifying whether or not a legend is required.
* @param tooltips configure chart to generate tool tips?
* @param urls configure chart to generate URLs?
*
* @return A Gantt chart.
*/
public static JFreeChart createGanttChart(String title,
String categoryAxisLabel,
String dateAxisLabel,
IntervalCategoryDataset dataset,
boolean legend,
boolean tooltips,
boolean urls) {
CategoryAxis categoryAxis = new CategoryAxis(categoryAxisLabel);
DateAxis dateAxis = new DateAxis(dateAxisLabel);
CategoryItemRenderer renderer = new GanttRenderer();
if (tooltips) {
renderer.setBaseToolTipGenerator(
new IntervalCategoryToolTipGenerator(
"{3} - {4}", DateFormat.getDateInstance()));
}
if (urls) {
renderer.setBaseItemURLGenerator(
new StandardCategoryURLGenerator());
}
CategoryPlot plot = new CategoryPlot(dataset, categoryAxis, dateAxis,
renderer);
plot.setOrientation(PlotOrientation.HORIZONTAL);
JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
plot, legend);
return chart;
}
示例8: createGanttChart
import org.jfree.chart.renderer.category.GanttRenderer; //导入依赖的package包/类
/**
* Creates a Gantt chart using the supplied attributes plus default values
* where required. The chart object returned by this method uses a
* {@link CategoryPlot} instance as the plot, with a {@link CategoryAxis}
* for the domain axis, a {@link DateAxis} as the range axis, and a
* {@link GanttRenderer} as the renderer.
*
* @param title the chart title (<code>null</code> permitted).
* @param categoryAxisLabel the label for the category axis
* (<code>null</code> permitted).
* @param dateAxisLabel the label for the date axis
* (<code>null</code> permitted).
* @param dataset the dataset for the chart (<code>null</code> permitted).
* @param legend a flag specifying whether or not a legend is required.
* @param tooltips configure chart to generate tool tips?
* @param urls configure chart to generate URLs?
*
* @return A Gantt chart.
*/
public static JFreeChart createGanttChart(String title,
String categoryAxisLabel, String dateAxisLabel,
IntervalCategoryDataset dataset, boolean legend, boolean tooltips,
boolean urls) {
CategoryAxis categoryAxis = new CategoryAxis(categoryAxisLabel);
DateAxis dateAxis = new DateAxis(dateAxisLabel);
CategoryItemRenderer renderer = new GanttRenderer();
if (tooltips) {
renderer.setBaseToolTipGenerator(
new IntervalCategoryToolTipGenerator(
"{3} - {4}", DateFormat.getDateInstance()));
}
if (urls) {
renderer.setBaseItemURLGenerator(
new StandardCategoryURLGenerator());
}
CategoryPlot plot = new CategoryPlot(dataset, categoryAxis, dateAxis,
renderer);
plot.setOrientation(PlotOrientation.HORIZONTAL);
JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
plot, legend);
currentTheme.apply(chart);
return chart;
}
示例9: createGanttChart
import org.jfree.chart.renderer.category.GanttRenderer; //导入依赖的package包/类
/**
* Creates a Gantt chart using the supplied attributes plus default values
* where required. The chart object returned by this method uses a
* {@link CategoryPlot} instance as the plot, with a {@link CategoryAxis}
* for the domain axis, a {@link DateAxis} as the range axis, and a
* {@link GanttRenderer} as the renderer.
*
* @param title the chart title ({@code null} permitted).
* @param categoryAxisLabel the label for the category axis
* ({@code null} permitted).
* @param dateAxisLabel the label for the date axis
* ({@code null} permitted).
* @param dataset the dataset for the chart ({@code null} permitted).
* @param legend a flag specifying whether or not a legend is required.
* @param tooltips configure chart to generate tool tips?
* @param urls configure chart to generate URLs?
*
* @return A Gantt chart.
*/
public static JFreeChart createGanttChart(String title,
String categoryAxisLabel, String dateAxisLabel,
IntervalCategoryDataset dataset, boolean legend, boolean tooltips,
boolean urls) {
CategoryAxis categoryAxis = new CategoryAxis(categoryAxisLabel);
DateAxis dateAxis = new DateAxis(dateAxisLabel);
CategoryItemRenderer renderer = new GanttRenderer();
if (tooltips) {
renderer.setDefaultToolTipGenerator(
new IntervalCategoryToolTipGenerator(
"{3} - {4}", DateFormat.getDateInstance()));
}
if (urls) {
renderer.setDefaultItemURLGenerator(
new StandardCategoryURLGenerator());
}
CategoryPlot plot = new CategoryPlot(dataset, categoryAxis, dateAxis,
renderer);
plot.setOrientation(PlotOrientation.HORIZONTAL);
JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
plot, legend);
currentTheme.apply(chart);
return chart;
}
示例10: createGanttChart
import org.jfree.chart.renderer.category.GanttRenderer; //导入依赖的package包/类
/**
* Creates a Gantt chart using the supplied attributes plus default values
* where required. The chart object returned by this method uses a
* {@link CategoryPlot} instance as the plot, with a {@link CategoryAxis}
* for the domain axis, a {@link DateAxis} as the range axis, and a
* {@link GanttRenderer} as the renderer.
*
* @param title the chart title (<code>null</code> permitted).
* @param categoryAxisLabel the label for the category axis
* (<code>null</code> permitted).
* @param dateAxisLabel the label for the date axis
* (<code>null</code> permitted).
* @param dataset the dataset for the chart (<code>null</code> permitted).
* @param legend a flag specifying whether or not a legend is required.
* @param tooltips configure chart to generate tool tips?
* @param urls configure chart to generate URLs?
*
* @return A Gantt chart.
*/
public static JFreeChart createGanttChart(String title,
String categoryAxisLabel,
String dateAxisLabel,
IntervalCategoryDataset dataset,
boolean legend,
boolean tooltips,
boolean urls) {
CategoryAxis categoryAxis = new CategoryAxis(categoryAxisLabel);
DateAxis dateAxis = new DateAxis(dateAxisLabel);
CategoryItemRenderer renderer = new GanttRenderer();
if (tooltips) {
renderer.setBaseToolTipGenerator(
new IntervalCategoryToolTipGenerator(
"{3} - {4}", DateFormat.getDateInstance()));
}
if (urls) {
renderer.setBaseItemURLGenerator(
new StandardCategoryURLGenerator());
}
CategoryPlot plot = new CategoryPlot(dataset, categoryAxis, dateAxis,
renderer);
plot.setOrientation(PlotOrientation.HORIZONTAL);
JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
plot, legend);
currentTheme.apply(chart);
return chart;
}
示例11: PlotActivityNetworkGantt
import org.jfree.chart.renderer.category.GanttRenderer; //导入依赖的package包/类
/**
* Create a new Gantt JFrame
* @param s {@link ActivityNetworkSolver} to be plotted as Gantt
* @param selectedVariables {@link Vector} of {@link ActivityNetworkSolver}'s component names (variable names) that will be plotted.
* @param n {@link JFrame} title
*/
public PlotActivityNetworkGantt(ActivityNetworkSolver s, Vector<String> selectedVariables, String n ) {
super(n);
this.solver = s;
this.selectedVariables = selectedVariables;
GanttRenderer renderer = new GanttRenderer();
renderer.setBaseItemLabelFont(new Font("Tahoma", Font.PLAIN, 11));
JFreeChart chart = ChartFactory.createGanttChart(null,// "Channel", //
"Activities & Resources", // domain axis label
null, // "Time", // range axis label
createDataset(), // data
false, // do not include legend
false, // no tooltips
false // urls
);
chart.getCategoryPlot().setRenderer(renderer);
renderer.setSeriesPaint(0, Color.green.darker());
renderer.setSeriesPaint(1, Color.red.darker());
renderer.setItemMargin(-0.5);
chart.getCategoryPlot().setRangeAxis(new NumberAxis());
chart.getCategoryPlot().getRangeAxis().setLabelFont(new Font("Arial", Font.PLAIN, 14));
chart.getCategoryPlot().getDomainAxis().setLabelFont(new Font("Arial", Font.PLAIN, 14));
chart.getCategoryPlot().getDomainAxis().setTickLabelsVisible(true);
chart.getCategoryPlot().getRangeAxis().setAutoRange(false);
chartPanel = new ChartPanel(chart);
chartPanel.setDomainZoomable(true);
chartPanel.setRangeZoomable(true);
setContentPane(new JScrollPane(chartPanel));
this.setPreferredSize(new Dimension(800,600));
this.setSize(new Dimension(800,600));
this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
this.setVisible(true);
}
示例12: createChart
import org.jfree.chart.renderer.category.GanttRenderer; //导入依赖的package包/类
private JFreeChart createChart(IntervalCategoryDataset paramIntervalCategoryDataset) {
JFreeChart localJFreeChart = ChartFactory.createGanttChart(I18N.getMsg("msg.chart.gantt.characters.title"), I18N.getMsg("msg.common.person"), I18N.getMsg("msg.common.date"), paramIntervalCategoryDataset, true, true, false);
CategoryPlot localCategoryPlot = (CategoryPlot) localJFreeChart.getPlot();
GanttRenderer localGanttRenderer = (GanttRenderer) localCategoryPlot.getRenderer();
BookModel localDocumentModel = this.mainFrame.getBookModel();
Session localSession = localDocumentModel.beginTransaction();
SceneDAOImpl localSceneDAOImpl = new SceneDAOImpl(localSession);
Date localDate1 = localSceneDAOImpl.findFirstDate();
Date localDate2 = localSceneDAOImpl.findLastDate();
localDocumentModel.commit();
localCategoryPlot.addRangeMarker(ChartUtil.getDateIntervalMarker(localDate1, localDate2, I18N.getMsg("msg.chart.common.project.duration")), Layer.BACKGROUND);
ChartUtil.setNiceSeriesColors(paramIntervalCategoryDataset, localGanttRenderer);
return localJFreeChart;
}
示例13: createChart
import org.jfree.chart.renderer.category.GanttRenderer; //导入依赖的package包/类
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;
}
示例14: testHashcode
import org.jfree.chart.renderer.category.GanttRenderer; //导入依赖的package包/类
/**
* Two objects that are equal are required to return the same hashCode.
*/
public void testHashcode() {
GanttRenderer r1 = new GanttRenderer();
GanttRenderer r2 = new GanttRenderer();
assertTrue(r1.equals(r2));
int h1 = r1.hashCode();
int h2 = r2.hashCode();
assertEquals(h1, h2);
}
示例15: test
import org.jfree.chart.renderer.category.GanttRenderer; //导入依赖的package包/类
@Override
public void test() {
super.test();
numberOfPagesTest(1);
JFreeChart chart = getChart("summary.chart1", 0);
CategoryPlot categoryPlot = chart.getCategoryPlot();
Assert.assertEquals("renderer", GanttRenderer.class, categoryPlot.getRenderer().getClass());
Assert.assertTrue("show labels", categoryPlot.getRenderer().getBaseItemLabelsVisible());
Assert.assertFalse("show tick labels", categoryPlot.getDomainAxis().isTickMarksVisible());
Assert.assertFalse("show tick marks", categoryPlot.getDomainAxis().isTickLabelsVisible());
ganttChartDataTest(chart, "label", new String[] {"task1", "task2", "task3"}, new Object[][] {{toDate(2011, 1, 1), toDate(2011, 1, 8), 1d}, {toDate(2011, 1, 10), toDate(2011, 1, 15), 0.5d}, {toDate(2011, 1, 15), toDate(2011, 1, 25), 0.8d}});
ganttChartDataTest(chart, "serie1", new String[] {"task1", "task2", "task3"}, new Object[][] {{toDate(2011, 1, 2), toDate(2011, 1, 9), null}, {toDate(2011, 1, 8), toDate(2011, 1, 14), null}, {toDate(2011, 1, 16), toDate(2011, 1, 20), null}});
chart = getChart("summary.chart2", 0);
Axis axis = chart.getCategoryPlot().getDomainAxis();
Assert.assertEquals("task label", "task", axis.getLabel());
Assert.assertEquals("task label color", Color.BLUE, axis.getLabelPaint());
Assert.assertEquals("task label font", new Font("Arial", Font.BOLD, 10), axis.getLabelFont());
Assert.assertEquals("tick label color", Color.CYAN, axis.getTickLabelPaint());
Assert.assertEquals("tick label font", new Font("Arial", Font.ITALIC, 10), axis.getTickLabelFont());
CategoryLabelPosition labelPosition = chart.getCategoryPlot().getDomainAxis().getCategoryLabelPositions().getLabelPosition(RectangleEdge.LEFT);
Assert.assertEquals("plot label rotation", (45d / 180) * Math.PI, labelPosition.getAngle());
Assert.assertEquals("line color", Color.LIGHT_GRAY, axis.getAxisLinePaint());
chart = getChart("summary.chart3", 0);
axis = chart.getCategoryPlot().getRangeAxis();
Assert.assertEquals("time label", "time", axis.getLabel());
Assert.assertEquals("time label color", Color.BLUE, axis.getLabelPaint());
Assert.assertEquals("time label font", new Font("Arial", Font.BOLD, 10), axis.getLabelFont());
Assert.assertEquals("tick label color", Color.CYAN, axis.getTickLabelPaint());
Assert.assertEquals("tick label font", new Font("Arial", Font.ITALIC, 10), axis.getTickLabelFont());
Assert.assertEquals("line color", Color.LIGHT_GRAY, axis.getAxisLinePaint());
}