Package org.jfree.chart.renderer.category

Examples of org.jfree.chart.renderer.category.LineAndShapeRenderer


    }

    if(useLines){

      LineAndShapeRenderer lineRenderer = new LineAndShapeRenderer();
      //lineRenderer.setShapesFilled(false);
      lineRenderer.setShapesFilled(true);
      if(additionalLabels){lineRenderer.setBaseItemLabelGenerator(generator);
      lineRenderer.setBaseItemLabelFont(new Font(defaultLabelsStyle.getFontName(), Font.PLAIN, defaultLabelsStyle.getSize()));
      lineRenderer.setBaseItemLabelPaint(defaultLabelsStyle.getColor());
      lineRenderer.setBaseItemLabelsVisible(true);
      }

      DefaultCategoryDataset datasetLine=(DefaultCategoryDataset)datasets.getDatasets().get("line");

      if(enableToolTips){
        MyCategoryToolTipGenerator generatorToolTip=new MyCategoryToolTipGenerator(freeToolTips, seriesTooltip, categoriesTooltip, seriesCaptions);
        lineRenderer.setToolTipGenerator(generatorToolTip);       
      }

      if(colorMap!=null){
        for (Iterator iterator = datasetLine.getRowKeys().iterator(); iterator.hasNext();) {
          String serName = (String) iterator.next();
          String labelName = "";
          int index=-1;

          if (seriesCaptions != null && seriesCaptions.size()>0){
            labelName = serName;
            serName = (String)seriesCaptions.get(serName);
            index=datasetLine.getRowIndex(labelName);
          }
          else
            index=datasetLine.getRowIndex(serName);

          Color color=(Color)colorMap.get(serName);
          if(color!=null){
            lineRenderer.setSeriesPaint(index, color);
         
        }
      }
      plot.setDataset(0,datasetLine);
      plot.setRenderer(0,lineRenderer);
View Full Code Here


    domainAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_90);
    // set the range axis to display integers only...
    NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());

    LineAndShapeRenderer renderer2 = new LineAndShapeRenderer();

    NumberAxis axis2 = new NumberAxis("Percent");
    axis2.setNumberFormatOverride(NumberFormat.getPercentInstance());
    plot.setRangeAxis(1, axis2);
    plot.setDataset(1, datasetCumulative);
View Full Code Here


    //I create a line renderer
    MyStandardCategoryItemLabelGenerator generator=null;

      LineAndShapeRenderer lineRenderer = new LineAndShapeRenderer();
      lineRenderer.setShapesFilled(true);
      lineRenderer.setBaseItemLabelGenerator(generator);
      lineRenderer.setBaseItemLabelFont(new Font("Arial", Font.PLAIN, 12 ));
      lineRenderer.setBaseItemLabelPaint(colorLabel);
      lineRenderer.setBaseItemLabelsVisible(true);

      DefaultCategoryDataset datasetLine=(DefaultCategoryDataset)datasetMap.getDatasets().get("line");

        for (Iterator iterator = datasetLine.getRowKeys().iterator(); iterator.hasNext();) {
          String serName = (String) iterator.next();
          String labelName = "";
          int index=-1;
          index=datasetLine.getRowIndex(serName);
         
          Color color=Color.decode("#990200");
          lineRenderer.setSeriesPaint(index, color)
        }

      plot.setDataset(0,datasetLine);
      plot.setRenderer(0,lineRenderer);
View Full Code Here

            this.plotOrientation = ((XYPlot) plot).getOrientation();
        }
        if (plot instanceof CategoryPlot) {
            CategoryItemRenderer renderer = ((CategoryPlot) plot).getRenderer();
            if (renderer instanceof LineAndShapeRenderer) {
                LineAndShapeRenderer r = (LineAndShapeRenderer) renderer;
                this.drawLines = BooleanUtilities.valueOf(
                        r.getBaseLinesVisible());
                this.drawShapes = BooleanUtilities.valueOf(
                        r.getBaseShapesVisible());
            }
        }
        else if (plot instanceof XYPlot) {
            XYItemRenderer renderer = ((XYPlot) plot).getRenderer();
            if (renderer instanceof StandardXYItemRenderer) {
                StandardXYItemRenderer r = (StandardXYItemRenderer) renderer;
                this.drawLines = BooleanUtilities.valueOf(r.getPlotLines());
                this.drawShapes = BooleanUtilities.valueOf(
                        r.getBaseShapesVisible());
            }
        }

        setLayout(new BorderLayout());
