Examples of ValueAxis


Examples of org.jfree.chart.axis.ValueAxis

                                                 final boolean legend,
                                                 final boolean tooltips,
                                                 final boolean urls,
                                                 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;
View Full Code Here

Examples of org.jfree.chart.axis.ValueAxis

    {
      return;
    }

    //Create Axis Objects
    final ValueAxis linesAxis;
    if (isSharedRangeAxis())
    {
      linesAxis = plot.getRangeAxis();
    }
    else if (isThreeD())
View Full Code Here

Examples of org.jfree.chart.axis.ValueAxis

    final XYPlot plot = chart.getXYPlot();

    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)
      {
        final Font labelFont = Font.decode(getLabelFont());
        linesAxis.setLabelFont(labelFont);
        linesAxis.setTickLabelFont(labelFont);

        if (getLineTitleFont() != null)
        {
          linesAxis.setLabelFont(getLineTitleFont());
        }
        if (getLineTickFont() != null)
        {
          linesAxis.setTickLabelFont(getLineTickFont());
        }
        final Double lineRangeMin = getLineRangeMinimum();
        if (lineRangeMin != null)
        {
          linesAxis.setLowerBound(lineRangeMin.doubleValue());
        }
        final Double lineRangeMax = getLineRangeMaximum();
        if (lineRangeMax != null)
        {
          linesAxis.setUpperBound(lineRangeMax.doubleValue());
        }
      }
    }

    final XYLineAndShapeRenderer linesRenderer = (XYLineAndShapeRenderer) plot.getRenderer(1);
View Full Code Here

Examples of org.jfree.chart.axis.ValueAxis

    }

    plot.setOrientation(computePlotOrientation());

    // May be an axis that supports dates
    final ValueAxis domainAxis = plot.getDomainAxis();
    if (domainAxis instanceof NumberAxis)
    {
      final NumberAxis numberAxis = (NumberAxis) domainAxis;
      numberAxis.setAutoRangeIncludesZero(isDomainIncludesZero());
      numberAxis.setAutoRangeStickyZero(isDomainStickyZero());
      if (getDomainPeriodCount() > 0)
      {
        if (getDomainTickFormat() != null)
        {
          numberAxis.setTickUnit(new NumberTickUnit(getDomainPeriodCount(), getDomainTickFormat()));
        }
        else if (getDomainTickFormatString() != null)
        {
          final FastDecimalFormat formatter = new FastDecimalFormat
              (getDomainTickFormatString(), getResourceBundleFactory().getLocale());
          numberAxis.setTickUnit(new FastNumberTickUnit(getDomainPeriodCount(), formatter));
        }
        else
        {
          numberAxis.setTickUnit(new FastNumberTickUnit(getDomainPeriodCount()));
        }
      }
      else
      {
        if (getDomainTickFormat() != null)
        {
          numberAxis.setNumberFormatOverride(getDomainTickFormat());
        }
        else if (getDomainTickFormatString() != null)
        {
          final DecimalFormat formatter = new DecimalFormat
              (getDomainTickFormatString(), new DecimalFormatSymbols(getResourceBundleFactory().getLocale()));
          numberAxis.setNumberFormatOverride(formatter);
        }
      }
    }
    else if (domainAxis instanceof DateAxis)
    {
      final DateAxis numberAxis = (DateAxis) domainAxis;

      if (getDomainPeriodCount() > 0 && getDomainTimePeriod() != null)
      {
        if (getDomainTickFormatString() != null)
        {
          final SimpleDateFormat formatter = new SimpleDateFormat
              (getDomainTickFormatString(), new DateFormatSymbols(getResourceBundleFactory().getLocale()));
          numberAxis.setTickUnit
              (new DateTickUnit(getDateUnitAsInt(getDomainTimePeriod()), (int) getDomainPeriodCount(), formatter));
        }
        else
        {
          numberAxis.setTickUnit
              (new DateTickUnit(getDateUnitAsInt(getDomainTimePeriod()), (int) getDomainPeriodCount()));
        }
      }
    }

    if (domainAxis != null)
    {
      domainAxis.setLabel(getDomainTitle());
      if (getDomainTitleFont() != null)
      {
        domainAxis.setLabelFont(getDomainTitleFont());
      }
      domainAxis.setVerticalTickLabels(isDomainVerticalTickLabels());
      if (getDomainTickFont() != null)
      {
        domainAxis.setTickLabelFont(getDomainTickFont());
      }
      if (getDomainMinimum() != ValueAxis.DEFAULT_LOWER_BOUND)
      {
        domainAxis.setLowerBound(getDomainMinimum());
      }
      if (getDomainMaximum() != ValueAxis.DEFAULT_UPPER_BOUND)
      {
        domainAxis.setUpperBound(getDomainMaximum());
      }
    }

    final ValueAxis rangeAxis = plot.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)
    {
      rangeAxis.setLabel(getRangeTitle());
      if (getRangeTitleFont() != null)
      {
        rangeAxis.setLabelFont(getRangeTitleFont());
      }
      if (getRangeTickFont() != null)
      {
        rangeAxis.setTickLabelFont(getRangeTickFont());
      }
      if (getRangeMinimum() != ValueAxis.DEFAULT_LOWER_BOUND)
      {
        rangeAxis.setLowerBound(getRangeMinimum());
      }
      if (getRangeMaximum() != ValueAxis.DEFAULT_UPPER_BOUND)
      {
        rangeAxis.setUpperBound(getRangeMaximum());
      }
    }

    final String[] colors = getSeriesColor();
    for (int i = 0; i < colors.length; i++)
