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


Java Axis.hasLines方法代码示例

本文整理汇总了Java中lecho.lib.hellocharts.model.Axis.hasLines方法的典型用法代码示例。如果您正苦于以下问题:Java Axis.hasLines方法的具体用法?Java Axis.hasLines怎么用?Java Axis.hasLines使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在lecho.lib.hellocharts.model.Axis的用法示例。


在下文中一共展示了Axis.hasLines方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: prepareCustomAxis

import lecho.lib.hellocharts.model.Axis; //导入方法依赖的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: prepareAutoGeneratedAxis

import lecho.lib.hellocharts.model.Axis; //导入方法依赖的package包/类
private void prepareAutoGeneratedAxis(Axis axis, int position) {
    final Viewport visibleViewport = computator.getVisibleViewport();
    final Rect contentRect = computator.getContentRectMinusAllMargins();
    boolean isAxisVertical = isAxisVertical(position);
    float start, stop;
    int contentRectDimension;
    if (isAxisVertical) {
        start = visibleViewport.bottom;
        stop = visibleViewport.top;
        contentRectDimension = contentRect.height();
    } else {
        start = visibleViewport.left;
        stop = visibleViewport.right;
        contentRectDimension = contentRect.width();
    }
    FloatUtils.computeAutoGeneratedAxisValues(start, stop, Math.abs(contentRectDimension) /
            labelDimensionForStepsTab[position] / 2, autoValuesBufferTab[position]);
    //Reinitialize tab to hold lines coordinates.
    if (axis.hasLines()
            && (linesDrawBufferTab[position].length < autoValuesBufferTab[position].valuesNumber * 4)) {
        linesDrawBufferTab[position] = new float[autoValuesBufferTab[position].valuesNumber * 4];
    }
    //Reinitialize tabs to hold all raw and auto values.
    if (rawValuesTab[position].length < autoValuesBufferTab[position].valuesNumber) {
        rawValuesTab[position] = new float[autoValuesBufferTab[position].valuesNumber];
    }
    if (autoValuesToDrawTab[position].length < autoValuesBufferTab[position].valuesNumber) {
        autoValuesToDrawTab[position] = new float[autoValuesBufferTab[position].valuesNumber];
    }

    float rawValue;
    int valueToDrawIndex = 0;
    for (int i = 0; i < autoValuesBufferTab[position].valuesNumber; ++i) {
        if (isAxisVertical) {
            rawValue = computator.computeRawY(autoValuesBufferTab[position].values[i]);
        } else {
            rawValue = computator.computeRawX(autoValuesBufferTab[position].values[i]);
        }
        if (checkRawValue(contentRect, rawValue, axis.isInside(), position, isAxisVertical)) {
            rawValuesTab[position][valueToDrawIndex] = rawValue;
            autoValuesToDrawTab[position][valueToDrawIndex] = autoValuesBufferTab[position].values[i];
            ++valueToDrawIndex;
        }
    }
    valuesToDrawNumTab[position] = valueToDrawIndex;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:47,代码来源:AxesRenderer.java

示例3: drawAxisLines

import lecho.lib.hellocharts.model.Axis; //导入方法依赖的package包/类
private void drawAxisLines(Canvas canvas, Axis axis, int position) {
    final Rect contentRectMargins = computator.getContentRectMinusAxesMargins();
    float separationX1, separationY1, separationX2, separationY2;
    separationX1 = separationY1 = separationX2 = separationY2 = 0;
    float lineX1, lineY1, lineX2, lineY2;
    lineX1 = lineY1 = lineX2 = lineY2 = 0;
    boolean isAxisVertical = isAxisVertical(position);
    if (LEFT == position || RIGHT == position) {
        separationX1 = separationX2 = separationLineTab[position];
        separationY1 = contentRectMargins.bottom;
        separationY2 = contentRectMargins.top;
        lineX1 = contentRectMargins.left;
        lineX2 = contentRectMargins.right;
    } else if (TOP == position || BOTTOM == position) {
        separationX1 = contentRectMargins.left;
        separationX2 = contentRectMargins.right;
        separationY1 = separationY2 = separationLineTab[position];
        lineY1 = contentRectMargins.top;
        lineY2 = contentRectMargins.bottom;
    }
    // Draw separation line with the same color as axis labels and name.
    if (axis.hasSeparationLine()) {
        canvas.drawLine(separationX1, separationY1, separationX2, separationY2, labelPaintTab[position]);
    }

    if (axis.hasLines()) {
        int valueToDrawIndex = 0;
        for (; valueToDrawIndex < valuesToDrawNumTab[position]; ++valueToDrawIndex) {
            if (isAxisVertical) {
                lineY1 = lineY2 = rawValuesTab[position][valueToDrawIndex];
            } else {
                lineX1 = lineX2 = rawValuesTab[position][valueToDrawIndex];
            }
            linesDrawBufferTab[position][valueToDrawIndex * 4 + 0] = lineX1;
            linesDrawBufferTab[position][valueToDrawIndex * 4 + 1] = lineY1;
            linesDrawBufferTab[position][valueToDrawIndex * 4 + 2] = lineX2;
            linesDrawBufferTab[position][valueToDrawIndex * 4 + 3] = lineY2;
        }
        canvas.drawLines(linesDrawBufferTab[position], 0, valueToDrawIndex * 4, linePaintTab[position]);
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:42,代码来源:AxesRenderer.java

示例4: prepareCustomAxis

import lecho.lib.hellocharts.model.Axis; //导入方法依赖的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

示例5: prepareAutoGeneratedAxis

import lecho.lib.hellocharts.model.Axis; //导入方法依赖的package包/类
private void prepareAutoGeneratedAxis(Axis axis, int position) {
    float start;
    float stop;
    int contentRectDimension;
    Viewport visibleViewport = this.computator.getVisibleViewport();
    Rect contentRect = this.computator.getContentRectMinusAllMargins();
    boolean isAxisVertical = isAxisVertical(position);
    if (isAxisVertical) {
        start = visibleViewport.bottom;
        stop = visibleViewport.top;
        contentRectDimension = contentRect.height();
    } else {
        start = visibleViewport.left;
        stop = visibleViewport.right;
        contentRectDimension = contentRect.width();
    }
    FloatUtils.computeAutoGeneratedAxisValues(start, stop, (contentRectDimension / this.labelDimensionForStepsTab[position]) / 2, this.autoValuesBufferTab[position]);
    if (axis.hasLines() && this.linesDrawBufferTab[position].length < this.autoValuesBufferTab[position].valuesNumber * 4) {
        this.linesDrawBufferTab[position] = new float[(this.autoValuesBufferTab[position].valuesNumber * 4)];
    }
    if (this.rawValuesTab[position].length < this.autoValuesBufferTab[position].valuesNumber) {
        this.rawValuesTab[position] = new float[this.autoValuesBufferTab[position].valuesNumber];
    }
    if (this.autoValuesToDrawTab[position].length < this.autoValuesBufferTab[position].valuesNumber) {
        this.autoValuesToDrawTab[position] = new float[this.autoValuesBufferTab[position].valuesNumber];
    }
    int valueToDrawIndex = 0;
    for (int i = 0; i < this.autoValuesBufferTab[position].valuesNumber; i++) {
        float rawValue;
        if (isAxisVertical) {
            rawValue = this.computator.computeRawY(this.autoValuesBufferTab[position].values[i]);
        } else {
            rawValue = this.computator.computeRawX(this.autoValuesBufferTab[position].values[i]);
        }
        if (checkRawValue(contentRect, rawValue, axis.isInside(), position, isAxisVertical)) {
            this.rawValuesTab[position][valueToDrawIndex] = rawValue;
            this.autoValuesToDrawTab[position][valueToDrawIndex] = this.autoValuesBufferTab[position].values[i];
            valueToDrawIndex++;
        }
    }
    this.valuesToDrawNumTab[position] = valueToDrawIndex;
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:43,代码来源:AxesRenderer.java

示例6: drawAxisLines

import lecho.lib.hellocharts.model.Axis; //导入方法依赖的package包/类
private void drawAxisLines(Canvas canvas, Axis axis, int position) {
    Rect contentRectMargins = this.computator.getContentRectMinusAxesMargins();
    float separationY2 = 0.0f;
    float separationX2 = 0.0f;
    float separationY1 = 0.0f;
    float separationX1 = 0.0f;
    float lineY2 = 0.0f;
    float lineX2 = 0.0f;
    float lineY1 = 0.0f;
    float lineX1 = 0.0f;
    boolean isAxisVertical = isAxisVertical(position);
    if (1 == position || 2 == position) {
        separationX2 = this.separationLineTab[position];
        separationX1 = separationX2;
        separationY1 = (float) contentRectMargins.bottom;
        separationY2 = (float) contentRectMargins.top;
        lineX1 = (float) contentRectMargins.left;
        lineX2 = (float) contentRectMargins.right;
    } else if (position == 0 || 3 == position) {
        separationX1 = (float) contentRectMargins.left;
        separationX2 = (float) contentRectMargins.right;
        separationY2 = this.separationLineTab[position];
        separationY1 = separationY2;
        lineY1 = (float) contentRectMargins.top;
        lineY2 = (float) contentRectMargins.bottom;
    }
    if (axis.hasSeparationLine()) {
        canvas.drawLine(separationX1, separationY1, separationX2, separationY2, this.labelPaintTab[position]);
    }
    if (axis.hasLines()) {
        int valueToDrawIndex = 0;
        while (valueToDrawIndex < this.valuesToDrawNumTab[position]) {
            if (isAxisVertical) {
                lineY2 = this.rawValuesTab[position][valueToDrawIndex];
                lineY1 = lineY2;
            } else {
                lineX2 = this.rawValuesTab[position][valueToDrawIndex];
                lineX1 = lineX2;
            }
            this.linesDrawBufferTab[position][(valueToDrawIndex * 4) + 0] = lineX1;
            this.linesDrawBufferTab[position][(valueToDrawIndex * 4) + 1] = lineY1;
            this.linesDrawBufferTab[position][(valueToDrawIndex * 4) + 2] = lineX2;
            this.linesDrawBufferTab[position][(valueToDrawIndex * 4) + 3] = lineY2;
            valueToDrawIndex++;
        }
        canvas.drawLines(this.linesDrawBufferTab[position], 0, valueToDrawIndex * 4, this.linePaintTab[position]);
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:49,代码来源:AxesRenderer.java


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