de.gsi.chart.axes.spi.TickMark Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of chartfx-chart Show documentation
Show all versions of chartfx-chart Show documentation
This charting library ${project.artifactId}- is an extension
in the spirit of Oracle's XYChart and performance/time-proven JDataViewer charting functionalities.
Emphasis was put on plotting performance for both large number of data points and real-time displays,
as well as scientific accuracies leading to error bar/surface plots, and other scientific plotting
features (parameter measurements, fitting, multiple axes, zoom, ...).
package de.gsi.chart.axes.spi;
import javafx.scene.text.Text;
/**
* TickMark represents the label text, its associated tick mark value and
* position along the axis for each tick.
*
* @author rstein
*/
public class TickMark extends Text {
private Double tickValue; // tick mark in data units
private double tickPosition; // tick position along axis in display units
/**
* Creates and initialises an instance of TickMark.
* @param tickValue numeric value of tick
* @param tickPosition position of tick in canvas pixel coordinates
* @param tickMarkLabel string label associated with tick
*/
public TickMark(final double tickValue, final double tickPosition, final String tickMarkLabel) {
super();
this.tickValue = tickValue;
this.tickPosition = tickPosition;
setText(tickMarkLabel);
}
/**
* @param newValue
* tick mark value in data units
*/
public void setValue(final Double newValue) {
tickValue = newValue;
}
/**
* @return tick mark value in data units
*/
public Double getValue() {
return tickValue;
}
/**
* @param value
* tick position along the axis in display units
*/
public void setPosition(final double value) {
tickPosition = value;
}
/**
* @return value tick position along the axis in display units
*/
public Double getPosition() {
return tickPosition;
}
/**
* @return the width of the tick mark including rotation etc.
*/
public double getWidth() {
// N.B. important: usage of getBoundsInParent() which also takes into
// account text rotations
return getBoundsInParent().getWidth();
}
/**
* @return the height of the tick mark including rotation etc.
*/
public double getHeight() {
// N.B. important: usage of getBoundsInParent() which also takes into
// account text rotations
return getBoundsInParent().getHeight();
}
}