View Full Code Here

Examples of org.jfree.chart.axis.ValueAxis

  public BarChartShape(JFreeChart chart, int ox, int oy, int width, int height) {
    super(chart, ox, oy, width, height);
    CategoryPlot plot = chart.getCategoryPlot();
    //CategoryAxis
    ValueAxis raxis = plot.getRangeAxis();
    raxis.setAutoRange(true);
    mapperSources = new Vector();
    mappers = new Vector();
//    plot.setRenderer(new JSynopticStandardXYItemRenderer());
  }
View Full Code Here

Examples of org.jfree.chart.axis.ValueAxis

      if (pactiveEntry == null) return;
      pcurvecolor.setBackground(pactiveEntry.color);
    }

    protected void updateChartProperties() {
      ValueAxis xaxis = null;
      if (cbcyclex.isSelected()) {
        xaxis = new CyclicNumberAxis(nfperiodx.getDoubleValue(),nfoffsetx.getDoubleValue());
      } else {
        xaxis = new NumberAxis();
        if (nffixedautox.isEnabled()) xaxis.setFixedAutoRange(nffixedautox.getDoubleValue());
      }
      xaxis.setAutoRange(cbautox.isSelected());
      xaxis.setInverted(cbinvertx.isSelected());
      if (tfpxmin.isEnabled() && tfpxmax.isEnabled()) xaxis.setRange(tfpxmin.getDoubleValue(), tfpxmax.getDoubleValue());
     
      ValueAxis yaxis = null;
      if (cbcycley.isSelected()) {
        yaxis = new CyclicNumberAxis(nfperiody.getDoubleValue(),nfoffsety.getDoubleValue());
      } else {
        yaxis = new NumberAxis();
        if (nffixedautoy.isEnabled()) yaxis.setFixedAutoRange(nffixedautoy.getDoubleValue());
      }
      yaxis.setAutoRange(cbautoy.isSelected());
      yaxis.setInverted(cbinverty.isSelected());
      if (tfpymin.isEnabled() && tfpymax.isEnabled()) yaxis.setRange(tfpymin.getDoubleValue(), tfpymax.getDoubleValue());
     
      chart.setTitle(tfTitle.getText());
      XYPlot plot = chart.getXYPlot();

      plot.setDomainAxis(xaxis);
View Full Code Here

Examples of org.jfree.chart.axis.ValueAxis

    }
   
    protected void updateChartProperties() {

      //Primary X update
        ValueAxis xaxis = chart.getXYPlot().getDomainAxis();
      xaxis.setAutoRange(pcbautox.isSelected());
      if (pnffixedautox.isEnabled()) xaxis.setFixedAutoRange(pnffixedautox.getDoubleValue());
      if (ptfpxmin.isEnabled() && ptfpxmax.isEnabled()) xaxis.setRange(ptfpxmin.getDoubleValue(), ptfpxmax.getDoubleValue());
     
      //Secondary X update
        ValueAxis sxaxis = chart.getXYPlot().getSecondaryDomainAxis(0);
      if (sxaxis!=null) {
        sxaxis.setAutoRange(scbautox.isSelected());
        if (snffixedautox.isEnabled()) sxaxis.setFixedAutoRange(snffixedautox.getDoubleValue());
        if (stfpxmin.isEnabled() && stfpxmax.isEnabled()) sxaxis.setRange(stfpxmin.getDoubleValue(), stfpxmax.getDoubleValue());
      }
     
      ValueAxis yaxis = chart.getXYPlot().getRangeAxis();
      yaxis.setAutoRange(pcbautoy.isSelected());
      if (pnffixedautoy.isEnabled()) yaxis.setFixedAutoRange(pnffixedautoy.getDoubleValue());
      if (ptfpymin.isEnabled() && ptfpymax.isEnabled()) yaxis.setRange(ptfpymin.getDoubleValue(), ptfpymax.getDoubleValue());

      chart.setTitle(tfTitle.getText());
      XYPlot plot = chart.getXYPlot();

      // Primary Y update
      SourceXYDataset dst = (SourceXYDataset)plot.getDataset();
      int n = dst.getSeriesCount();

      // If some curves were deleted, remove them
      if (n != pcbxcurves.getItemCount()) {
        boolean[] toKeep = new boolean[n]; // boolean are initialized to false by JVM
        for (int i=0; i<pcbxcurves.getItemCount(); ++i)
          toKeep[((CbxEntry)pcbxcurves.getItemAt(i)).datasetIndex] = true;

        JSynopticXYItemRenderer renderer = (JSynopticXYItemRenderer)plot.getRenderer();

        // Now we can remove the deleted curves, and update the existing ones
        // Start from the end, to remove the entries and keep the index OK
        for (int i=n-1; i>=0; i--) {
          if (!toKeep[i]) {
            if (i>0) dst.removeXSource(i);
            else dst.removeYSource(i);
            renderer.removeColorMapper(i);
            renderer.removeDataSource(i);
          }
        }
      }
     
      // Now we match the data set and the list
      for (int i=0; i<pcbxcurves.getItemCount(); ++i) {
        CbxEntry e = (CbxEntry)pcbxcurves.getItemAt(i);
        dst.setName(i,e.name);
        JSynopticXYItemRenderer renderer = (JSynopticXYItemRenderer)plot.getRenderer();
        renderer.setSeriesPaint(i,e.color);
        renderer.setDataSource(i, e.source);
        renderer.setColorMapper(i, e.mapper);
      }

      // Secondary Y update
      if (plot.getSecondaryRangeAxis(0) != null) {

          ValueAxis syaxis = plot.getSecondaryRangeAxis(0);
          if (syaxis!=null) {
              syaxis.setAutoRange(scbautoy.isSelected());
              if (snffixedautoy.isEnabled()) syaxis.setFixedAutoRange(snffixedautoy.getDoubleValue());
              if (stfpymin.isEnabled() && stfpymax.isEnabled()) syaxis.setRange(stfpymin.getDoubleValue(), stfpymax.getDoubleValue());
          }
         
         
          dst = (SourceXYDataset)plot.getSecondaryDataset(0);
        n = dst.getSeriesCount();
View Full Code Here

Examples of org.jfree.chart.axis.ValueAxis

    NumberAxis axis = new NumberAxis();
    //CyclicNumberAxis axis = new CyclicNumberAxis(0, 100);
    plot.setDomainAxis(axis);
    axis.setAutoRange(true);
    //axis.setAutoRangeIncludesZero(false);
    ValueAxis vaxis = plot.getRangeAxis();
    axis.setAutoRange(true);
    if (vaxis instanceof NumberAxis) {((NumberAxis)vaxis).setAutoRangeIncludesZero(false);}
    plot.setRenderer(new JSynopticStandardXYItemRenderer());
    //plot.setRenderer(new CyclicXYItemRenderer());
    plot.setRangeCrosshairLockedOnData(false);
View Full Code Here

Examples of org.jfree.chart.axis.ValueAxis

        plot.setDomainCrosshairVisible(true);
       
        String msg = "";

        // set the crosshair value for the horizontal axis...
        ValueAxis da = plot.getDomainAxis();
        if (da != null) {
          double hvalue = da.translateJava2DToValue(x, info.getDataArea(),plot.getDomainAxisEdge());
          plot.setDomainCrosshairValue(hvalue,false);
          String label = da.getLabel();
          if ((label!=null) && (!label.equals(""))) msg += label;
          else msg+= resources.getString("X");
          msg += "=" + AxisLabelFormatter.labelFormat(hvalue);
        }

        // set the crosshair value for the vertical axis...
        ValueAxis ra = plot.getRangeAxis();
        if (ra != null) {
          double vvalue = ra.translateJava2DToValue(y, info.getDataArea(),plot.getRangeAxisEdge());
          plot.setRangeCrosshairValue(vvalue,false);
          if (!msg.equals("")) msg+="   ";
          String label = ra.getLabel();
          if ((label!=null) && (!label.equals(""))) msg += label;
          else msg+= resources.getString("Y");
          msg += "=" + AxisLabelFormatter.labelFormat(vvalue);
        }
        notifyChange(dataArea.getBounds());
View Full Code Here

Examples of org.jfree.chart.axis.ValueAxis

      XYPlot plot = chart.getXYPlot();
      NumberAxis axis = new NumberAxis();
      plot.setDomainAxis(axis);
      axis.setAutoRange(true);
      axis.setAutoRangeIncludesZero(false);
      ValueAxis vaxis = plot.getRangeAxis();
      axis.setAutoRange(true);
      if (vaxis instanceof NumberAxis) {((NumberAxis)vaxis).setAutoRangeIncludesZero(false);}
      res = new ScatterPlotShape(chart);;
   
    } else if (name.equals(PLOT_PARAMETRIC)) {
      SourceXYDataset dst = new SourceXYDataset();
      JFreeChart chart = ChartFactory.createTimeSeriesChart("", "", "", dst, true, true, false);
      chart.setAntiAlias(AbstractShape.ANTI_ALIASING);
      XYPlot plot = chart.getXYPlot();
      NumberAxis axis = new NumberAxis();
      plot.setDomainAxis(axis);
      axis.setAutoRange(true);
      axis.setAutoRangeIncludesZero(false);
      ValueAxis vaxis = plot.getRangeAxis();
      axis.setAutoRange(true);
      if (vaxis instanceof NumberAxis) {((NumberAxis)vaxis).setAutoRangeIncludesZero(false);}
      res = new ParametricPlotShape(chart);
   
    } else if (name.equals(METER)) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.