Examples of NumberAxis


Examples of org.jfree.chart.axis.NumberAxis

        }
        dst2.setDataSourceCollection((DataSourceCollection)o);
        //If we got no secondary domain axis
        if (plot.getSecondaryDomainAxis(0)==null) {
          //we build a new one
          NumberAxis axis = new NumberAxis();
          axis.setAutoRange(true);
          //and link it
          plot.setSecondaryDomainAxis(0,axis);
        }
        //If we got no secondary range axis
        if (plot.getSecondaryRangeAxis(0)==null) {
          //We build a new one
          NumberAxis axis = new NumberAxis();
          axis.setAutoRange(true);
          //and link it
          plot.setSecondaryRangeAxis(0,axis);
        }
        //We reset the title
        chart.setTitle(chart.getTitle().getText() + " and " + dst2.getName());
        //We set Xlabel
        plot.getSecondaryDomainAxis(0).setLabel(dst2.getXLabel(0));
        //If necessary we set the renderer
        if (plot.getSecondaryRenderer(0)==null) {
          plot.setSecondaryRenderer(0,new JSynopticStandardXYItemRenderer(2));
        }
        //We map the secondary dataset to secondary domain axis
        plot.mapSecondaryDatasetToDomainAxis(0,new Integer(0));
        //We map the secondary dataset to secondary range axis
        plot.mapSecondaryDatasetToRangeAxis(0,new Integer(0));
        notifyChange();
      } catch (ClassCastException cce) {
        JSynoptic.setStatus(resources.getString("ErrorWhileSettingXDataSource"));
     
    }
   
    if (action.equals(resources.getString("addSecY1Yn"))) {
      try {
        XYPlot plot = chart.getXYPlot();
        SourceXYDataset dst2 = (SourceXYDataset)plot.getSecondaryDataset(0);
        dst2.addYSource((DataSource)o);
        //If we got no secondary range axis
        if (plot.getSecondaryRangeAxis(0)==null) {
          //We build a new one
          NumberAxis axis = new NumberAxis();
          axis.setAutoRange(true);
          //and link it
          plot.setSecondaryRangeAxis(0,axis);
        }
        //We map the secondary dataset to secondary range axis
        plot.mapSecondaryDatasetToRangeAxis(0,new Integer(0));
        notifyChange();
      } catch (ClassCastException cce) {
        JSynoptic.setStatus(resources.getString("ErrorWhileAddingYDataSource"));
      }
    }
   
    //for DataSource ----> dirty duplication...
    if (action.equals(resources.getString("setX"))) {
      try {
        XYPlot plot = chart.getXYPlot();
        SourceXYDataset dst = (SourceXYDataset)plot.getDataset();
        dst.setXSource((DataSource)o);
        plot.getDomainAxis().setLabel(dst.getXLabel(0));
        notifyChange();
      } catch (ClassCastException cce) {
        JSynoptic.setStatus(resources.getString("ErrorWhileSettingXDataSource"));
      }
    }
   
    if (action.equals(resources.getString("addY"))) {
      try {
        XYPlot plot = chart.getXYPlot();
        SourceXYDataset dst = (SourceXYDataset)plot.getDataset();
        dst.addYSource((DataSource)o);
        notifyChange();
      } catch (ClassCastException cce) {
        JSynoptic.setStatus(resources.getString("ErrorWhileAddingYDataSource"));
      }
    }
 

   
    if (action.equals(resources.getString("setSecX"))) {
      try {
        XYPlot plot = chart.getXYPlot();
        SourceXYDataset dst2 = (SourceXYDataset)plot.getSecondaryDataset(0);
        //If not any previous Secondary Dataset was found
        if (dst2==null) {
          //we build a new one
          dst2 = new SourceXYDataset();
          //and link it
          plot.setSecondaryDataset(0,dst2);
        }
        dst2.setXSource((DataSource)o);
        //If we got no axis
        if (plot.getSecondaryDomainAxis(0)==null) {
          //we build a new one
          NumberAxis axis = new NumberAxis();
          axis.setAutoRange(true);
          //and link it
          plot.setSecondaryDomainAxis(0,axis);
        }
        //We set the label
        plot.getSecondaryDomainAxis(0).setLabel(dst2.getXLabel(0));
        //If necessary we set the renderer
        if (plot.getSecondaryRenderer(0)==null) {
          plot.setSecondaryRenderer(0,new JSynopticStandardXYItemRenderer(2));
        }
        //We map the secondary dataset to secondary domain axis
        plot.mapSecondaryDatasetToDomainAxis(0,new Integer(0));
        notifyChange();
      } catch (ClassCastException cce) {
        JSynoptic.setStatus(resources.getString("ErrorWhileSettingXDataSource"));
      }
    }

    if (action.equals(resources.getString("addSecY"))) {
      try {
        XYPlot plot = chart.getXYPlot();
        SourceXYDataset dst2 = (SourceXYDataset)plot.getSecondaryDataset(0);
        dst2.addYSource((DataSource)o);
        //If we got no axis
        if (plot.getSecondaryRangeAxis(0)==null) {
          //We build a new one
          NumberAxis axis = new NumberAxis();
          axis.setAutoRange(true);
          //and link it
          plot.setSecondaryRangeAxis(0,axis);
        }
        //We map the secondary dataset to secondary range axis
        plot.mapSecondaryDatasetToRangeAxis(0,new Integer(0));
View Full Code Here

Examples of org.jfree.chart.axis.NumberAxis

    } else if (name.equals(PLOT_SCATTER)) {
      SourceXYDataset dst = new SourceXYDataset();
      JFreeChart chart = ChartFactory.createScatterPlot("", "", "", dst, PlotOrientation.VERTICAL, 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 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)) {
      SourceMeterDataset dst = new SourceMeterDataset();
View Full Code Here

Examples of org.jfree.chart.axis.NumberAxis

      return;
    }
   
    if(axis instanceof NumberAxis)
    {
      NumberAxis numberAxis = (NumberAxis)axis;
      int axisRange = (int)numberAxis.getRange().getLength();
      if(axisRange > 0)
      {
        if(tickInterval != null)
        {
          if(numberAxis.getNumberFormatOverride() != null)
          {
            numberAxis.setTickUnit(new NumberTickUnit(tickInterval.doubleValue(), numberAxis.getNumberFormatOverride()));
          }
          else
          {
            numberAxis.setTickUnit(new NumberTickUnit(tickInterval.doubleValue()));
          }
        }
        else if (tickCount != null)
        {
          if(numberAxis.getNumberFormatOverride() != null)
          {
            numberAxis.setTickUnit(new NumberTickUnit(axisRange / tickCount.intValue(), numberAxis.getNumberFormatOverride()));
          }
          else
          {
            numberAxis.setTickUnit(new NumberTickUnit(axisRange / tickCount.intValue()));
          }
        }
      }
    }
//    else if(axis instanceof DateAxis)
View Full Code Here

Examples of org.jfree.chart.axis.NumberAxis

//          numberAxis.setTickUnit(new NumberTickUnit(axisRange/tickCount));
//      }
//    }
    if(axis instanceof NumberAxis)
    {
      NumberAxis numberAxis = (NumberAxis)axis;
      int axisRange = (int)numberAxis.getRange().getLength();
      if(axisRange > 0)
      {
        if(tickInterval != null)
        {
          if(numberAxis.getNumberFormatOverride() != null)
          {
            numberAxis.setTickUnit(new NumberTickUnit(tickInterval.doubleValue(), numberAxis.getNumberFormatOverride()));
          }
          else
          {
            numberAxis.setTickUnit(new NumberTickUnit(tickInterval.doubleValue()));
          }
        }
        else if (tickCount != null)
        {
          int newTickUnitSize = axisRange / tickCount.intValue();
          if(newTickUnitSize > numberAxis.getTickUnit().getSize())
          {
            int tickUnitSize = newTickUnitSize;
     
            //preferably multiple of 5 values should be used as tick units lengths:
            int i = 1;
            while(tickUnitSize > 9)
            {
              tickUnitSize /= 10;
              i *= 10;
            }
            tickUnitSize *= i;
            newTickUnitSize = tickUnitSize + i/2;
     
            if(newTickUnitSize > 0 && axisRange / newTickUnitSize > tickCount.intValue())
            {
              newTickUnitSize += i / 2;
            }
            if(numberAxis.getNumberFormatOverride() != null)
            {
              numberAxis.setTickUnit(new NumberTickUnit(newTickUnitSize, numberAxis.getNumberFormatOverride()));
            }
            else
            {
              numberAxis.setTickUnit(new NumberTickUnit(newTickUnitSize));
            }
          }
        }
      }
    }
View Full Code Here

Examples of org.jfree.chart.axis.NumberAxis

      return;
    }
   
    if(axis instanceof NumberAxis)
    {
      NumberAxis numberAxis = (NumberAxis)axis;
      int axisRange = (int)numberAxis.getRange().getLength();
      if(axisRange > 0)
      {
        if(tickInterval != null)
        {
          if(numberAxis.getNumberFormatOverride() != null)
          {
            numberAxis.setTickUnit(new NumberTickUnit(tickInterval.doubleValue(), numberAxis.getNumberFormatOverride()));
          }
          else
          {
            numberAxis.setTickUnit(new NumberTickUnit(tickInterval.doubleValue()));
          }
        }
        else if (tickCount != null)
        {
          if(numberAxis.getNumberFormatOverride() != null)
          {
            numberAxis.setTickUnit(new NumberTickUnit(axisRange / tickCount.intValue(), numberAxis.getNumberFormatOverride()));
          }
          else
          {
            numberAxis.setTickUnit(new NumberTickUnit(axisRange / tickCount.intValue()));
          }
        }
      }
    }
