org.jfree.data.gantt.GanttCategoryDataset Java Examples

The following examples show how to use org.jfree.data.gantt.GanttCategoryDataset. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GanttRenderer.java    From openstock with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Draws the bar for a single (series, category) data item.
 *
 * @param g2  the graphics device.
 * @param state  the renderer state.
 * @param dataArea  the data area.
 * @param plot  the plot.
 * @param domainAxis  the domain axis.
 * @param rangeAxis  the range axis.
 * @param dataset  the dataset.
 * @param row  the row index (zero-based).
 * @param column  the column index (zero-based).
 * @param pass  the pass index.
 */
@Override
public void drawItem(Graphics2D g2, CategoryItemRendererState state,
        Rectangle2D dataArea, CategoryPlot plot, CategoryAxis domainAxis,
        ValueAxis rangeAxis, CategoryDataset dataset, int row,
        int column, int pass) {

     if (dataset instanceof GanttCategoryDataset) {
         GanttCategoryDataset gcd = (GanttCategoryDataset) dataset;
         drawTasks(g2, state, dataArea, plot, domainAxis, rangeAxis, gcd,
                 row, column);
     }
     else {  // let the superclass handle it...
         super.drawItem(g2, state, dataArea, plot, domainAxis, rangeAxis,
                 dataset, row, column, pass);
     }

 }
 
Example #2
Source File: GanttRenderer.java    From ccu-historian with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Draws the bar for a single (series, category) data item.
 *
 * @param g2  the graphics device.
 * @param state  the renderer state.
 * @param dataArea  the data area.
 * @param plot  the plot.
 * @param domainAxis  the domain axis.
 * @param rangeAxis  the range axis.
 * @param dataset  the dataset.
 * @param row  the row index (zero-based).
 * @param column  the column index (zero-based).
 * @param pass  the pass index.
 */
@Override
public void drawItem(Graphics2D g2, CategoryItemRendererState state,
        Rectangle2D dataArea, CategoryPlot plot, CategoryAxis domainAxis,
        ValueAxis rangeAxis, CategoryDataset dataset, int row,
        int column, int pass) {

     if (dataset instanceof GanttCategoryDataset) {
         GanttCategoryDataset gcd = (GanttCategoryDataset) dataset;
         drawTasks(g2, state, dataArea, plot, domainAxis, rangeAxis, gcd,
                 row, column);
     }
     else {  // let the superclass handle it...
         super.drawItem(g2, state, dataArea, plot, domainAxis, rangeAxis,
                 dataset, row, column, pass);
     }

 }
 
Example #3
Source File: GanttRenderer.java    From SIMVA-SoS with Apache License 2.0 6 votes vote down vote up
/**
 * Draws the bar for a single (series, category) data item.
 *
 * @param g2  the graphics device.
 * @param state  the renderer state.
 * @param dataArea  the data area.
 * @param plot  the plot.
 * @param domainAxis  the domain axis.
 * @param rangeAxis  the range axis.
 * @param dataset  the dataset.
 * @param row  the row index (zero-based).
 * @param column  the column index (zero-based).
 * @param pass  the pass index.
 */
@Override
public void drawItem(Graphics2D g2, CategoryItemRendererState state,
        Rectangle2D dataArea, CategoryPlot plot, CategoryAxis domainAxis,
        ValueAxis rangeAxis, CategoryDataset dataset, int row,
        int column, int pass) {

     if (dataset instanceof GanttCategoryDataset) {
         GanttCategoryDataset gcd = (GanttCategoryDataset) dataset;
         drawTasks(g2, state, dataArea, plot, domainAxis, rangeAxis, gcd,
                 row, column);
     }
     else {  // let the superclass handle it...
         super.drawItem(g2, state, dataArea, plot, domainAxis, rangeAxis,
                 dataset, row, column, pass);
     }

 }
 
Example #4
Source File: GanttRenderer.java    From ECG-Viewer with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Draws the bar for a single (series, category) data item.
 *
 * @param g2  the graphics device.
 * @param state  the renderer state.
 * @param dataArea  the data area.
 * @param plot  the plot.
 * @param domainAxis  the domain axis.
 * @param rangeAxis  the range axis.
 * @param dataset  the dataset.
 * @param row  the row index (zero-based).
 * @param column  the column index (zero-based).
 * @param pass  the pass index.
 */
@Override
public void drawItem(Graphics2D g2, CategoryItemRendererState state,
        Rectangle2D dataArea, CategoryPlot plot, CategoryAxis domainAxis,
        ValueAxis rangeAxis, CategoryDataset dataset, int row,
        int column, int pass) {

     if (dataset instanceof GanttCategoryDataset) {
         GanttCategoryDataset gcd = (GanttCategoryDataset) dataset;
         drawTasks(g2, state, dataArea, plot, domainAxis, rangeAxis, gcd,
                 row, column);
     }
     else {  // let the superclass handle it...
         super.drawItem(g2, state, dataArea, plot, domainAxis, rangeAxis,
                 dataset, row, column, pass);
     }

 }
 
