本文整理汇总了Java中info.monitorenter.gui.chart.IAxis.getRange方法的典型用法代码示例。如果您正苦于以下问题:Java IAxis.getRange方法的具体用法?Java IAxis.getRange怎么用?Java IAxis.getRange使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类info.monitorenter.gui.chart.IAxis
的用法示例。
在下文中一共展示了IAxis.getRange方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getScaleValues
import info.monitorenter.gui.chart.IAxis; //导入方法依赖的package包/类
/**
* Uses the transformation function callbacks ({@link AAxisTransformation#transform(double)}, {@link AAxisTransformation#untransform(double)})
* of the {@link AAxisTransformation} this instance may be used with to have the scale transformed accordingly.
* <p>
*/
@SuppressWarnings("unchecked")
public List<LabeledValue> getScaleValues(final Graphics g2d, final IAxis<?> axis) {
// Might give a class cast exception in case this was not called from the AAxisTranfsormation itself:
AAxisTransformation<AxisScalePolicyTransformation> axisTransformation = (AAxisTransformation<AxisScalePolicyTransformation>) axis;
final List<LabeledValue> collect = new LinkedList<LabeledValue>();
LabeledValue label;
final Range domain = axis.getRange();
double min = domain.getMin();
double max = domain.getMax();
min = axisTransformation.transform(min);
max = axisTransformation.transform(max);
double range = max - min;
double exp = 0.;
double val = axisTransformation.untransform(0);
while (val <= axis.getMax()) {
if (val >= axis.getMin()) {
label = new LabeledValue();
label.setValue(val);
label.setLabel(axis.getFormatter().format(label.getValue()));
label.setMajorTick(true);
label.setValue((axisTransformation.transform(label.getValue()) - min) / range);
collect.add(label);
}
exp += 1.;
val = axisTransformation.untransform(exp);
}
return collect;
}
示例2: setAxis
import info.monitorenter.gui.chart.IAxis; //导入方法依赖的package包/类
/**
* @see ALabelFormatter#setAxis(IAxis)
*/
@Override
public void setAxis(final IAxis<?> axis) {
this.m_delegate.setAxis(axis);
final Range range = axis.getRange();
this.chooseUnit(range.getMin(), range.getMax());
}
示例3: getLabels
import info.monitorenter.gui.chart.IAxis; //导入方法依赖的package包/类
/**
* Returns the labels for this axis.
* <p>
* The labels will have at least the given argument <code>resolution</code> as
* distance in the value domain of the chart.
* <p>
*
* @param resolution
* the distance in the value domain of the chart that has to be at
* least between to labels.
*
* @return the labels for the axis.
*/
protected List<LabeledValue> getLabels(final double resolution, final IAxis<?> axis) {
final List<LabeledValue> collect = new LinkedList<LabeledValue>();
if (resolution > 0) {
final Range domain = axis.getRange();
final double min = domain.getMin();
final double max = domain.getMax();
String oldLabelName = "";
LabeledValue label;
final double range = max - min;
final double tickResolution = this.roundToTicks(resolution, false, false, axis).getValue();
double value = Math.ceil(min / tickResolution) * tickResolution;
// This was value before the patch that prevents the labels from jumping:
// It's benefit was that the first label was not this
// far from the start of data (in case startMajorTicks of axis is true):
// double value = min;
String labelName = "start";
int loopStop = 0;
boolean firstMajorFound = false;
// first tick, manual init
while ((value <= max) && (loopStop < 100)) {
if (loopStop == 99) {
if (AAxis.DEBUG) {
System.out.println(axis.getAccessor().toString() + " axis: loop to high");
}
}
if (oldLabelName.equals(labelName)) {
if (AAxis.DEBUG) {
System.out.println("constant Label " + labelName);
}
}
label = this.roundToTicks(value, false, !firstMajorFound && axis.isStartMajorTick(), axis);
oldLabelName = labelName;
labelName = label.getLabel();
value = label.getValue();
loopStop++;
if (firstMajorFound || !axis.isStartMajorTick() || label.isMajorTick()) {
firstMajorFound = true;
if ((value <= max) && (value >= min)) {
collect.add(label);
} else if (value > max) {
if (AAxis.DEBUG) {
System.out.println("Dropping label (too high) : (" + label + ")[max: " + max + "]");
}
} else if (value < min) {
if (AAxis.DEBUG) {
System.out.println("Dropping label (too low) : (" + label + ")[min: " + min + "]");
}
}
}
value += resolution;
}
final int stop = collect.size();
for (int i = 0; i < stop; i++) {
label = collect.get(i);
label.setValue((label.getValue() - min) / range);
}
}
return collect;
}
示例4: getLabels
import info.monitorenter.gui.chart.IAxis; //导入方法依赖的package包/类
/**
* Returns the labels for this axis.
* <p>
*
*
* @return the labels for the axis.
*/
protected List<LabeledValue> getLabels(final IAxis<?> axis) {
final List<LabeledValue> collect = new LinkedList<LabeledValue>();
double minorTickSpacing = axis.getMinorTickSpacing();
double majorTickSpacing = axis.getMajorTickSpacing();
if (minorTickSpacing > 0) {
final Range domain = axis.getRange();
final double min = domain.getMin();
final double max = domain.getMax();
String oldLabelName = "";
LabeledValue label;
final double range = max - min;
double value;
if (axis.isStartMajorTick()) {
value = ((int) (min / majorTickSpacing)) * (majorTickSpacing);
if (value < min) {
value += majorTickSpacing;
}
} else {
value = ((int) (min / minorTickSpacing)) * (minorTickSpacing);
}
String labelName = "start";
int loopStop = 0;
// first tick, manual init
while ((value <= max) && (loopStop < 100)) {
if (loopStop == 99) {
if (AAxis.DEBUG) {
System.out.println(axis.getAccessor().toString() + " axis: loop to high");
}
}
if (oldLabelName.equals(labelName)) {
if (AAxis.DEBUG) {
System.out.println("constant Label " + labelName);
}
}
label = this.createLabeledValue(value, majorTickSpacing, axis);
oldLabelName = labelName;
labelName = label.getLabel();
value = label.getValue();
loopStop++;
if ((value <= max) && (value >= min)) {
collect.add(label);
} else if (value > max) {
if (AAxis.DEBUG) {
System.out.println("Dropping label (too high) : (" + label + ")[max: " + max + "]");
}
} else if (value < min) {
if (AAxis.DEBUG) {
System.out.println("Dropping label (too low) : (" + label + ")[min: " + min + "]");
}
}
value += minorTickSpacing;
}
final int stop = collect.size();
for (int i = 0; i < stop; i++) {
label = collect.get(i);
label.setValue((label.getValue() - min) / range);
}
}
return collect;
}