Package org.jfree.chart.plot

Examples of org.jfree.chart.plot.CategoryPlot


        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();

    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,
        (Comparable)evaluateExpression(barPlot.getDomainAxisMinValueExpression()),
        (Comparable)evaluateExpression(barPlot.getDomainAxisMaxValueExpression()));

    ((NumberAxis)categoryPlot.getRangeAxis()).setTickMarksVisible(isShowTickMarks);
    ((NumberAxis)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()));

    BarRenderer categoryRenderer = (BarRenderer)categoryPlot.getRenderer();
    boolean isShowLabels = barPlot.getShowLabels() == null ? false : barPlot.getShowLabels().booleanValue();
    categoryRenderer.setBaseItemLabelsVisible( isShowLabels );
    if(isShowLabels)
    {
      JRItemLabel itemLabel = barPlot.getItemLabel();
View Full Code Here


        true,
        false);

    configureChart(jfreeChart);

    CategoryPlot categoryPlot = (CategoryPlot)jfreeChart.getPlot();
    JRLinePlot linePlot = (JRLinePlot)getPlot();

    LineAndShapeRenderer lineRenderer = (LineAndShapeRenderer)categoryPlot.getRenderer();
    boolean isShowShapes = linePlot.getShowShapes() == null ? true : linePlot.getShowShapes().booleanValue();
    boolean isShowLines = linePlot.getShowLines() == null ? true : linePlot.getShowLines().booleanValue();
   
    lineRenderer.setBaseShapesVisible( isShowShapes );//FIXMECHART check this
    lineRenderer.setBaseLinesVisible( isShowLines );
   
    //FIXME labels?

    // Handle the axis formating for the category axis
    configureAxis(categoryPlot.getDomainAxis(), linePlot.getCategoryAxisLabelFont(),
        linePlot.getCategoryAxisLabelColor(), linePlot.getCategoryAxisTickLabelFont(),
        linePlot.getCategoryAxisTickLabelColor(), linePlot.getCategoryAxisTickLabelMask(), linePlot.getCategoryAxisVerticalTickLabels(),
        linePlot.getCategoryAxisLineColor(),  false,
        (Comparable)evaluateExpression(linePlot.getDomainAxisMinValueExpression()),
        (Comparable)evaluateExpression(linePlot.getDomainAxisMaxValueExpression()));

    // Handle the axis formating for the value axis
    configureAxis(categoryPlot.getRangeAxis(), linePlot.getValueAxisLabelFont(),
        linePlot.getValueAxisLabelColor(), linePlot.getValueAxisTickLabelFont(),
        linePlot.getValueAxisTickLabelColor(), linePlot.getValueAxisTickLabelMask(), linePlot.getValueAxisVerticalTickLabels(),
        linePlot.getValueAxisLineColor(), true,
        (Comparable)evaluateExpression(linePlot.getRangeAxisMinValueExpression()),
        (Comparable)evaluateExpression(linePlot.getRangeAxisMaxValueExpression()));
