当前位置: 首页>>代码示例>>Java>>正文


Java AxisValue.getValue方法代码示例

本文整理汇总了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;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:65,代码来源:AxesRenderer.java

示例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;
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:58,代码来源:AxesRenderer.java


注:本文中的lecho.lib.hellocharts.model.AxisValue.getValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。