本文整理汇总了Java中lecho.lib.hellocharts.model.AxisValue.getValue方法的典型用法代码示例。如果您正苦于以下问题:Java AxisValue.getValue方法的具体用法?Java AxisValue.getValue怎么用?Java AxisValue.getValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lecho.lib.hellocharts.model.AxisValue
的用法示例。
在下文中一共展示了AxisValue.getValue方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: prepareCustomAxis
import lecho.lib.hellocharts.model.AxisValue; //导入方法依赖的package包/类
private void prepareCustomAxis(Axis axis, int position) {
final Viewport maxViewport = computator.getMaximumViewport();
final Viewport visibleViewport = computator.getVisibleViewport();
final Rect contentRect = computator.getContentRectMinusAllMargins();
boolean isAxisVertical = isAxisVertical(position);
float viewportMin, viewportMax;
float scale = 1;
if (isAxisVertical) {
if (maxViewport.height() > 0 && visibleViewport.height() > 0) {
scale = contentRect.height() * (maxViewport.height() / visibleViewport.height());
}
viewportMin = visibleViewport.bottom;
viewportMax = visibleViewport.top;
} else {
if (maxViewport.width() > 0 && visibleViewport.width() > 0) {
scale = contentRect.width() * (maxViewport.width() / visibleViewport.width());
}
viewportMin = visibleViewport.left;
viewportMax = visibleViewport.right;
}
if (scale == 0) {
scale = 1;
}
int module = (int) Math.max(1,
Math.ceil((axis.getValues().size() * labelDimensionForStepsTab[position] * 1.5) / scale));
//Reinitialize tab to hold lines coordinates.
if (axis.hasLines() && (linesDrawBufferTab[position].length < axis.getValues().size() * 4)) {
linesDrawBufferTab[position] = new float[axis.getValues().size() * 4];
}
//Reinitialize tabs to hold all raw values to draw.
if (rawValuesTab[position].length < axis.getValues().size()) {
rawValuesTab[position] = new float[axis.getValues().size()];
}
//Reinitialize tabs to hold all raw values to draw.
if (valuesToDrawTab[position].length < axis.getValues().size()) {
valuesToDrawTab[position] = new AxisValue[axis.getValues().size()];
}
float rawValue;
int valueIndex = 0;
int valueToDrawIndex = 0;
for (AxisValue axisValue : axis.getValues()) {
// Draw axis values that are within visible viewport.
final float value = axisValue.getValue();
if (value >= viewportMin && value <= viewportMax) {
// Draw axis values that have 0 module value, this will hide some labels if there is no place for them.
if (0 == valueIndex % module) {
if (isAxisVertical) {
rawValue = computator.computeRawY(value);
} else {
rawValue = computator.computeRawX(value);
}
if (checkRawValue(contentRect, rawValue, axis.isInside(), position, isAxisVertical)) {
rawValuesTab[position][valueToDrawIndex] = rawValue;
valuesToDrawTab[position][valueToDrawIndex] = axisValue;
++valueToDrawIndex;
}
}
// If within viewport - increment valueIndex;
++valueIndex;
}
}
valuesToDrawNumTab[position] = valueToDrawIndex;
}
示例2: prepareCustomAxis
import lecho.lib.hellocharts.model.AxisValue; //导入方法依赖的package包/类
private void prepareCustomAxis(Axis axis, int position) {
float viewportMin;
Viewport maxViewport = this.computator.getMaximumViewport();
Viewport visibleViewport = this.computator.getVisibleViewport();
Rect contentRect = this.computator.getContentRectMinusAllMargins();
boolean isAxisVertical = isAxisVertical(position);
float scale = 1.0f;
float viewportMax;
if (isAxisVertical) {
if (maxViewport.height() > 0.0f && visibleViewport.height() > 0.0f) {
scale = ((float) contentRect.height()) * (maxViewport.height() / visibleViewport.height());
}
viewportMin = visibleViewport.bottom;
viewportMax = visibleViewport.top;
} else {
if (maxViewport.width() > 0.0f && visibleViewport.width() > 0.0f) {
scale = ((float) contentRect.width()) * (maxViewport.width() / visibleViewport.width());
}
viewportMin = visibleViewport.left;
viewportMax = visibleViewport.right;
}
if (scale == 0.0f) {
scale = 1.0f;
}
int module = (int) Math.max(PathListView.NO_ZOOM, Math.ceil((((double) (axis.getValues().size() * this.labelDimensionForStepsTab[position])) * 1.5d) / ((double) scale)));
if (axis.hasLines() && this.linesDrawBufferTab[position].length < axis.getValues().size() * 4) {
this.linesDrawBufferTab[position] = new float[(axis.getValues().size() * 4)];
}
if (this.rawValuesTab[position].length < axis.getValues().size()) {
this.rawValuesTab[position] = new float[axis.getValues().size()];
}
if (this.valuesToDrawTab[position].length < axis.getValues().size()) {
this.valuesToDrawTab[position] = new AxisValue[axis.getValues().size()];
}
int valueIndex = 0;
int valueToDrawIndex = 0;
for (AxisValue axisValue : axis.getValues()) {
float value = axisValue.getValue();
if (value >= viewportMin && value <= viewportMax) {
if (valueIndex % module == 0) {
float rawValue;
if (isAxisVertical) {
rawValue = this.computator.computeRawY(value);
} else {
rawValue = this.computator.computeRawX(value);
}
if (checkRawValue(contentRect, rawValue, axis.isInside(), position, isAxisVertical)) {
this.rawValuesTab[position][valueToDrawIndex] = rawValue;
this.valuesToDrawTab[position][valueToDrawIndex] = axisValue;
valueToDrawIndex++;
}
}
valueIndex++;
}
}
this.valuesToDrawNumTab[position] = valueToDrawIndex;
}