Example #5
Source File: GanttRenderer.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Draws the bar for a single (series, category) data item.
 *
 * @param g2  the graphics device.
 * @param state  the renderer state.
 * @param dataArea  the data area.
 * @param plot  the plot.
 * @param domainAxis  the domain axis.
 * @param rangeAxis  the range axis.
 * @param dataset  the dataset.
 * @param row  the row index (zero-based).
 * @param column  the column index (zero-based).
 * @param pass  the pass index.
 */
public void drawItem(Graphics2D g2, CategoryItemRendererState state,
        Rectangle2D dataArea, CategoryPlot plot, CategoryAxis domainAxis,
        ValueAxis rangeAxis, CategoryDataset dataset, int row, int column,
        boolean selected, int pass) {

     if (dataset instanceof GanttCategoryDataset) {
         GanttCategoryDataset gcd = (GanttCategoryDataset) dataset;
         drawTasks(g2, state, dataArea, plot, domainAxis, rangeAxis, gcd,
                 row, column, selected);
     }
     else {  // let the superclass handle it...
         super.drawItem(g2, state, dataArea, plot, domainAxis, rangeAxis,
                 dataset, row, column, selected, pass);
     }

 }
 
Example #6
Source File: GanttRenderer.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Draws the bar for a single (series, category) data item.
 *
 * @param g2  the graphics device.
 * @param state  the renderer state.
 * @param dataArea  the data area.
 * @param plot  the plot.
 * @param domainAxis  the domain axis.
 * @param rangeAxis  the range axis.
 * @param dataset  the dataset.
 * @param row  the row index (zero-based).
 * @param column  the column index (zero-based).
 * @param pass  the pass index.
 */
public void drawItem(Graphics2D g2,
                     CategoryItemRendererState state,
                     Rectangle2D dataArea,
                     CategoryPlot plot,
                     CategoryAxis domainAxis,
                     ValueAxis rangeAxis,
                     CategoryDataset dataset,
                     int row,
                     int column,
                     int pass) {

     if (dataset instanceof GanttCategoryDataset) {
         GanttCategoryDataset gcd = (GanttCategoryDataset) dataset;
         drawTasks(g2, state, dataArea, plot, domainAxis, rangeAxis, gcd, 
                 row, column);
     }
     else {  // let the superclass handle it...
         super.drawItem(g2, state, dataArea, plot, domainAxis, rangeAxis, 
                 dataset, row, column, pass);
     }
 
 }
 
Example #7
Source File: GanttRenderer.java    From buffer_bci with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Draws the bar for a single (series, category) data item.
 *
 * @param g2  the graphics device.
 * @param state  the renderer state.
 * @param dataArea  the data area.
 * @param plot  the plot.
 * @param domainAxis  the domain axis.
 * @param rangeAxis  the range axis.
 * @param dataset  the dataset.
 * @param row  the row index (zero-based).
 * @param column  the column index (zero-based).
 * @param pass  the pass index.
 */
@Override
public void drawItem(Graphics2D g2, CategoryItemRendererState state,
        Rectangle2D dataArea, CategoryPlot plot, CategoryAxis domainAxis,
        ValueAxis rangeAxis, CategoryDataset dataset, int row,
        int column, int pass) {

     if (dataset instanceof GanttCategoryDataset) {
         GanttCategoryDataset gcd = (GanttCategoryDataset) dataset;
         drawTasks(g2, state, dataArea, plot, domainAxis, rangeAxis, gcd,
                 row, column);
     }
     else {  // let the superclass handle it...
         super.drawItem(g2, state, dataArea, plot, domainAxis, rangeAxis,
                 dataset, row, column, pass);
     }

 }
 
Example #8
Source File: GanttRenderer.java    From buffer_bci with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Draws the bar for a single (series, category) data item.
 *
 * @param g2  the graphics device.
 * @param state  the renderer state.
 * @param dataArea  the data area.
 * @param plot  the plot.
 * @param domainAxis  the domain axis.
 * @param rangeAxis  the range axis.
 * @param dataset  the dataset.
 * @param row  the row index (zero-based).
 * @param column  the column index (zero-based).
 * @param pass  the pass index.
 */
