Package com.googlecode.jsonwebservice.attachment

Examples of com.googlecode.jsonwebservice.attachment.Visibility


 
  public void updateSettings(JFreeChart chart, ChartConfig chartConfig){
    Plot plot = chart.getPlot();
   
    Visibility   visibility   = chartConfig.getVisibility();
    Colors     colors     = chartConfig.getColors();
   
    // Chart level visible items
    chart.setBorderVisible(visibility.isBorder());
    plot.setOutlineVisible(visibility.isOutline());
   
    // chart level colors
    final Color  BACKGROUND  = new Color(colors.getBg());
    plot.setBackgroundPaint(BACKGROUND);
    chart.setBackgroundPaint(BACKGROUND);
   
    // Chart level title
    if(chart.getTitle() != null){
      TextTitle title = chart.getTitle();
      title.setVisible(visibility.isTitle());
      title.setBackgroundPaint(new Color(colors.getTitleBg()));
      title.setPaint(new Color(colors.getTitle()));
      title.setExpandToFitSpace(true);
    }
   
    // In case of multiple plot read and update child level chart
    if(plot instanceof MultiplePiePlot){
      MultiplePiePlot multiplePiePlot = (MultiplePiePlot)plot;
      chart  = multiplePiePlot.getPieChart();
      plot   = chart.getPlot();
     
      chart.setBorderVisible(visibility.isBorder());
      plot.setOutlineVisible(visibility.isOutline());
     
      chart.setBackgroundPaint(BACKGROUND);
      plot.setBackgroundPaint(BACKGROUND);
    }
   
    if(plot instanceof CategoryPlot){
      CategoryPlot   categoryPlot   = (CategoryPlot)chart.getPlot();
      categoryPlot.setRangeGridlinesVisible(visibility.isRangeGridLines());
      categoryPlot.setOrientation((visibility.getOrientation() != null &&
          visibility.getOrientation() == com.googlecode.jsonwebservice.attachment.PlotOrientation.HORIZONTAL)
          ? PlotOrientation.HORIZONTAL : PlotOrientation.VERTICAL);
      categoryPlot.setRangeZeroBaselineVisible(visibility.isRangeZeroBaseline());
      categoryPlot.setRangeCrosshairVisible(visibility.isRangeCrosshair());
      /**
       * RANGE Axis settings
       */
      ValueAxis     rangeAxis      = categoryPlot.getRangeAxis();
     
      rangeAxis.setAxisLineVisible(visibility.isAxisLine());
      rangeAxis.setTickMarksVisible(visibility.isTickMarks());
      rangeAxis.setMinorTickMarksVisible(visibility.isMinerTickMarks());
     
      Color axisLabel = new Color(colors.getAxisLabel());
      Color tickLabel = new Color(colors.getTickLabel());
     
      rangeAxis.setLabelPaint(axisLabel);
      rangeAxis.setTickLabelPaint(tickLabel);
      if(rangeAxis instanceof NumberAxis){
        NumberAxis numberAxis = (NumberAxis)rangeAxis;
        // rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
      }
     
      /**
       * DOAMIN AXIS settings
       */
      CategoryAxis   domainAxis     = categoryPlot.getDomainAxis();
      domainAxis.setAxisLineVisible(visibility.isAxisLine());
      domainAxis.setTickMarksVisible(visibility.isTickMarks());
      domainAxis.setMinorTickMarksVisible(visibility.isMinerTickMarks());
     
      domainAxis.setLabelPaint(axisLabel);
      domainAxis.setTickLabelPaint(tickLabel);
     
      domainAxis.setCategoryLabelPositions(
          CategoryLabelPositions.createUpRotationLabelPositions(Math.PI / 6.0));
     
      CategoryItemRenderer rendrer = categoryPlot.getRenderer();
      for(int index = 0; index < colors.getSeries().size(); index++){
        rendrer.setSeriesPaint(index, new Color(colors.getSeries().get(index)));
      }
    }else if(plot instanceof PiePlot){
      PiePlot piePlot = (PiePlot)plot;
     
      piePlot.setSimpleLabels(visibility.isPieSimpleLabels());
      piePlot.setSectionOutlinesVisible(visibility.isPieOutlines());
      piePlot.setLabelLinksVisible(visibility.isPieLabelLinks());
     
      //piePlot.setExplodePercent("1", 0.07000000000000001D);
      //piePlot.setInteriorGap(0.00D);
      piePlot.setLabelGenerator(new StandardPieSectionLabelGenerator(chartConfig.getDataSettings().getPieSectionLabel()));
      //piePlot.setLabelBackgroundPaint(new Color(220, 220, 220));
View Full Code Here

TOP

Related Classes of com.googlecode.jsonwebservice.attachment.Visibility

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.