//    else if(axis instanceof DateAxis)
View Full Code Here

Examples of org.jfree.chart.axis.NumberAxis

        plot.setDomainGridlinePaint(Color.white);
        plot.setDomainGridlinesVisible(true);
        plot.setRangeGridlinePaint(Color.white);
       
        // set the range axis to display integers only...
        NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
        rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
        rangeAxis.setUpperMargin(0.0);
       
        // disable bar outlines...
        BarRenderer renderer = (BarRenderer) plot.getRenderer();
        renderer.setDrawBarOutline(false);
       
View Full Code Here

Examples of org.jfree.chart.axis.NumberAxis

        if (normalized) {
            domainAxis.setRange(-0.05, 1.05);
        } else {
            domainAxis.setRange(dSeries.getMinX() - 1, dSeries.getMaxX() + 1);
        }
        NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
        rangeAxis.setRange(-1, dSeries.getMaxY() + 0.1 * dSeries.getMaxY());
    }
View Full Code Here

Examples of org.jfree.chart.axis.NumberAxis

    JFreeChart chart = ChartFactory.createXYLineChart(chartName, xDomain, yDomain, collection, PlotOrientation.VERTICAL, true, true, false);
    XYPlot plot = chart.getXYPlot();
    plot.setBackgroundPaint(Color.WHITE);
    plot.setDomainGridlinePaint(Color.LIGHT_GRAY);
    plot.setRangeGridlinePaint(Color.LIGHT_GRAY);
    NumberAxis yAxis = (NumberAxis) plot.getRangeAxis();
    Range rangeBounds = collection.getRangeBounds(true);
    double upper = Math.min(rangeBounds.getUpperBound(), rangeBounds.getLowerBound()*5);
    if(upper == 0.0){ upper = 10000; }
    if(rangeBounds.getLowerBound() == upper){
      yAxis.setRangeWithMargins(rangeBounds.getLowerBound()-rangeBounds.getLowerBound()*.1,upper+upper*.1);
    }
    else{
      yAxis.setRangeWithMargins(rangeBounds.getLowerBound(),upper);
    }
    return chart;
  }
