Package org.jfree.chart.plot

Examples of org.jfree.chart.plot.XYPlot


        (DefaultHighLowDataset)getDataset(),
        isShowLegend()
        );

    configureChart(jfreeChart, getPlot());
    XYPlot xyPlot = (XYPlot) jfreeChart.getPlot();
    JRHighLowPlot highLowPlot = (JRHighLowPlot)getPlot();
    HighLowRenderer hlRenderer = (HighLowRenderer) xyPlot.getRenderer();
    boolean isShowOpenTicks = highLowPlot.getShowOpenTicks() == null ? false : highLowPlot.getShowOpenTicks().booleanValue();
    boolean isShowCloseTicks = highLowPlot.getShowCloseTicks() == null ? false : highLowPlot.getShowCloseTicks().booleanValue();
   
    hlRenderer.setDrawOpenTicks(isShowOpenTicks);
    hlRenderer.setDrawCloseTicks(isShowCloseTicks);

    // Handle the axis formating for the category axis
    configureAxis(xyPlot.getDomainAxis(), highLowPlot.getTimeAxisLabelFont(),
        highLowPlot.getTimeAxisLabelColor(), highLowPlot.getTimeAxisTickLabelFont(),
        highLowPlot.getTimeAxisTickLabelColor(), highLowPlot.getTimeAxisTickLabelMask(), highLowPlot.getTimeAxisVerticalTickLabels(),
        highLowPlot.getOwnTimeAxisLineColor(), getDomainAxisSettings(),
        (Comparable)evaluateExpression(highLowPlot.getDomainAxisMinValueExpression()),
        (Comparable)evaluateExpression(highLowPlot.getDomainAxisMaxValueExpression())
        );

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


        false
        );

    configureChart(jfreeChart, getPlot());

    XYPlot xyPlot = (XYPlot)jfreeChart.getPlot();
    //plot.setNoDataMessage("No data to display");