View Full Code Here

    domainAxis.setUpperMargin(0.0);
    // voodoo for better spacing between labels with many columns
    domainAxis.setCategoryMargin(-((double) dataset.getColumnCount() / 10.0));
                ValueAxis axis = new NumberAxis();
                plot.setDataset(1, workspaceDataset);
                LineAndShapeRenderer renderer = new LineAndShapeRenderer();
                renderer.setBaseShapesVisible(false);
                renderer.setSeriesStroke(0, new BasicStroke(4f, BasicStroke.JOIN_ROUND, BasicStroke.JOIN_BEVEL));
                renderer.setSeriesStroke(1, new BasicStroke(4f, BasicStroke.JOIN_ROUND, BasicStroke.JOIN_BEVEL));
                plot.setRenderer(1, renderer);
                ValueAxis rangeAxis = new NumberAxis(Messages.ProjectDiskUsage() + " (" + workspaceUnit + ")");
                plot.setRangeAxis(1, rangeAxis);
                plot.mapDatasetToRangeAxis(1, 1);
                setColorForArea(plot.getRenderer(), dataset.getRowCount()>2);
                plot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD);
                renderer.setSeriesPaint(1, new Color(255,204,0));
    return chart;
  }
View Full Code Here

    }
    else if(p instanceof CategoryPlot) {
      CategoryPlot cp=(CategoryPlot) p;
      CategoryItemRenderer r = cp.getRenderer();
      if (r instanceof LineAndShapeRenderer) {
        LineAndShapeRenderer lsr = (LineAndShapeRenderer)r;
     
        int seriesCount=_series.size();
        for(int i=0;i<seriesCount;i++){
          lsr.setSeriesShapesVisible(i, true);
          lsr.setSeriesItemLabelsVisible(i, true);
          lsr.setSeriesShape(i, ShapeUtilities.createDiamond(markersize));
              lsr.setUseFillPaint(true);
              lsr.setBaseFillPaint(databackgroundcolor);
        }
      }
    }
  }
View Full Code Here

                XYRendererAdapter xyRenderer = (XYRendererAdapter) renderer;
                XYDataset xyDataset = (XYDataset) dataSet;

                applyPropertiesToXYDataSet(xyRenderer, xyDataset, lineChartView, lineProperties);
            } else if (renderer instanceof LineAndShapeRenderer && dataSet instanceof CategoryDataset) {
                LineAndShapeRenderer lineRenderer = (LineAndShapeRenderer) renderer;
                CategoryDataset categoryDataset = (CategoryDataset) dataSet;

                applyPropertiesToCategoryDataSet(lineRenderer, categoryDataset, lineChartView, lineProperties);
            } else {
                throw new IllegalStateException("");
View Full Code Here

            return xyPlot;
        }

        CategoryDataset ds = ModelConverter.toCategoryDataset(info);
        LineAndShapeRenderer renderer;

        if (chartView.getLineAreaFill() != null) {
            renderer = new LineFillRenderer();
        } else {
            renderer = chartView.isEnable3D()
View Full Code Here

        DefaultCategoryDataset datasetA = new DefaultCategoryDataset();
        DefaultCategoryDataset datasetB = new DefaultCategoryDataset();
        datasetB.addValue(50.0, "R1", "C1");
        datasetB.addValue(80.0, "R1", "C1");
        CategoryPlot plot = new CategoryPlot(datasetA, new CategoryAxis(null),
                new NumberAxis(null), new LineAndShapeRenderer());
        plot.setDataset(1, datasetB);
        plot.setRenderer(1, new LineAndShapeRenderer());
        Range r = plot.getRangeAxis().getRange();
        assertEquals(84.0, r.getUpperBound(), 0.00001);
    }
View Full Code Here

     * A test for a bug where setting the renderer doesn't register the plot
     * as a RendererChangeListener.
     */
    public void testSetRenderer() {
        CategoryPlot plot = new CategoryPlot();
        CategoryItemRenderer renderer = new LineAndShapeRenderer();
        plot.setRenderer(renderer);
        // now make a change to the renderer and see if it triggers a plot
        // change event...
        MyPlotChangeListener listener = new MyPlotChangeListener();
        plot.addChangeListener(listener);
        renderer.setSeriesPaint(0, Color.black);
        assertTrue(listener.getEvent() != null);
    }
View Full Code Here

TOP

Related Classes of org.jfree.chart.renderer.category.LineAndShapeRenderer

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.