Tabnine Logo
TickUnitSource
Code IndexAdd Tabnine to your IDE (free)

How to use
TickUnitSource
in
org.jfree.chart.axis

Best Java code snippets using org.jfree.chart.axis.TickUnitSource (Showing top 20 results out of 315)

origin: tflobbe/solrmeter

/**
 * Constructs a new LowerBoundedTickUnitSource. The lowest TickUnit
 * returned by this TickUnitSource will be
 * {@code decorated.getCeilingTickUnit(lowerBound)}.
 * 
 * @param decorated the default TickUnitSource
 * @param lowerBound the lower bound
 */
public LowerBoundedTickUnitSource(TickUnitSource decorated, double lowerBound) {
  this.decorated = decorated;
  this.lowerUnit = decorated.getCeilingTickUnit(lowerBound);
}
 
origin: tflobbe/solrmeter

  @Override
  public TickUnit getLargerTickUnit(TickUnit unit) {
    TickUnit newUnit = decorated.getLargerTickUnit(unit);
    if(newUnit.compareTo(lowerUnit)<0) {
      return lowerUnit;
    } else {
      return newUnit;
    }
  }
};
origin: jfree/jfreechart

/**
 * Selects an appropriate tick size for the axis.  The strategy is to
 * display as many ticks as possible (selected from a collection of
 * 'standard' tick units) without the labels overlapping.
 *
 * @param g2  the graphics device.
 * @param dataArea  the area defined by the axes.
 * @param edge  the axis location.
 */
protected void selectHorizontalAutoTickUnit(Graphics2D g2,
    Rectangle2D dataArea, RectangleEdge edge) {
  double zero = valueToJava2D(0.0, dataArea, edge);
  double tickLabelWidth = estimateMaximumTickLabelWidth(g2,
      getTickUnit());
  // start with the current tick unit...
  TickUnitSource tickUnits = getStandardTickUnits();
  TickUnit unit1 = tickUnits.getCeilingTickUnit(getTickUnit());
  double x1 = valueToJava2D(unit1.getSize(), dataArea, edge);
  double unit1Width = Math.abs(x1 - zero);
  // then extrapolate...
  double guess = (tickLabelWidth / unit1Width) * unit1.getSize();
  DateTickUnit unit2 = (DateTickUnit) tickUnits.getCeilingTickUnit(guess);
  double x2 = valueToJava2D(unit2.getSize(), dataArea, edge);
  double unit2Width = Math.abs(x2 - zero);
  tickLabelWidth = estimateMaximumTickLabelWidth(g2, unit2);
  if (tickLabelWidth > unit2Width) {
    unit2 = (DateTickUnit) tickUnits.getLargerTickUnit(unit2);
  }
  setTickUnit(unit2, false, false);
}
origin: org.codehaus.jtstand/jtstand-chart

/**
 * Selects an appropriate tick value for the axis.  The strategy is to
 * display as many ticks as possible (selected from an array of 'standard'
 * tick units) without the labels overlapping.
 *
 * @param g2  the graphics device.
 * @param dataArea  the area in which the plot should be drawn.
 * @param edge  the axis location.
 */
protected void selectVerticalAutoTickUnit(Graphics2D g2,
                     Rectangle2D dataArea,
                     RectangleEdge edge) {
  double tickLabelHeight = estimateMaximumTickLabelHeight(g2);
  // start with the current tick unit...
  TickUnitSource tickUnits = getStandardTickUnits();
  TickUnit unit1 = tickUnits.getCeilingTickUnit(getTickUnit());
  double unitHeight = lengthToJava2D(unit1.getSize(), dataArea, edge);
  // then extrapolate...
  double guess = (tickLabelHeight / unitHeight) * unit1.getSize();
  NumberTickUnit unit2
    = (NumberTickUnit) tickUnits.getCeilingTickUnit(guess);
  double unit2Height = lengthToJava2D(unit2.getSize(), dataArea, edge);
  tickLabelHeight = estimateMaximumTickLabelHeight(g2);
  if (tickLabelHeight > unit2Height) {
    unit2 = (NumberTickUnit) tickUnits.getLargerTickUnit(unit2);
  }
  setTickUnit(unit2, false, false);
}
origin: org.codehaus.jtstand/jtstand-chart

