Java 类org.jfree.chart.renderer.category.GanttRenderer 实例源码

项目:parabuild-ci    文件:GanttRendererTests.java   
/**
 * 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));
}
项目:nabs    文件:GanttRendererTests.java   
/**
 * 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));
}
项目:astor    文件:GanttRendererTests.java   
/**
 * 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));
}
项目:astor    文件:ChartFactory.java   
/**
 * 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;

}
项目:parabuild-ci    文件:ChartFactory.java   
/**
 * 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;

}
项目:parabuild-ci    文件:GanttRendererTests.java   
/**
 * Problem that the equals(...) method distinguishes all fields.
 */
public void testEquals() {
    GanttRenderer r1 = new GanttRenderer();
    GanttRenderer r2 = new GanttRenderer();
    assertEquals(r1, r2);

}
项目:parabuild-ci    文件:GanttRendererTests.java   
/**
 * 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);
}
项目:parabuild-ci    文件:GanttRendererTests.java   
/**
 * 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);
}
项目:parabuild-ci    文件:ChartFactory.java   
/**
 * 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;

}
项目:ccu-historian    文件:ChartFactory.java   
/**
 * 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;

}
项目:jfreechart    文件:ChartFactory.java   
/**
 * 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;

}
项目:aya-lang    文件:ChartFactory.java   
/**
 * 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;

}
项目:HTML5_WebSite    文件:ChartFactory.java   
/**
 * 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;

}
项目:populus    文件:ChartFactory.java   
/**
 * 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;

}
项目:meta-csp-framework    文件:PlotActivityNetworkGantt.java   
/**
 * 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);
}
项目:PI    文件:ChartFactory.java   
/**
 * 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;

}
项目:oStorybook    文件:GanttChart.java   
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;
}
项目:oStorybook    文件:PersonsByDateChart.java   
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;
}
项目:SE-410-Project    文件:GanttChart.java   
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;
}
项目:SE-410-Project    文件:PersonsByDateChart.java   
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;
}
项目:nabs    文件:GanttRendererTests.java   
/**
 * 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);
}
项目:nabs    文件:ChartFactory.java   
/**
 * 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;

}
项目:ECG-Viewer    文件:ChartFactory.java   
/**
 * 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;

}
项目:astor    文件:GanttRendererTests.java   
/**
 * 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);
}
项目:opensim-gui    文件:ChartFactory.java   
/**
 * 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;

}
项目:group-five    文件:ChartFactory.java   
/**
 * 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;

}
项目:manydesigns.cn    文件:ChartFactory.java   
/**
 * 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;

}
项目:buffer_bci    文件:ChartFactory.java   
/**
 * 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;

}
项目:buffer_bci    文件:ChartFactory.java   
/**
 * 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;

}
项目:proyecto-teoria-control-utn-frro    文件:ChartFactory.java   
/**
 * 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;

}
项目:dynamicreports-jasper    文件:GanttChartTest.java   
@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());
}
项目:Memetic-Algorithm-for-TSP    文件:ChartFactory.java   
/**
 * 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;

}
项目:jasperreports    文件:DefaultChartTheme.java   
/**
 *
 */
protected JFreeChart createGanttChart() throws JRException
{
    //FIXMECHART legend/tooltip/url should come from plot?

    ChartFactory.setChartTheme(StandardChartTheme.createLegacyTheme());
    JFreeChart jfreeChart =
        ChartFactory.createGanttChart(
            evaluateTextExpression(getChart().getTitleExpression()),
            evaluateTextExpression(((JRBarPlot)getPlot()).getCategoryAxisLabelExpression()),
            evaluateTextExpression(((JRBarPlot)getPlot()).getValueAxisLabelExpression()),
            (GanttCategoryDataset)getDataset(),
            isShowLegend(),
            true,  //FIXMECHART tooltip: I guess BarPlot is not the best for gantt
            false
            );

    configureChart(jfreeChart);

    CategoryPlot categoryPlot = (CategoryPlot)jfreeChart.getPlot();
    //plot.setNoDataMessage("No data to display");

    JRBarPlot barPlot = (JRBarPlot)getPlot();
    boolean isShowTickMarks = barPlot.getShowTickMarks() == null ? true : barPlot.getShowTickMarks().booleanValue();
    boolean isShowTickLabels = barPlot.getShowTickLabels() == null ? true : barPlot.getShowTickLabels().booleanValue();
    boolean isShowLabels = barPlot.getShowLabels() == null ? false : barPlot.getShowLabels().booleanValue();

    categoryPlot.getDomainAxis().setTickMarksVisible(isShowTickMarks);
    categoryPlot.getDomainAxis().setTickLabelsVisible(isShowTickLabels);
    // Handle the axis formating for the category axis
    configureAxis(
        categoryPlot.getDomainAxis(), barPlot.getCategoryAxisLabelFont(),
        barPlot.getCategoryAxisLabelColor(), barPlot.getCategoryAxisTickLabelFont(),
        barPlot.getCategoryAxisTickLabelColor(), barPlot.getCategoryAxisTickLabelMask(), barPlot.getCategoryAxisVerticalTickLabels(),
        barPlot.getCategoryAxisLineColor(), false, null, null
        );
    ((DateAxis)categoryPlot.getRangeAxis()).setTickMarksVisible(isShowTickMarks);
    ((DateAxis)categoryPlot.getRangeAxis()).setTickLabelsVisible(isShowTickLabels);
    // Handle the axis formating for the value axis
    configureAxis(
        categoryPlot.getRangeAxis(), barPlot.getValueAxisLabelFont(),
        barPlot.getValueAxisLabelColor(), barPlot.getValueAxisTickLabelFont(),
        barPlot.getValueAxisTickLabelColor(), barPlot.getValueAxisTickLabelMask(), barPlot.getValueAxisVerticalTickLabels(),
        barPlot.getValueAxisLineColor(), true,
        (Comparable<?>)evaluateExpression(barPlot.getRangeAxisMinValueExpression()),
        (Comparable<?>)evaluateExpression(barPlot.getRangeAxisMaxValueExpression()));

    GanttRenderer categoryRenderer = (GanttRenderer)categoryPlot.getRenderer();
    categoryRenderer.setBaseItemLabelGenerator((CategoryItemLabelGenerator)getLabelGenerator());
    categoryRenderer.setBaseItemLabelsVisible(isShowLabels);
    categoryRenderer.setShadowVisible(false);

    return jfreeChart;
}
项目:astor    文件:GanttRendererTests.java   
/**
 * Check that this class implements PublicCloneable.
 */
public void testPublicCloneable() {
    GanttRenderer r1 = new GanttRenderer();
    assertTrue(r1 instanceof PublicCloneable);
}