View Full Code Here

Examples of org.jfree.chart.axis.NumberAxis

      XYItemRenderer solutionRenderer = getRouteRenderer(solution);
      plot.setDataset(2, solution);
      plot.setRenderer(2, solutionRenderer);
    }
   
    NumberAxis xAxis = new NumberAxis();
    NumberAxis yAxis = new NumberAxis();
   
    if(boundingBox == null){
      xAxis.setRangeWithMargins(getDomainRange(problem));
      yAxis.setRangeWithMargins(getRange(problem));
    }
    else{
      xAxis.setRangeWithMargins(new Range(boundingBox.minX, boundingBox.maxX));
      yAxis.setRangeWithMargins(new Range(boundingBox.minY, boundingBox.maxY));
    }
   
    plot.setDomainAxis(xAxis);
    plot.setRangeAxis(yAxis);
   
View Full Code Here

Examples of org.jfree.chart.axis.NumberAxis

      xyDataset.addSeries(targetSeries);

    }

    ValueAxis timeAxis = null;
    NumberAxis valueAxis = new NumberAxis("");
    valueAxis.setAutoRangeIncludesZero(false);
    int timeIndex = -1;
    boolean timeAxisIsDate = false;
    if (forecaster instanceof TSLagUser && data != null) {
      TSLagMaker lagMaker = ((TSLagUser) forecaster).getTSLagMaker();
      if (!lagMaker.isUsingAnArtificialTimeIndex()
          && lagMaker.getAdjustForTrends()) {
        String timeName = lagMaker.getTimeStampField();
        if (data.attribute(timeName).isDate()) {
          timeAxis = new DateAxis("");
          timeAxisIsDate = true;
          timeIndex = data.attribute(timeName).index();
        }
      }
    }

    if (timeAxis == null) {
      timeAxis = new NumberAxis("");
      ((NumberAxis) timeAxis).setAutoRangeIncludesZero(false);
    }

    // now populate the series
    boolean hasConfidenceIntervals = false;
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.