TickUnit unit1 = tickUnits.getCeilingTickUnit(getTickUnit());
double x1 = valueToJava2D(shift + unit1.getSize(), dataArea, edge);
double unit1Width = Math.abs(x1 - zero);
DateTickUnit unit2 = (DateTickUnit) tickUnits.getCeilingTickUnit(guess);
double x2 = valueToJava2D(shift + unit2.getSize(), dataArea, edge);
double unit2Width = Math.abs(x2 - zero);
tickLabelWidth = estimateMaximumTickLabelWidth(g2, unit2);
if (tickLabelWidth > unit2Width) {
  unit2 = (DateTickUnit) tickUnits.getLargerTickUnit(unit2);
origin: tflobbe/solrmeter

@Override
public TickUnit getCeilingTickUnit(double size) {
  TickUnit newUnit = decorated.getCeilingTickUnit(size);
  if(newUnit.compareTo(lowerUnit)<0) {
    return lowerUnit;
  } else {
    return newUnit;
  }
}
 
origin: jfree/jfreechart

int count = (int) (length / unit.getSize());
if (count < 2 || count > 40) {
  unit = tickUnitSource.getCeilingTickUnit(length / 20);
TickUnit unit1 = tickUnitSource.getCeilingTickUnit(unit);
double unit1Width = lengthToJava2D(unit1.getSize(), dataArea, edge);
    tickUnitSource.getCeilingTickUnit(guess);
double unit2Width = lengthToJava2D(unit2.getSize(), dataArea, edge);
  unit2 = (NumberTickUnit) tickUnitSource.getLargerTickUnit(unit2);
origin: tflobbe/solrmeter

@Override
public TickUnit getCeilingTickUnit(TickUnit unit) {
  TickUnit newUnit = decorated.getCeilingTickUnit(unit);
  if(newUnit.compareTo(lowerUnit)<0) {
    return lowerUnit;
  } else {
    return newUnit;
  }
}
 
origin: org.codehaus.jtstand/jtstand-chart

TickUnit unit1 = tickUnits.getCeilingTickUnit(getTickUnit());
double unitHeight = exponentLengthToJava2D(unit1.getSize(), dataArea,
    edge);
    tickUnits.getCeilingTickUnit(guess);
double unit2Height = exponentLengthToJava2D(unit2.getSize(), dataArea,
    edge);
  unit2 = (NumberTickUnit) tickUnits.getLargerTickUnit(unit2);
origin: jfree/jfreechart

/**
 * Selects a tick unit when the axis is displayed horizontally.
 *
 * @param g2  the graphics device.
 * @param drawArea  the drawing area.
 * @param dataArea  the data area.
 * @param edge  the side of the rectangle on which the axis is displayed.
 */
protected void selectHorizontalAutoTickUnit(Graphics2D g2,
    Rectangle2D drawArea, Rectangle2D dataArea, RectangleEdge edge) {
  double tickLabelWidth
    = estimateMaximumTickLabelWidth(g2, getTickUnit());
  // Compute number of labels
  double n = getRange().getLength()
        * tickLabelWidth / dataArea.getWidth();
  setTickUnit(
      (NumberTickUnit) getStandardTickUnits().getCeilingTickUnit(n),
      false, false);
 }
origin: jfree/jfreechart

  = (DateTickUnit) tickUnits.getCeilingTickUnit(estimate1);
double labelHeight1 = estimateMaximumTickLabelHeight(g2, candidate1);
double y1 = valueToJava2D(candidate1.getSize(), dataArea, edge);
  = (labelHeight1 / candidate1UnitHeight) * candidate1.getSize();
DateTickUnit candidate2
  = (DateTickUnit) tickUnits.getCeilingTickUnit(estimate2);
double labelHeight2 = estimateMaximumTickLabelHeight(g2, candidate2);
double y2 = valueToJava2D(candidate2.getSize(), dataArea, edge);
  finalUnit = (DateTickUnit) tickUnits.getLargerTickUnit(candidate2);
origin: jfree/jfreechart

/**
 * Selects a tick unit when the axis is displayed vertically.
 *
 * @param g2  the graphics device.
 * @param drawArea  the drawing area.
 * @param dataArea  the data area.
 * @param edge  the side of the rectangle on which the axis is displayed.
 */
protected void selectVerticalAutoTickUnit(Graphics2D g2,
    Rectangle2D drawArea, Rectangle2D dataArea, RectangleEdge edge) {
  double tickLabelWidth
    = estimateMaximumTickLabelWidth(g2, getTickUnit());
  // Compute number of labels
  double n = getRange().getLength()
        * tickLabelWidth / dataArea.getHeight();
  setTickUnit(
    (NumberTickUnit) getStandardTickUnits().getCeilingTickUnit(n),
    false, false);
 }
origin: org.codehaus.jtstand/jtstand-chart

  = (DateTickUnit) tickUnits.getCeilingTickUnit(estimate1);
double labelHeight1 = estimateMaximumTickLabelHeight(g2, candidate1);
double y1 = valueToJava2D(candidate1.getSize(), dataArea, edge);
  = (labelHeight1 / candidate1UnitHeight) * candidate1.getSize();
DateTickUnit candidate2
  = (DateTickUnit) tickUnits.getCeilingTickUnit(estimate2);
double labelHeight2 = estimateMaximumTickLabelHeight(g2, candidate2);
double y2 = valueToJava2D(candidate2.getSize(), dataArea, edge);
  finalUnit = (DateTickUnit) tickUnits.getLargerTickUnit(candidate2);
origin: org.codehaus.jtstand/jtstand-chart

/**
 * Selects a tick unit when the axis is displayed vertically.
 *
 * @param g2  the graphics device.
 * @param drawArea  the drawing area.
 * @param dataArea  the data area.
 * @param edge  the side of the rectangle on which the axis is displayed.
 */
protected void selectVerticalAutoTickUnit(Graphics2D g2,
                      Rectangle2D drawArea,
                      Rectangle2D dataArea,
                      RectangleEdge edge) {
  double tickLabelWidth
    = estimateMaximumTickLabelWidth(g2, getTickUnit());
  // Compute number of labels
  double n = getRange().getLength()
        * tickLabelWidth / dataArea.getHeight();
  setTickUnit(
    (NumberTickUnit) getStandardTickUnits().getCeilingTickUnit(n),
    false, false
  );
 }
origin: org.codehaus.jtstand/jtstand-chart

/**
 * Selects an appropriate tick value for the axis.  The strategy is to
 * display as many ticks as possible (selected from an array of 'standard'
 * tick units) without the labels overlapping.
 *
 * @param g2  the graphics device.
 * @param dataArea  the area defined by the axes.
 * @param edge  the axis location.
 */
protected void selectHorizontalAutoTickUnit(Graphics2D g2,
                      Rectangle2D dataArea,
                      RectangleEdge edge) {
  double tickLabelWidth = estimateMaximumTickLabelWidth(g2,
      getTickUnit());
  // start with the current tick unit...
  TickUnitSource tickUnits = getStandardTickUnits();
  TickUnit unit1 = tickUnits.getCeilingTickUnit(getTickUnit());
  double unit1Width = lengthToJava2D(unit1.getSize(), dataArea, edge);
  // then extrapolate...
  double guess = (tickLabelWidth / unit1Width) * unit1.getSize();
  NumberTickUnit unit2 = (NumberTickUnit) tickUnits.getCeilingTickUnit(
      guess);
  double unit2Width = lengthToJava2D(unit2.getSize(), dataArea, edge);
  tickLabelWidth = estimateMaximumTickLabelWidth(g2, unit2);
  if (tickLabelWidth > unit2Width) {
    unit2 = (NumberTickUnit) tickUnits.getLargerTickUnit(unit2);
  }
  setTickUnit(unit2, false, false);
}
origin: org.codehaus.jtstand/jtstand-chart

/**
 * Selects a tick unit when the axis is displayed horizontally.
 *
 * @param g2  the graphics device.
 * @param drawArea  the drawing area.
 * @param dataArea  the data area.
 * @param edge  the side of the rectangle on which the axis is displayed.
 */
protected void selectHorizontalAutoTickUnit(Graphics2D g2,
                      Rectangle2D drawArea,
                      Rectangle2D dataArea,
                      RectangleEdge edge) {
  double tickLabelWidth
    = estimateMaximumTickLabelWidth(g2, getTickUnit());
  // Compute number of labels
  double n = getRange().getLength()
        * tickLabelWidth / dataArea.getWidth();
  setTickUnit(
    (NumberTickUnit) getStandardTickUnits().getCeilingTickUnit(n),
    false, false
  );
 }
origin: org.codehaus.jtstand/jtstand-chart

TickUnit unit1 = tickUnits.getCeilingTickUnit(getTickUnit());
double unit1Width = exponentLengthToJava2D(unit1.getSize(), dataArea,
    edge);
    tickUnits.getCeilingTickUnit(guess);
double unit2Width = exponentLengthToJava2D(unit2.getSize(), dataArea,
    edge);
  unit2 = (NumberTickUnit) tickUnits.getLargerTickUnit(unit2);
origin: jfree/jfreechart

TickUnit unit1 = tickUnits.getCeilingTickUnit(getTickUnit());
double unitHeight = lengthToJava2D(unit1.getSize(), dataArea, edge);
double guess;
  guess = getRange().getLength() / 20.0;
NumberTickUnit unit2 = (NumberTickUnit) tickUnits.getCeilingTickUnit(
    guess);
double unit2Height = lengthToJava2D(unit2.getSize(), dataArea, edge);
  unit2 = (NumberTickUnit) tickUnits.getLargerTickUnit(unit2);
origin: jfree/jfreechart

double size = (logAxisMax - logAxisMin) / 50;
TickUnitSource tickUnits = getStandardTickUnits();
TickUnit candidate = tickUnits.getCeilingTickUnit(size);
TickUnit prevCandidate = candidate;
boolean found = false;
  } else {
    prevCandidate = candidate;
    candidate = tickUnits.getLargerTickUnit(prevCandidate);
    if (candidate.equals(prevCandidate)) {
      found = true;  // there are no more candidates
origin: jfree/jfreechart

double size = (logAxisMax - logAxisMin) / 50;
TickUnitSource tickUnits = getStandardTickUnits();
TickUnit candidate = tickUnits.getCeilingTickUnit(size);
TickUnit prevCandidate = candidate;
boolean found = false;
  } else {
    prevCandidate = candidate;
    candidate = tickUnits.getLargerTickUnit(prevCandidate);
    if (candidate.equals(prevCandidate)) {
      found = true;  // there are no more candidates
org.jfree.chart.axisTickUnitSource

Javadoc

An interface used by the DateAxis and NumberAxis classes to obtain a suitable TickUnit.

Most used methods

  • getCeilingTickUnit
    Returns the tick unit in the collection that is greater than or equal to (in size) the specified uni
  • getLargerTickUnit
    Returns a tick unit that is larger than the supplied unit.

Popular in Java

  • Making http requests using okhttp
  • getApplicationContext (Context)
  • setRequestProperty (URLConnection)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • Color (java.awt)
    The Color class is used to encapsulate colors in the default sRGB color space or colors in arbitrary
  • Graphics2D (java.awt)
    This Graphics2D class extends the Graphics class to provide more sophisticated control overgraphics
  • Time (java.sql)
    Java representation of an SQL TIME value. Provides utilities to format and parse the time's represen
  • BoxLayout (javax.swing)
  • JFileChooser (javax.swing)
  • LoggerFactory (org.slf4j)
    The LoggerFactory is a utility class producing Loggers for various logging APIs, most notably for lo
  • Github Copilot alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now