//    ((XYPlot)plot.getDomainAxis()).setTickMarksVisible(
//      ((JRBarPlot)getPlot()).isShowTickMarks()
//      );
//    ((CategoryAxis)plot.getDomainAxis()).setTickLabelsVisible(
//        ((JRBarPlot)getPlot()).isShowTickLabels()
//        );
//    ((NumberAxis)plot.getRangeAxis()).setTickMarksVisible(
//        ((JRBarPlot)getPlot()).isShowTickMarks()
//        );
//    ((NumberAxis)plot.getRangeAxis()).setTickLabelsVisible(
//        ((JRBarPlot)getPlot()).isShowTickLabels()
//        );


    XYBarRenderer itemRenderer = (XYBarRenderer)xyPlot.getRenderer();
    itemRenderer.setBaseItemLabelGenerator((XYItemLabelGenerator)getLabelGenerator());
    itemRenderer.setShadowVisible(false);

    JRBarPlot barPlot = (JRBarPlot)getPlot();
    boolean isShowLabels = barPlot.getShowLabels() == null ? false : barPlot.getShowLabels().booleanValue();
   
    itemRenderer.setBaseItemLabelsVisible( isShowLabels );

    // Handle the axis formating for the category axis
    configureAxis(xyPlot.getDomainAxis(), barPlot.getCategoryAxisLabelFont(),
        barPlot.getCategoryAxisLabelColor(), barPlot.getCategoryAxisTickLabelFont(),
        barPlot.getCategoryAxisTickLabelColor(), barPlot.getCategoryAxisTickLabelMask(), barPlot.getCategoryAxisVerticalTickLabels(),
        barPlot.getOwnCategoryAxisLineColor(), getDomainAxisSettings(), DateTickUnit.DAY,
        (Comparable)evaluateExpression(barPlot.getDomainAxisMinValueExpression()),
        (Comparable)evaluateExpression(barPlot.getDomainAxisMaxValueExpression())
        );


    // Handle the axis formating for the value axis
    configureAxis(xyPlot.getRangeAxis(), barPlot.getValueAxisLabelFont(),
        barPlot.getValueAxisLabelColor(), barPlot.getValueAxisTickLabelFont(),
        barPlot.getValueAxisTickLabelColor(), barPlot.getValueAxisTickLabelMask(), barPlot.getValueAxisVerticalTickLabels(),
        barPlot.getOwnValueAxisLineColor(), getRangeAxisSettings(), DateTickUnit.DAY,
        (Comparable)evaluateExpression(barPlot.getRangeAxisMinValueExpression()),
        (Comparable)evaluateExpression(barPlot.getRangeAxisMaxValueExpression())
View Full Code Here

        true,
        false );

    configureChart(jfreeChart, getPlot());

    XYPlot xyPlot = (XYPlot)jfreeChart.getPlot();
    JRTimeSeriesPlot timeSeriesPlot = (JRTimeSeriesPlot)getPlot();
   
    XYLineAndShapeRenderer lineRenderer = (XYLineAndShapeRenderer)xyPlot.getRenderer();
   
    boolean isShowShapes = timeSeriesPlot.getShowShapes() == null ? true : timeSeriesPlot.getShowShapes().booleanValue();
    boolean isShowLines = timeSeriesPlot.getShowLines() == null ? true : timeSeriesPlot.getShowLines().booleanValue();
    lineRenderer.setBaseLinesVisible(isShowLines);
    lineRenderer.setBaseShapesVisible(isShowShapes);
   
    // Handle the axis formating for the category axis
    configureAxis(xyPlot.getDomainAxis(), timeSeriesPlot.getTimeAxisLabelFont(),
        timeSeriesPlot.getTimeAxisLabelColor(), timeSeriesPlot.getTimeAxisTickLabelFont(),
        timeSeriesPlot.getTimeAxisTickLabelColor(), timeSeriesPlot.getTimeAxisTickLabelMask(), timeSeriesPlot.getTimeAxisVerticalTickLabels(),
        timeSeriesPlot.getOwnTimeAxisLineColor(), getDomainAxisSettings(), DateTickUnit.DAY,
        (Comparable)evaluateExpression(timeSeriesPlot.getDomainAxisMinValueExpression()),
        (Comparable)evaluateExpression(timeSeriesPlot.getDomainAxisMaxValueExpression())
        );

    // Handle the axis formating for the value axis
    configureAxis(xyPlot.getRangeAxis(), timeSeriesPlot.getValueAxisLabelFont(),
        timeSeriesPlot.getValueAxisLabelColor(), timeSeriesPlot.getValueAxisTickLabelFont(),
        timeSeriesPlot.getValueAxisTickLabelColor(), timeSeriesPlot.getValueAxisTickLabelMask(), timeSeriesPlot.getValueAxisVerticalTickLabels(),
        timeSeriesPlot.getOwnValueAxisLineColor(), getRangeAxisSettings(), DateTickUnit.DAY,
        (Comparable)evaluateExpression(timeSeriesPlot.getRangeAxisMinValueExpression()),
        (Comparable)evaluateExpression(timeSeriesPlot.getRangeAxisMaxValueExpression())
View Full Code Here

         true,
         false);

    configureChart(jfreeChart, getPlot());

    XYPlot xyPlot = (XYPlot)jfreeChart.getPlot();
    JRBubblePlot bubblePlot = (JRBubblePlot)getPlot();
    int scaleType = bubblePlot.getScaleTypeValue() == null ? ScaleTypeEnum.ON_RANGE_AXIS.getValue() : bubblePlot.getScaleTypeValue().getValue();
    XYBubbleRenderer bubbleRenderer = new XYBubbleRenderer( scaleType );
    xyPlot.setRenderer( bubbleRenderer );

    // Handle the axis formating for the category axis
    configureAxis(xyPlot.getDomainAxis(), bubblePlot.getXAxisLabelFont(),
        bubblePlot.getXAxisLabelColor(), bubblePlot.getXAxisTickLabelFont(),
        bubblePlot.getXAxisTickLabelColor(), bubblePlot.getXAxisTickLabelMask(), bubblePlot.getXAxisVerticalTickLabels(),
        bubblePlot.getOwnXAxisLineColor(), false,
        (Comparable)evaluateExpression(bubblePlot.getDomainAxisMinValueExpression()),
        (Comparable)evaluateExpression(bubblePlot.getDomainAxisMaxValueExpression()));

    // Handle the axis formating for the value axis
    configureAxis(xyPlot.getRangeAxis(), bubblePlot.getYAxisLabelFont(),
        bubblePlot.getYAxisLabelColor(), bubblePlot.getYAxisTickLabelFont(),
        bubblePlot.getYAxisTickLabelColor(), bubblePlot.getYAxisTickLabelMask(), bubblePlot.getYAxisVerticalTickLabels(),
        bubblePlot.getOwnYAxisLineColor(), true,
        (Comparable)evaluateExpression(bubblePlot.getRangeAxisMinValueExpression()),
        (Comparable)evaluateExpression(bubblePlot.getRangeAxisMaxValueExpression()));