View Full Code Here

        false
        );

    configureChart(jfreeChart);

    CategoryPlot categoryPlot = (CategoryPlot)jfreeChart.getPlot();
    JRBar3DPlot bar3DPlot = (JRBar3DPlot)getPlot();

    StackedBarRenderer3D stackedBarRenderer3D =
      new StackedBarRenderer3D(
        bar3DPlot.getXOffsetDouble() == null ? StackedBarRenderer3D.DEFAULT_X_OFFSET : bar3DPlot.getXOffsetDouble().doubleValue(),
        bar3DPlot.getYOffsetDouble() == null ? StackedBarRenderer3D.DEFAULT_Y_OFFSET : bar3DPlot.getYOffsetDouble().doubleValue()
        );

    stackedBarRenderer3D.setBaseItemLabelGenerator((CategoryItemLabelGenerator)getLabelGenerator());
    stackedBarRenderer3D.setBaseItemLabelsVisible(bar3DPlot.getShowLabels() == null ? false : bar3DPlot.getShowLabels().booleanValue());

    categoryPlot.setRenderer(stackedBarRenderer3D);

    // Handle the axis formating for the category axis
    configureAxis(categoryPlot.getDomainAxis(), bar3DPlot.getCategoryAxisLabelFont(),
        bar3DPlot.getCategoryAxisLabelColor(), bar3DPlot.getCategoryAxisTickLabelFont(),
        bar3DPlot.getCategoryAxisTickLabelColor(), bar3DPlot.getCategoryAxisTickLabelMask(), bar3DPlot.getCategoryAxisVerticalTickLabels(),
        bar3DPlot.getCategoryAxisLineColor(), false,
        (Comparable)evaluateExpression(bar3DPlot.getDomainAxisMinValueExpression()),
        (Comparable)evaluateExpression(bar3DPlot.getDomainAxisMaxValueExpression()));

    // Handle the axis formating for the value axis
    configureAxis(categoryPlot.getRangeAxis(), bar3DPlot.getValueAxisLabelFont(),
        bar3DPlot.getValueAxisLabelColor(), bar3DPlot.getValueAxisTickLabelFont(),
        bar3DPlot.getValueAxisTickLabelColor(), bar3DPlot.getValueAxisTickLabelMask(), bar3DPlot.getValueAxisVerticalTickLabels(),
        bar3DPlot.getValueAxisLineColor(), true,
        (Comparable)evaluateExpression(bar3DPlot.getRangeAxisMinValueExpression()),
        (Comparable)evaluateExpression(bar3DPlot.getRangeAxisMaxValueExpression()));
View Full Code Here

        false
        );

    configureChart(jfreeChart);

    CategoryPlot categoryPlot = (CategoryPlot)jfreeChart.getPlot();
    JRBarPlot barPlot = (JRBarPlot)getPlot();
    //plot.setNoDataMessage("No data to display");
    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);
    ((NumberAxis)categoryPlot.getRangeAxis()).setTickMarksVisible(isShowTickMarks);
    ((NumberAxis)categoryPlot.getRangeAxis()).setTickLabelsVisible(isShowTickLabels);

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

    // 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,
        (Comparable)evaluateExpression(barPlot.getDomainAxisMinValueExpression()),
        (Comparable)evaluateExpression(barPlot.getDomainAxisMaxValueExpression()));

    // 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()));
View Full Code Here

        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;