@Override
public void drawItem(Graphics2D g2, CategoryItemRendererState state,
        Rectangle2D dataArea, CategoryPlot plot, CategoryAxis domainAxis,
        ValueAxis rangeAxis, CategoryDataset dataset, int row,
        int column, int pass) {

     if (dataset instanceof GanttCategoryDataset) {
         GanttCategoryDataset gcd = (GanttCategoryDataset) dataset;
         drawTasks(g2, state, dataArea, plot, domainAxis, rangeAxis, gcd,
                 row, column);
     }
     else {  // let the superclass handle it...
         super.drawItem(g2, state, dataArea, plot, domainAxis, rangeAxis,
                 dataset, row, column, pass);
     }

 }
 
Example #9
Source File: GanttRenderer.java    From opensim-gui with Apache License 2.0 5 votes vote down vote up
/**
 * Draws the bar for a single (series, category) data item.
 *
 * @param g2  the graphics device.
 * @param state  the renderer state.
 * @param dataArea  the data area.
 * @param plot  the plot.
 * @param domainAxis  the domain axis.
 * @param rangeAxis  the range axis.
 * @param dataset  the dataset.
 * @param row  the row index (zero-based).
 * @param column  the column index (zero-based).
 * @param pass  the pass index.
 */
public void drawItem(Graphics2D g2,
                     CategoryItemRendererState state,
                     Rectangle2D dataArea,
                     CategoryPlot plot,
                     CategoryAxis domainAxis,
                     ValueAxis rangeAxis,
                     CategoryDataset dataset,
                     int row,
                     int column,
                     int pass) {

     if (dataset instanceof GanttCategoryDataset) {
         GanttCategoryDataset gcd = (GanttCategoryDataset) dataset;
         drawTasks(
            g2, state, dataArea, plot, domainAxis, rangeAxis, gcd, 
            row, column
         );
     }
     else {  // let the superclass handle it...
         super.drawItem(
             g2, state, dataArea, plot, domainAxis, rangeAxis, 
             dataset, row, column, pass
         );
     }
 
 }
 
Example #10
Source File: DefaultChartTheme.java    From jasperreports with GNU Lesser General Public License v3.0 4 votes vote down vote up
/**
 *
 */
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();
	boolean isShowTickLabels = barPlot.getShowTickLabels() == null ? true : barPlot.getShowTickLabels();
	boolean isShowLabels = barPlot.getShowLabels() == null ? false : barPlot.getShowLabels();
	
	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;
}
 
Example #11
Source File: GenericChartTheme.java    From jasperreports with GNU Lesser General Public License v3.0 4 votes vote down vote up
/**
 *
 */
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, getPlot());
	
	CategoryPlot categoryPlot = (CategoryPlot)jfreeChart.getPlot();
	//plot.setNoDataMessage("No data to display");
	
	JRBarPlot barPlot = (JRBarPlot)getPlot();
	boolean isShowTickMarks = barPlot.getShowTickMarks() == null ? true : barPlot.getShowTickMarks();
	boolean isShowTickLabels = barPlot.getShowTickLabels() == null ? true : barPlot.getShowTickLabels();
	boolean isShowLabels = barPlot.getShowLabels() == null ? false : barPlot.getShowLabels();
	
	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.getOwnCategoryAxisLineColor(), 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.getOwnValueAxisLineColor(), true,
		(Comparable<?>)evaluateExpression(barPlot.getRangeAxisMinValueExpression()),
		(Comparable<?>)evaluateExpression(barPlot.getRangeAxisMaxValueExpression()));

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

	return jfreeChart;
}
 
Example #12
Source File: SimpleChartTheme.java    From jasperreports with GNU Lesser General Public License v3.0 4 votes vote down vote up
/**
 *
 */
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, getPlot());
	
	CategoryPlot categoryPlot = (CategoryPlot)jfreeChart.getPlot();
	//plot.setNoDataMessage("No data to display");
	
	JRBarPlot barPlot = (JRBarPlot)getPlot();
	boolean isShowTickMarks = barPlot.getShowTickMarks() == null ? true : barPlot.getShowTickMarks();
	boolean isShowTickLabels = barPlot.getShowTickLabels() == null ? true : barPlot.getShowTickLabels();
	boolean isShowLabels = barPlot.getShowLabels() == null ? false : barPlot.getShowLabels();
	
	//FIXMETHEME these are useless if the theme settings apply after regardless of these; check all
	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.getOwnCategoryAxisLineColor(), getDomainAxisSettings(), 
		(Comparable<?>)evaluateExpression(barPlot.getDomainAxisMinValueExpression()), 
		(Comparable<?>)evaluateExpression(barPlot.getDomainAxisMaxValueExpression())
		);

	((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.getOwnValueAxisLineColor(), getRangeAxisSettings(),
		(Comparable<?>)evaluateExpression(barPlot.getRangeAxisMinValueExpression()), 
		(Comparable<?>)evaluateExpression(barPlot.getRangeAxisMaxValueExpression())
		);

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

	return jfreeChart;
}