Package org.jfree.data.category

Examples of org.jfree.data.category.CategoryDataset


    if (shadowYOffset != null)
    {
      pp.setShadowYOffset(shadowYOffset.doubleValue());
    }

    final CategoryDataset c = mpp.getDataset();
    if (c != null)
    {
      final String[] colors = getSeriesColor();
      final int keysSize = c.getColumnKeys().size();
      for (int i = 0; i < colors.length; i++)
      {
        if (keysSize > i)
        {
          pp.setSectionPaint(c.getColumnKey(i), parseColorFromString(colors[i]));
        }
      }
    }

    if (StringUtils.isEmpty(getLabelFont()) == false)
View Full Code Here


    {
      webPlot.setURLGenerator(new FormulaCategoryURLGenerator(getRuntime(), getUrlFormula()));
    }


    final CategoryDataset categoryDataset = webPlot.getDataset();
    final int count = categoryDataset.getRowCount();

    for (int t = 0; t < count; t++)
    {
      if (categoryDataset.getRowKey(t) instanceof GridCategoryItem)
      {
        continue;
      }
      webPlot.setSeriesOutlineStroke(t, thick);
    }

    //Set the spiderweb filled (or not)
    webPlot.setWebFilled(radarwebfilled);
    //Set the size of the datapoints on the axis
    webPlot.setHeadPercent(headsize);

    //Set the color of the fake datasets (gridlines) to grey
    for (int t = 0; t < count; t++)
    {
      if (categoryDataset.getRowKey(t) instanceof GridCategoryItem)
      {
        webPlot.setSeriesPaint(t, Color.GRAY);
      }
    }
View Full Code Here

      if (getDataset() == null)
      {
        return result;
      }
      List keys = null;
      final CategoryDataset dataset = getDataset();
      final TableOrder dataExtractOrder = getDataExtractOrder();
      if (dataExtractOrder == TableOrder.BY_ROW)
      {
        keys = dataset.getRowKeys();
      }
      else if (dataExtractOrder == TableOrder.BY_COLUMN)
      {
        keys = dataset.getColumnKeys();
      }
      if (keys == null)
      {
        return result;
      }
View Full Code Here

        }

        protected abstract DataSetBuilder<String, ChartLabel> createDataSet();

        protected JFreeChart createGraph() {
            final CategoryDataset dataset = createDataSet().build();

            final JFreeChart chart = ChartFactory.createStackedAreaChart(null, // chart
                                                                                // title
                    null, // unused
                    yLabel, // range axis label
                    dataset, // data
                    PlotOrientation.VERTICAL, // orientation
                    false, // include legend
                    true, // tooltips
                    false // urls
                    );

            chart.setBackgroundPaint(Color.white);

            final CategoryPlot plot = chart.getCategoryPlot();

            // plot.setAxisOffset(new Spacer(Spacer.ABSOLUTE, 5.0, 5.0, 5.0, 5.0));
            plot.setBackgroundPaint(Color.WHITE);
            plot.setOutlinePaint(null);
            plot.setForegroundAlpha(0.8f);
            // plot.setDomainGridlinesVisible(true);
            // plot.setDomainGridlinePaint(Color.white);
            plot.setRangeGridlinesVisible(true);
            plot.setRangeGridlinePaint(Color.black);

            CategoryAxis domainAxis = new ShiftedCategoryAxis(null);
            plot.setDomainAxis(domainAxis);
            domainAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_90);
            domainAxis.setLowerMargin(0.0);
            domainAxis.setUpperMargin(0.0);
            domainAxis.setCategoryMargin(0.0);

            final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
            ChartUtil.adjustChebyshev(dataset, rangeAxis);
            rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
            rangeAxis.setAutoRange(true);

            StackedAreaRenderer ar = new StackedAreaRenderer2() {
                @Override
                public Paint getItemPaint(int row, int column) {
                    ChartLabel key = (ChartLabel) dataset.getColumnKey(column);
                    if (key.getColor() != null) return key.getColor();
                    return super.getItemPaint(row, column);
                }

                @Override
                public String generateURL(CategoryDataset dataset, int row,
                        int column) {
                    ChartLabel label = (ChartLabel) dataset.getColumnKey(column);
                    return label.getUrl();
                }

                @Override
                public String generateToolTip(CategoryDataset dataset, int row,
                        int column) {
                    ChartLabel label = (ChartLabel) dataset.getColumnKey(column);
                    return label.o.getOwner().getDisplayName() + " : "
                            + label.o.getDurationString();
                }
            };
            plot.setRenderer(ar);
View Full Code Here

      final RenderableReplacedContentBox c = (RenderableReplacedContentBox) renderNode;
      final DrawableWrapper rawObject = (DrawableWrapper) c.getContent().getRawObject();
      final JFreeChartReportDrawable backend = (JFreeChartReportDrawable) rawObject.getBackend();
      final JFreeChart chart = backend.getChart();
      final CategoryPlot p = (CategoryPlot) chart.getPlot();
      final CategoryDataset dataset = p.getDataset();
      Assert.assertNotNull(dataset);
      DebugLog.log(rawObject);
    }
  }
View Full Code Here

    if (dataset instanceof CategoryDataset == false)
    {
      return computeCategoryChart(null);
    }

    final CategoryDataset categoryDataset = (CategoryDataset) dataset;
    return computeCategoryChart(categoryDataset);

  }
View Full Code Here

  }

  public JFreeChart computeCategoryChart(final CategoryDataset barsDataset)
  {
    final JFreeChart chart = super.computeCategoryChart(barsDataset);
    final CategoryDataset linesDataset = createLinesDataset();

    //Create the renderer with the barchart, use a different bar renderer depending
    //if 3D chart or not
    final CategoryPlot plot = chart.getCategoryPlot();
    final CategoryItemRenderer lineRenderer;
View Full Code Here

    {
      dataset = null;
    }


    final CategoryDataset linesDataset;
    if (dataset instanceof CategoryDataset)
    {
      linesDataset = (CategoryDataset) dataset;
    }
    else
View Full Code Here

        PlotOrientation orientation = plot.getOrientation();
        RectangleEdge domainEdge = Plot.resolveDomainAxisLocation(
                plot.getDomainAxisLocation(), orientation);
        RectangleEdge rangeEdge = Plot.resolveRangeAxisLocation(
                plot.getRangeAxisLocation(), orientation);
        CategoryDataset dataset = plot.getDataset();
        int catIndex = dataset.getColumnIndex(getCategory());
        int catCount = dataset.getColumnCount();
        double j2DX = domainAxis.getCategoryMiddle(catIndex, catCount,
                dataArea, domainEdge);
        double j2DY = rangeAxis.valueToJava2D(getValue(), dataArea, rangeEdge);
        if (orientation == PlotOrientation.HORIZONTAL) {
            double temp = j2DX;
View Full Code Here

     * @param rangeAxis  the range axis.
     */
    public void draw(Graphics2D g2, CategoryPlot plot, Rectangle2D dataArea,
                     CategoryAxis domainAxis, ValueAxis rangeAxis) {

        CategoryDataset dataset = plot.getDataset();
        int catIndex = dataset.getColumnIndex(this.category);
        int catCount = dataset.getColumnCount();

        float anchorX = 0.0f;
        float anchorY = 0.0f;
        PlotOrientation orientation = plot.getOrientation();
        RectangleEdge domainEdge = Plot.resolveDomainAxisLocation(
View Full Code Here

TOP

Related Classes of org.jfree.data.category.CategoryDataset

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.