View Full Code Here

    super.configurePlot(plot, jrPlot);

    if(plot instanceof CategoryPlot)
    {
      CategoryPlot categoryPlot = (CategoryPlot)plot;
      CategoryItemRenderer categoryRenderer = categoryPlot.getRenderer();
      CategoryDataset categoryDataset = categoryPlot.getDataset();
      if(categoryDataset != null)
      {
        for(int i = 0; i < categoryDataset.getRowCount(); i++)
        {
          categoryRenderer.setSeriesOutlinePaint(i, ChartThemesConstants.TRANSPARENT_PAINT);
        }
      }
      categoryPlot.setRangeGridlinePaint(ChartThemesConstants.GRAY_PAINT_217);
      categoryPlot.setRangeGridlineStroke(new BasicStroke(0.5f));
      categoryPlot.setDomainGridlinesVisible(false);
      categoryPlot.getDomainAxis().setCategoryLabelPositions(CategoryLabelPositions.UP_45);
    }
    else if(plot instanceof XYPlot)
    {
      XYPlot xyPlot = (XYPlot)plot;
      XYItemRenderer xyItemRenderer = xyPlot.getRenderer();
View Full Code Here

  }

  protected JFreeChart createBar3DChart() throws JRException
  {
    JFreeChart jfreeChart = super.createBar3DChart();
    CategoryPlot categoryPlot = (CategoryPlot)jfreeChart.getPlot();
    BarRenderer3D barRenderer3D = (BarRenderer3D)categoryPlot.getRenderer();
    barRenderer3D.setItemMargin(0);
    barRenderer3D.setWallPaint(ChartThemesConstants.TRANSPARENT_PAINT);
    //categoryPlot.setOrientation(PlotOrientation.HORIZONTAL);
    CategoryDataset categoryDataset = categoryPlot.getDataset();
    if(categoryDataset != null)
    {
      for(int i = 0; i < categoryDataset.getRowCount(); i++)
      {
        barRenderer3D.setSeriesOutlinePaint(i, ChartThemesConstants.TRANSPARENT_PAINT);
View Full Code Here


  protected JFreeChart createStackedBar3DChart() throws JRException
  {
    JFreeChart jfreeChart = super.createStackedBar3DChart();
    CategoryPlot categoryPlot = (CategoryPlot)jfreeChart.getPlot();
    BarRenderer3D barRenderer3D = (BarRenderer3D)categoryPlot.getRenderer();
    barRenderer3D.setWallPaint(ChartThemesConstants.TRANSPARENT_PAINT);
    barRenderer3D.setItemMargin(0);
    CategoryDataset categoryDataset = categoryPlot.getDataset();
    if(categoryDataset != null)
    {
      for(int i = 0; i < categoryDataset.getRowCount(); i++)
      {
        barRenderer3D.setSeriesOutlinePaint(i, ChartThemesConstants.TRANSPARENT_PAINT);
View Full Code Here

   */
  protected JFreeChart createGanttChart() throws JRException
  {

    JFreeChart jfreeChart = super.createGanttChart();
    CategoryPlot categoryPlot = (CategoryPlot)jfreeChart.getPlot();
    categoryPlot.getDomainAxis().setCategoryLabelPositions(CategoryLabelPositions.STANDARD);
    categoryPlot.setDomainGridlinesVisible(true);
    categoryPlot.setDomainGridlinePosition(CategoryAnchor.END);
    categoryPlot.setDomainGridlineStroke(new BasicStroke(
        0.5f,
        BasicStroke.CAP_BUTT,
        BasicStroke.JOIN_MITER,
        50,
        new float[] {1},
        0
        )
    );

    categoryPlot.setDomainGridlinePaint(ChartThemesConstants.GRAY_PAINT_217);

    categoryPlot.setRangeGridlinesVisible(true);
    categoryPlot.setRangeGridlineStroke(new BasicStroke(
        0.5f,
        BasicStroke.CAP_BUTT,
        BasicStroke.JOIN_MITER,
        50,
        new float[] {1},
        0
        )
    );

    categoryPlot.setRangeGridlinePaint(ChartThemesConstants.GRAY_PAINT_217);
//    JRBarPlot barPlot = (BarPlot)categoryPlot;
//    categoryPlot.getDomainAxis().setTickLabelsVisible(
//        categoryPlot.getShowTickLabels() == null ? true : barPlot.getShowTickLabels().
//        true
//        );
    CategoryItemRenderer categoryRenderer = categoryPlot.getRenderer();
    categoryRenderer.setBaseItemLabelsVisible(true);
    BarRenderer barRenderer = (BarRenderer)categoryRenderer;
    List seriesPaints = (List)getDefaultValue(defaultChartPropertiesMap, ChartThemesConstants.SERIES_COLORS);
    barRenderer.setSeriesPaint(0, (Paint)seriesPaints.get(3));
    barRenderer.setSeriesPaint(1, (Paint)seriesPaints.get(0));
    CategoryDataset categoryDataset = categoryPlot.getDataset();
    if(categoryDataset != null)
    {
      for(int i = 0; i < categoryDataset.getRowCount(); i++)
      {
        barRenderer.setSeriesItemLabelFont(i, categoryPlot.getDomainAxis().getTickLabelFont());
        barRenderer.setSeriesItemLabelsVisible(i, true);
  //      barRenderer.setSeriesPaint(i, GRADIENT_PAINTS[i]);
  //      CategoryMarker categoryMarker = new CategoryMarker(categoryDataset.getColumnKey(i),MARKER_COLOR, new BasicStroke(1f));
  //      categoryMarker.setAlpha(0.5f);
  //      categoryPlot.addDomainMarker(categoryMarker, Layer.BACKGROUND);
      }
    }
    categoryPlot.setOutlinePaint(Color.DARK_GRAY);
    categoryPlot.setOutlineStroke(new BasicStroke(1.5f));
    categoryPlot.setOutlineVisible(true);
    return jfreeChart;
  }
View Full Code Here

          true,
          false );

    configureChart(jfreeChart, getPlot());

    CategoryPlot categoryPlot = (CategoryPlot)jfreeChart.getPlot();
    JRBar3DPlot bar3DPlot = (JRBar3DPlot)getPlot();

    BarRenderer3D barRenderer3D =
      new BarRenderer3D(
        bar3DPlot.getXOffsetDouble() == null ? BarRenderer3D.DEFAULT_X_OFFSET : bar3DPlot.getXOffsetDouble().doubleValue(),
        bar3DPlot.getYOffsetDouble() == null ? BarRenderer3D.DEFAULT_Y_OFFSET : bar3DPlot.getYOffsetDouble().doubleValue()
        );

    boolean isShowLabels = bar3DPlot.getShowLabels() == null ? false : bar3DPlot.getShowLabels().booleanValue();
    barRenderer3D.setBaseItemLabelsVisible( isShowLabels );
    if(isShowLabels)
    {
      JRItemLabel itemLabel = bar3DPlot.getItemLabel();
      Integer baseFontSize = (Integer)getDefaultValue(defaultChartPropertiesMap, ChartThemesConstants.BASEFONT_SIZE);
      JRFont font = itemLabel != null && itemLabel.getFont() != null ? itemLabel.getFont() : null;
      barRenderer3D.setBaseItemLabelFont(getFont(new JRBaseFont(getChart(), null), font, baseFontSize));
     
      if(itemLabel != null)
      {
        if(itemLabel.getColor() != null)
        {
          barRenderer3D.setBaseItemLabelPaint(itemLabel.getColor());
        }
        else
        {
          barRenderer3D.setBaseItemLabelPaint(getChart().getForecolor());
        }
//        categoryRenderer.setBaseFillPaint(itemLabel.getBackgroundColor());
//        if(itemLabel.getMask() != null)
//        {
//          barRenderer3D.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator(
//              StandardCategoryItemLabelGenerator.DEFAULT_LABEL_FORMAT_STRING,
//              new DecimalFormat(itemLabel.getMask())));
//        }
//        else
//        {
          barRenderer3D.setBaseItemLabelGenerator((CategoryItemLabelGenerator)getLabelGenerator());
//        }
      }
      else
      {
        barRenderer3D.setBaseItemLabelGenerator((CategoryItemLabelGenerator)getLabelGenerator());
        barRenderer3D.setBaseItemLabelPaint(getChart().getForecolor());
      }
    }

    categoryPlot.setRenderer(barRenderer3D);
   
    // Handle the axis formating for the category axis
    configureAxis(categoryPlot.getDomainAxis(), bar3DPlot.getCategoryAxisLabelFont(),
        bar3DPlot.getCategoryAxisLabelColor(), bar3DPlot.getCategoryAxisTickLabelFont(),
        bar3DPlot.getCategoryAxisTickLabelColor(), bar3DPlot.getCategoryAxisTickLabelMask(), bar3DPlot.getCategoryAxisVerticalTickLabels(),
        bar3DPlot.getOwnCategoryAxisLineColor(), false,
        (Comparable)evaluateExpression(bar3DPlot.getDomainAxisMinValueExpression()),
        (Comparable)evaluateExpression(bar3DPlot.getDomainAxisMaxValueExpression()));


    // Handle the axis formating for the value axis
    configureAxis(categoryPlot.getRangeAxis(), bar3DPlot.getValueAxisLabelFont(),
        bar3DPlot.getValueAxisLabelColor(), bar3DPlot.getValueAxisTickLabelFont(),
        bar3DPlot.getValueAxisTickLabelColor(), bar3DPlot.getValueAxisTickLabelMask(), bar3DPlot.getValueAxisVerticalTickLabels(),
        bar3DPlot.getOwnValueAxisLineColor(), true,
        (Comparable)evaluateExpression(bar3DPlot.getRangeAxisMinValueExpression()),
        (Comparable)evaluateExpression(bar3DPlot.getRangeAxisMaxValueExpression()));
View Full Code Here

TOP

Related Classes of org.jfree.chart.plot.CategoryPlot

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.