Package org.jfree.chart.axis

Examples of org.jfree.chart.axis.NumberAxis


            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);
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;
      numberAxis.setAutoRangeIncludesZero(isRangeIncludesZero());
      numberAxis.setAutoRangeStickyZero(isRangeStickyZero());

      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;
        numberAxis.setAutoRangeIncludesZero(isLineAxisIncludesZero());
        numberAxis.setAutoRangeStickyZero(isLineAxisStickyZero());

        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

         XYItemRenderer renderer,
         Color col)
   {
      this(
            dataset,
            new NumberAxis(strDomainAxis),
            new NumberAxis(strRangeAxis),
            renderer,
            col);
   }
View Full Code Here

                0.05);
        this.dataset = dataset;
        if (dataset != null) {
            dataset.addChangeListener(this);
        }
        NumberAxis axis = new NumberAxis(null);
        axis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
        axis.setAxisLineVisible(false);
        axis.setPlot(this);
        axis.addChangeListener(this);
        this.rangeAxis = axis;
        setAxisRange();
    }
View Full Code Here

                                                    String valueAxisLabel,
                                                    OHLCDataset dataset,
                                                    boolean legend) {

        ValueAxis timeAxis = new DateAxis(timeAxisLabel);
        NumberAxis valueAxis = new NumberAxis(valueAxisLabel);
        XYPlot plot = new XYPlot(dataset, timeAxis, valueAxis, null);
        plot.setRenderer(new CandlestickRenderer());
        JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
                plot, legend);
        currentTheme.apply(chart);
View Full Code Here

                                                String valueAxisLabel,
                                                OHLCDataset dataset,
                                                boolean legend) {

        ValueAxis timeAxis = new DateAxis(timeAxisLabel);
        NumberAxis valueAxis = new NumberAxis(valueAxisLabel);
        HighLowRenderer renderer = new HighLowRenderer();
        renderer.setBaseToolTipGenerator(new HighLowItemLabelGenerator());
        XYPlot plot = new XYPlot(dataset, timeAxis, valueAxis, renderer);
        JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
                plot, legend);
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.