Examples of CategoryPlot


Examples of org.jfree.chart.plot.CategoryPlot

        false
        );

    configureChart(jfreeChart, getPlot());

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

    BarRenderer categoryRenderer = (BarRenderer)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.getOwnCategoryAxisLineColor(), getDomainAxisSettings(),
        (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.getOwnValueAxisLineColor(), getRangeAxisSettings(),
        (Comparable)evaluateExpression(barPlot.getRangeAxisMinValueExpression()),
        (Comparable)evaluateExpression(barPlot.getRangeAxisMaxValueExpression())
View Full Code Here

Examples of org.jfree.chart.plot.CategoryPlot

        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().booleanValue();
    boolean isShowTickLabels = barPlot.getShowTickLabels() == null ? true : barPlot.getShowTickLabels().booleanValue();
    boolean isShowLabels = barPlot.getShowLabels() == null ? false : barPlot.getShowLabels().booleanValue();
   
    //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;
View Full Code Here

Examples of org.jfree.chart.plot.CategoryPlot

      mainPlot = jfreeChart.getPlot();
      ChartHyperlinkProvider axisHyperlinkProvider = fillChart.getHyperlinkProvider();

      if (mainPlot instanceof CategoryPlot)
      {
        CategoryPlot categoryPlot = (CategoryPlot) mainPlot;
        categoryPlot.setRangeAxisLocation(0, getChartAxisLocation(axis));
        if (axisHyperlinkProvider != null)
        {
          multiHyperlinkProvider.addHyperlinkProvider(categoryPlot.getDataset(),
              axisHyperlinkProvider);
        }
      }
      else if (mainPlot instanceof XYPlot)
      {
        XYPlot xyPlot = (XYPlot) mainPlot;
        xyPlot.setRangeAxisLocation(0, getChartAxisLocation(axis));
        if (axisHyperlinkProvider != null)
        {
          multiHyperlinkProvider.addHyperlinkProvider(xyPlot.getDataset(), axisHyperlinkProvider);
        }
      }
     }

    // Now handle all the extra axes, if any.
    int axisNumber = 0;
    while (iter.hasNext())
    {
      axisNumber++;
      JRFillChartAxis chartAxis = (JRFillChartAxis)iter.next();
      JRFillChart fillChart = chartAxis.getFillChart();
      JFreeChart axisChart = fillChart.evaluateChart(evaluation);
      ChartHyperlinkProvider axisHyperlinkProvider = fillChart.getHyperlinkProvider();

      // In JFreeChart to add a second chart type to an existing chart
      // you need to add an axis, a data series and a renderer.  To
      // leverage existing code we simply create a new chart for the
      // axis and then pull out the bits we need and add them to the multi
      // chart.  Currently JFree only supports category plots and xy plots
      // in a multi-axis chart, and you can not mix the two.
      if (mainPlot instanceof CategoryPlot)
      {
        CategoryPlot mainCatPlot = (CategoryPlot)mainPlot;
        if (!(axisChart.getPlot() instanceof CategoryPlot))
        {
          throw new JRException("You can not mix plot types in a MultiAxisChart");
        }

        // Get the axis and add it to the multi axis chart plot
        CategoryPlot axisPlot = (CategoryPlot)axisChart.getPlot();
        mainCatPlot.setRangeAxis(axisNumber, axisPlot.getRangeAxis());
        mainCatPlot.setRangeAxisLocation(axisNumber, getChartAxisLocation(chartAxis));

        // Add the data set and map it to the recently added axis
        mainCatPlot.setDataset(axisNumber, axisPlot.getDataset());
        mainCatPlot.mapDatasetToRangeAxis(axisNumber, axisNumber);

        // Set the renderer to use to draw the dataset.
        mainCatPlot.setRenderer(axisNumber, axisPlot.getRenderer());

        // Handle any color series for this chart
        configureAxisSeriesColors(axisPlot.getRenderer(), fillChart.getPlot());
       
        if (axisHyperlinkProvider != null)
        {
          multiHyperlinkProvider.addHyperlinkProvider(axisPlot.getDataset(),
              axisHyperlinkProvider);
        }
      }
      else if (mainPlot instanceof XYPlot)
      {
        XYPlot mainXyPlot = (XYPlot)mainPlot;
        if (!(axisChart.getPlot() instanceof XYPlot))
        {
          throw new JRException("You can not mix plot types in a MultiAxisChart");
        }

        // Get the axis and add it to the multi axis chart plot
        XYPlot axisPlot = (XYPlot)axisChart.getPlot();
        mainXyPlot.setRangeAxis(axisNumber, axisPlot.getRangeAxis());
        mainXyPlot.setRangeAxisLocation(axisNumber, getChartAxisLocation(chartAxis));

        // Add the data set and map it to the recently added axis
        mainXyPlot.setDataset(axisNumber, axisPlot.getDataset());
        mainXyPlot.mapDatasetToRangeAxis(axisNumber, axisNumber);

        // Set the renderer to use to draw the dataset.
        mainXyPlot.setRenderer(axisNumber, axisPlot.getRenderer());

        // Handle any color series for this chart
        configureAxisSeriesColors(axisPlot.getRenderer(), fillChart.getPlot());
       
        if (axisHyperlinkProvider != null)
        {
          multiHyperlinkProvider.addHyperlinkProvider(axisPlot.getDataset(),
              axisHyperlinkProvider);
        }
      }
      else
      {
View Full Code Here

Examples of org.jfree.chart.plot.CategoryPlot

  protected void configurePlot(Plot plot, JRChartPlot jrPlot)
  {
    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_134);
      categoryPlot.setRangeGridlineStroke(new BasicStroke(1f));
      categoryPlot.setDomainGridlinesVisible(false);
     
    }
    else if(plot instanceof XYPlot)
    {
      XYPlot xyPlot = (XYPlot)plot;
View Full Code Here

Examples of org.jfree.chart.plot.CategoryPlot

   */
  protected JFreeChart createBarChart() throws JRException
  {
    JFreeChart jfreeChart = super.createBarChart();

    CategoryPlot categoryPlot = (CategoryPlot)jfreeChart.getPlot();
    //categoryPlot.setOrientation(PlotOrientation.HORIZONTAL);
    BarRenderer barRenderer = (BarRenderer)categoryPlot.getRenderer();
    barRenderer.setItemMargin(0);
    barRenderer.setGradientPaintTransformer(
      new StandardGradientPaintTransformer(GradientPaintTransformType.HORIZONTAL)
      );
    CategoryDataset categoryDataset = categoryPlot.getDataset();
    if(categoryDataset != null)
    {
      for(int i = 0; i < categoryDataset.getRowCount(); i++)
      {
        barRenderer.setSeriesPaint(i, (Paint)ChartThemesConstants.EYE_CANDY_SIXTIES_GRADIENT_PAINTS.get(i));
View Full Code Here

Examples of org.jfree.chart.plot.CategoryPlot

   */
  protected JFreeChart createStackedBarChart() throws JRException
  {
    JFreeChart jfreeChart = super.createStackedBarChart();

    CategoryPlot categoryPlot = (CategoryPlot)jfreeChart.getPlot();
    //categoryPlot.setOrientation(PlotOrientation.HORIZONTAL);
    BarRenderer barRenderer = (BarRenderer)categoryPlot.getRenderer();
    barRenderer.setItemMargin(0);
    barRenderer.setGradientPaintTransformer(
      new StandardGradientPaintTransformer(GradientPaintTransformType.HORIZONTAL)
      );

    CategoryDataset categoryDataset = categoryPlot.getDataset();
    if(categoryDataset != null)
    {
      for(int i = 0; i < categoryDataset.getRowCount(); i++)
      {
        barRenderer.setSeriesPaint(i, (Paint)ChartThemesConstants.EYE_CANDY_SIXTIES_GRADIENT_PAINTS.get(i));
View Full Code Here

Examples of org.jfree.chart.plot.CategoryPlot

  }

  protected JFreeChart createBar3DChart() throws JRException
  {
    JFreeChart jfreeChart = super.createBar3DChart();
    CategoryPlot categoryPlot = (CategoryPlot)jfreeChart.getPlot();
    BarRenderer3D barRenderer3D = (BarRenderer3D)categoryPlot.getRenderer();

    barRenderer3D = new GradientBarRenderer3D(barRenderer3D);
    categoryPlot.setRenderer(barRenderer3D);

    barRenderer3D.setItemMargin(0);
    barRenderer3D.setWallPaint(ChartThemesConstants.TRANSPARENT_PAINT);
    //categoryPlot.setOrientation(PlotOrientation.HORIZONTAL);

    barRenderer3D.setItemMargin(0);

    CategoryDataset categoryDataset = categoryPlot.getDataset();
    if(categoryDataset != null)
    {
      for(int i = 0; i < categoryDataset.getRowCount(); i++)
      {
        barRenderer3D.setSeriesPaint(i, (Paint)ChartThemesConstants.EYE_CANDY_SIXTIES_GRADIENT_PAINTS.get(i));
View Full Code Here

Examples of org.jfree.chart.plot.CategoryPlot


  protected JFreeChart createStackedBar3DChart() throws JRException
  {
    JFreeChart jfreeChart = super.createStackedBar3DChart();
    CategoryPlot categoryPlot = (CategoryPlot)jfreeChart.getPlot();
    BarRenderer3D barRenderer3D = (BarRenderer3D)categoryPlot.getRenderer();
    barRenderer3D.setWallPaint(ChartThemesConstants.TRANSPARENT_PAINT);

    //CategoryDataset categoryDataset = categoryPlot.getDataset();
    barRenderer3D.setItemMargin(0);
    return jfreeChart;
View Full Code Here

Examples of org.jfree.chart.plot.CategoryPlot

   *
   */
  protected JFreeChart createLineChart() throws JRException
  {
    JFreeChart jfreeChart = super.createLineChart();
    CategoryPlot categoryPlot = (CategoryPlot)jfreeChart.getPlot();
    LineAndShapeRenderer lineRenderer = (LineAndShapeRenderer)categoryPlot.getRenderer();
    lineRenderer.setStroke(new BasicStroke(2f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND));
//    Stroke stroke = new BasicStroke(2f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND);

    for(int i = 0; i < lineRenderer.getRowCount(); i++)
    {
View Full Code Here

Examples of org.jfree.chart.plot.CategoryPlot

   */
  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_134);

    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_134);
    categoryPlot.getDomainAxis().setTickLabelsVisible(
        //barPlot.isShowTickLabels()
        true
        );
    CategoryItemRenderer categoryRenderer = categoryPlot.getRenderer();
    categoryRenderer.setBaseItemLabelsVisible(true);
    BarRenderer barRenderer = (BarRenderer)categoryRenderer;
    barRenderer.setSeriesPaint(0, (Paint)ChartThemesConstants.EYE_CANDY_SIXTIES_COLORS.get(3));
    barRenderer.setSeriesPaint(1, (Paint)ChartThemesConstants.EYE_CANDY_SIXTIES_COLORS.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);
      }
    }
    categoryPlot.setOutlinePaint(Color.DARK_GRAY);
    categoryPlot.setOutlineStroke(new BasicStroke(1.5f));
    categoryPlot.setOutlineVisible(true);
    return jfreeChart;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.