View Full Code Here

        isShowLegend()
        );

    configureChart(jfreeChart, getPlot());

    XYPlot xyPlot = (XYPlot) jfreeChart.getPlot();
    JRCandlestickPlot candlestickPlot = (JRCandlestickPlot)getPlot();
    CandlestickRenderer candlestickRenderer = (CandlestickRenderer) xyPlot.getRenderer();
    boolean isShowVolume = candlestickPlot.getShowVolume() == null ? true : candlestickPlot.getShowVolume().booleanValue();
    candlestickRenderer.setDrawVolume(isShowVolume);

    // Handle the axis formating for the category axis
    configureAxis(xyPlot.getDomainAxis(), candlestickPlot.getTimeAxisLabelFont(),
        candlestickPlot.getTimeAxisLabelColor(), candlestickPlot.getTimeAxisTickLabelFont(),
        candlestickPlot.getTimeAxisTickLabelColor(), candlestickPlot.getTimeAxisTickLabelMask(), candlestickPlot.getTimeAxisVerticalTickLabels(),
        candlestickPlot.getOwnTimeAxisLineColor(), false,
        (Comparable)evaluateExpression(candlestickPlot.getDomainAxisMinValueExpression()),
        (Comparable)evaluateExpression(candlestickPlot.getDomainAxisMaxValueExpression()));

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

        (DefaultHighLowDataset)getDataset(),
        isShowLegend()
        );

    configureChart(jfreeChart, getPlot());
    XYPlot xyPlot = (XYPlot) jfreeChart.getPlot();
    JRHighLowPlot highLowPlot = (JRHighLowPlot)getPlot();
    HighLowRenderer hlRenderer = (HighLowRenderer) xyPlot.getRenderer();
    boolean isShowOpenTicks = highLowPlot.getShowOpenTicks() == null ? false : highLowPlot.getShowOpenTicks().booleanValue();
    boolean isShowCloseTicks = highLowPlot.getShowCloseTicks() == null ? false : highLowPlot.getShowCloseTicks().booleanValue();
   
    hlRenderer.setDrawOpenTicks(isShowOpenTicks);
    hlRenderer.setDrawCloseTicks(isShowCloseTicks);

    // Handle the axis formating for the category axis
    configureAxis(xyPlot.getDomainAxis(), highLowPlot.getTimeAxisLabelFont(),
        highLowPlot.getTimeAxisLabelColor(), highLowPlot.getTimeAxisTickLabelFont(),
        highLowPlot.getTimeAxisTickLabelColor(), highLowPlot.getTimeAxisTickLabelMask(), highLowPlot.getTimeAxisVerticalTickLabels(),
        highLowPlot.getOwnTimeAxisLineColor(), false,
        (Comparable)evaluateExpression(highLowPlot.getDomainAxisMinValueExpression()),
        (Comparable)evaluateExpression(highLowPlot.getDomainAxisMaxValueExpression()));

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

        false
        );

    configureChart(jfreeChart, getPlot());

    XYPlot xyPlot = (XYPlot)jfreeChart.getPlot();
    //plot.setNoDataMessage("No data to display");
