Package org.jfree.chart.axis

Examples of org.jfree.chart.axis.NumberAxis


    // set the X axis labels to be slanted
    CategoryAxis domainAxis = plot.getDomainAxis();
    domainAxis.setCategoryLabelPositions(CategoryLabelPositions.createUpRotationLabelPositions(Math.PI / 3.0));

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

    // set the max width of each bar
    BarRenderer renderer = (BarRenderer) plot.getRenderer();
    renderer.setMaxBarWidth(0.10);
View Full Code Here


      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
View Full Code Here

  private JFreeChart createChart(final Expression aExpression)
  {
    if (aExpression instanceof BarLineChartExpression)
    {
      final CategoryAxis catAxis = new CategoryAxis("Category");// NON-NLS
      final NumberAxis barsAxis = new NumberAxis("Value");// NON-NLS
      final NumberAxis linesAxis = new NumberAxis("Value2");// NON-NLS

      final CategoryPlot plot = new CategoryPlot(createDataset(), catAxis, barsAxis, new BarRenderer());
      plot.setRenderer(1, new LineAndShapeRenderer());

      // add lines dataset and axis to plot
      plot.setDataset(1, createDataset());
      plot.setRangeAxis(1, linesAxis);

      // map lines to second axis
      plot.mapDatasetToRangeAxis(1, 1);

      // set rendering order
      plot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD);

      // set location of second axis
      plot.setRangeAxisLocation(1, AxisLocation.BOTTOM_OR_RIGHT);

      return new JFreeChart("Bar Line Chart", plot);
    }

    if (aExpression instanceof RingChartExpression)
    {
      return ChartFactory.createRingChart("Ring Chart", createPieDataset(), true, false, false);// NON-NLS
    }
    if (aExpression instanceof AreaChartExpression)
    {
      return ChartFactory.createAreaChart("Area Chart", "Category", "Value", createDataset(), PlotOrientation.VERTICAL,
          true, false, false);// NON-NLS
    }
    if (aExpression instanceof BarChartExpression)
    {
      return ChartFactory.createBarChart("Bar Chart", "Category", "Value", createDataset(), PlotOrientation.VERTICAL,
          true, false, false);// NON-NLS

    }
    if (aExpression instanceof LineChartExpression)
    {
      return ChartFactory.createLineChart("Line Chart", "Category", "Value", createDataset(), PlotOrientation.VERTICAL,
          true, false, false);// NON-NLS
    }
    if (aExpression instanceof MultiPieChartExpression)
    {
      return ChartFactory.createMultiplePieChart("Multi Pie Chart", createDataset(), TableOrder.BY_COLUMN, true, false,
          false);// NON-NLS
    }
    if (aExpression instanceof PieChartExpression)
    {
      return ChartFactory.createPieChart("Pie Chart", createPieDataset(), true, false, false);// NON-NLS
    }
    if (aExpression instanceof WaterfallChartExpressions)
    {
      return ChartFactory.createWaterfallChart("Bar Chart", "Category", "Value", createDataset(),
          PlotOrientation.HORIZONTAL, true, false, false);// NON-NLS
    }
    if (aExpression instanceof BubbleChartExpression)
    {
      return ChartFactory.createBubbleChart("Bubble Chart", "X", "Y", createXYZDataset(), PlotOrientation.VERTICAL,
          true, false, false);// NON-NLS
    }
    if (aExpression instanceof ExtendedXYLineChartExpression)
    {
      return ChartFactory.createXYLineChart("XY Line Chart", "X", "Y", createXYZDataset(), PlotOrientation.VERTICAL,
          true, false, false);// NON-NLS
    }
    if (aExpression instanceof ScatterPlotChartExpression)
    {
      return ChartFactory.createScatterPlot("Scatter Chart", "X", "Y", createXYZDataset(), PlotOrientation.VERTICAL,
          true, false, false);// NON-NLS
    }
    if (aExpression instanceof XYAreaLineChartExpression)
    {
      final NumberAxis catAxis = new NumberAxis("Range");// NON-NLS
      final NumberAxis barsAxis = new NumberAxis("Value");// NON-NLS
      final NumberAxis linesAxis = new NumberAxis("Value2");// NON-NLS

      final XYPlot plot = new XYPlot(createXYZDataset(), catAxis, barsAxis, new XYAreaRenderer());
      plot.setRenderer(1, new XYLineAndShapeRenderer());

      // add lines dataset and axis to plot
View Full Code Here


    final ValueAxis rangeAxis = cpl.getRangeAxis();
    if (rangeAxis instanceof NumberAxis)
    {
      final NumberAxis numberAxis = (NumberAxis) rangeAxis;

      if (getRangePeriodCount() > 0)
      {
        if (getRangeTickFormat() != null)
        {
          numberAxis.setTickUnit(new NumberTickUnit(getRangePeriodCount(), getRangeTickFormat()));
        }
        else if (getRangeTickFormatString() != null)
        {
          final FastDecimalFormat formatter = new FastDecimalFormat
              (getRangeTickFormatString(), getResourceBundleFactory().getLocale());
          numberAxis.setTickUnit(new FastNumberTickUnit(getRangePeriodCount(), formatter));
        }
        else
        {
          numberAxis.setTickUnit(new FastNumberTickUnit(getRangePeriodCount()));
        }
      }
      else
      {
        if (getRangeTickFormat() != null)
        {
          numberAxis.setNumberFormatOverride(getRangeTickFormat());
        }
        else if (getRangeTickFormatString() != null)
        {
          final DecimalFormat formatter = new DecimalFormat
              (getRangeTickFormatString(), new DecimalFormatSymbols(getResourceBundleFactory().getLocale()));
          numberAxis.setNumberFormatOverride(formatter);
        }
      }
    }
    else if (rangeAxis instanceof DateAxis)
    {
      final DateAxis numberAxis = (DateAxis) rangeAxis;

      if (getRangePeriodCount() > 0 && getRangeTimePeriod() != null)
      {
        if (getRangeTickFormatString() != null)
        {
          final SimpleDateFormat formatter = new SimpleDateFormat
              (getRangeTickFormatString(), new DateFormatSymbols(getResourceBundleFactory().getLocale()));
          numberAxis.setTickUnit
              (new DateTickUnit(getDateUnitAsInt(getRangeTimePeriod()), (int) getRangePeriodCount(), formatter));
        }
        else
        {
          numberAxis.setTickUnit
              (new DateTickUnit(getDateUnitAsInt(getRangeTimePeriod()), (int) getRangePeriodCount()));
        }
      }
      else if (getRangeTickFormatString() != null)
      {
        final SimpleDateFormat formatter = new SimpleDateFormat
            (getRangeTickFormatString(), new DateFormatSymbols(getResourceBundleFactory().getLocale()));
        numberAxis.setDateFormatOverride(formatter);
      }

    }

    if (rangeAxis != null)
View Full Code Here

      throw new IllegalArgumentException("Null 'orientation' argument.");
    }
    final CategoryAxis categoryAxis = new FormattedCategoryAxis(categoryAxisLabel,
        getCategoricalAxisMessageFormat(), getRuntime().getResourceBundleFactory().getLocale());
    categoryAxis.setCategoryMargin(0.0);
    final ValueAxis valueAxis = new NumberAxis(valueAxisLabel);

    final StackedAreaRenderer renderer = new StackedAreaRenderer();
    if (tooltips)
    {
      renderer.setBaseToolTipGenerator(
View Full Code Here

      {
        linesAxis = new NumberAxis3D(getSecondValueAxisLabel());
      }
      else
      {
        linesAxis = new NumberAxis(getSecondValueAxisLabel());
      }

      plot.setRenderer(1, lineRenderer);
      plot.setDataset(1, linesDataset);
      plot.setRangeAxis(1, linesAxis);
View Full Code Here

    if (isSharedRangeAxis() == false)
    {
      final ValueAxis linesAxis = plot.getRangeAxis(1);
      if (linesAxis instanceof NumberAxis)
      {
        final NumberAxis numberAxis = (NumberAxis) linesAxis;

        if (getLinePeriodCount() > 0)
        {
          if (getLineTicksLabelFormat() != null)
          {
            final FastDecimalFormat formatter = new FastDecimalFormat
                (getLineTicksLabelFormat(), getResourceBundleFactory().getLocale());
            numberAxis.setTickUnit(new FastNumberTickUnit(getLinePeriodCount(), formatter));
          }
          else
          {
            numberAxis.setTickUnit(new FastNumberTickUnit(getLinePeriodCount()));
          }
        }
        else
        {
          if (getLineTicksLabelFormat() != null)
          {
            final DecimalFormat formatter = new DecimalFormat
                (getLineTicksLabelFormat(), new DecimalFormatSymbols(getResourceBundleFactory().getLocale()));
            numberAxis.setNumberFormatOverride(formatter);
          }
        }
      }
      else if (linesAxis instanceof DateAxis)
      {
        final DateAxis numberAxis = (DateAxis) linesAxis;

        if (getLinePeriodCount() > 0 && getLineTimePeriod() != null)
        {
          if (getLineTicksLabelFormat() != null)
          {
            final SimpleDateFormat formatter = new SimpleDateFormat
                (getLineTicksLabelFormat(), new DateFormatSymbols(getResourceBundleFactory().getLocale()));
            numberAxis.setTickUnit
                (new DateTickUnit(getDateUnitAsInt(getLineTimePeriod()), (int) getLinePeriodCount(), formatter));
          }
          else
          {
            numberAxis.setTickUnit
                (new DateTickUnit(getDateUnitAsInt(getLineTimePeriod()), (int) getLinePeriodCount()));
          }
        }
        else if (getRangeTickFormatString() != null)
        {
          final SimpleDateFormat formatter = new SimpleDateFormat
              (getRangeTickFormatString(), new DateFormatSymbols(getResourceBundleFactory().getLocale()));
          numberAxis.setDateFormatOverride(formatter);
        }
      }

      if (linesAxis != null)
      {
View Full Code Here

                                                    final boolean stacked)
  {
    final ValueAxis timeAxis = new DateAxis(timeAxisLabel);
    timeAxis.setLowerMargin(0.02)// reduce the default margins
    timeAxis.setUpperMargin(0.02);
    final NumberAxis valueAxis = new NumberAxis(valueAxisLabel);
    valueAxis.setAutoRangeIncludesZero(false)// override default
    final XYPlot plot = new XYPlot(dataset, timeAxis, valueAxis, null);

    XYToolTipGenerator toolTipGenerator = null;
    if (tooltips)
    {
View Full Code Here

    {
      domainAxis = new DateAxis(xAxisLabel);
    }
    else
    {
      final NumberAxis axis = new NumberAxis(xAxisLabel);
      axis.setAutoRangeIncludesZero(false);
      domainAxis = axis;
    }
    final ValueAxis valueAxis = new NumberAxis(yAxisLabel);

    final XYBarRenderer renderer = new XYBarRenderer();
    renderer.setUseYInterval(true);
    if (tooltips)
    {
View Full Code Here

    {
      domainAxis = new DateAxis(xAxisLabel);
    }
    else
    {
      final NumberAxis axis = new NumberAxis(xAxisLabel);
      axis.setAutoRangeIncludesZero(false);
      domainAxis = axis;
    }
    final ValueAxis valueAxis = new NumberAxis(yAxisLabel);

    final StackedXYBarRenderer renderer = new StackedXYBarRenderer();
    renderer.setUseYInterval(true);
    if (tooltips)
    {
View Full Code Here

TOP

Related Classes of org.jfree.chart.axis.NumberAxis

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.