//    ((XYPlot)plot.getDomainAxis()).setTickMarksVisible(
//      ((JRBarPlot)getPlot()).isShowTickMarks()
//      );
//    ((CategoryAxis)plot.getDomainAxis()).setTickLabelsVisible(
//        ((JRBarPlot)getPlot()).isShowTickLabels()
//        );
//    ((NumberAxis)plot.getRangeAxis()).setTickMarksVisible(
//        ((JRBarPlot)getPlot()).isShowTickMarks()
//        );
//    ((NumberAxis)plot.getRangeAxis()).setTickLabelsVisible(
//        ((JRBarPlot)getPlot()).isShowTickLabels()
//        );


    XYBarRenderer itemRenderer = (XYBarRenderer)xyPlot.getRenderer();
    itemRenderer.setBaseItemLabelGenerator((XYItemLabelGenerator)getLabelGenerator());
    itemRenderer.setShadowVisible(false);

    JRBarPlot barPlot = (JRBarPlot)getPlot();
    boolean isShowLabels = barPlot.getShowLabels() == null ? false : barPlot.getShowLabels().booleanValue();
   
    itemRenderer.setBaseItemLabelsVisible( isShowLabels );

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

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

        true,
        false );

    configureChart(jfreeChart, getPlot());

    XYPlot xyPlot = (XYPlot)jfreeChart.getPlot();
    JRTimeSeriesPlot timeSeriesPlot = (JRTimeSeriesPlot)getPlot();
   
    XYLineAndShapeRenderer lineRenderer = (XYLineAndShapeRenderer)xyPlot.getRenderer();
   
    boolean isShowShapes = timeSeriesPlot.getShowShapes() == null ? true : timeSeriesPlot.getShowShapes().booleanValue();
    boolean isShowLines = timeSeriesPlot.getShowLines() == null ? true : timeSeriesPlot.getShowLines().booleanValue();
    lineRenderer.setBaseLinesVisible(isShowLines);
    lineRenderer.setBaseShapesVisible(isShowShapes);
   
    // Handle the axis formating for the category axis
    configureAxis(xyPlot.getDomainAxis(), timeSeriesPlot.getTimeAxisLabelFont(),
        timeSeriesPlot.getTimeAxisLabelColor(), timeSeriesPlot.getTimeAxisTickLabelFont(),
        timeSeriesPlot.getTimeAxisTickLabelColor(), timeSeriesPlot.getTimeAxisTickLabelMask(), timeSeriesPlot.getTimeAxisVerticalTickLabels(),
        timeSeriesPlot.getOwnTimeAxisLineColor(), false,
        (Comparable)evaluateExpression(timeSeriesPlot.getDomainAxisMinValueExpression()),
        (Comparable)evaluateExpression(timeSeriesPlot.getDomainAxisMaxValueExpression()));

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

              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

      categoryPlot.setDomainGridlinesVisible(false);
     
    }
    else if(plot instanceof XYPlot)
    {
      XYPlot xyPlot = (XYPlot)plot;
      XYDataset xyDataset = xyPlot.getDataset();
      if(xyDataset != null)
      {
        XYItemRenderer xyItemRenderer = xyPlot.getRenderer();
        for(int i = 0; i < xyDataset.getSeriesCount(); i++)
        {
          xyItemRenderer.setSeriesOutlinePaint(i, ChartThemesConstants.TRANSPARENT_PAINT);
        }
      }
      xyPlot.setRangeGridlinePaint(ChartThemesConstants.GRAY_PAINT_134);
      xyPlot.setRangeGridlineStroke(new BasicStroke(1f));
      xyPlot.setDomainGridlinesVisible(false);
     
      xyPlot.setRangeZeroBaselineVisible(true);

    }
  }
View Full Code Here

TOP

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

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.