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


Java Line.getValues方法代码示例

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


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

示例1: checkTouch

import lecho.lib.hellocharts.model.Line; //导入方法依赖的package包/类
@Override
public boolean checkTouch(float touchX, float touchY) {
    selectedValue.clear();
    final LineChartData data = dataProvider.getLineChartData();
    int lineIndex = 0;
    for (Line line : data.getLines()) {
        if (checkIfShouldDrawPoints(line)) {
            int pointRadius = ChartUtils.dp2px(density, line.getPointRadius());
            int valueIndex = 0;
            for (PointValue pointValue : line.getValues()) {
                final float rawValueX = computator.computeRawX(pointValue.getX());
                final float rawValueY = computator.computeRawY(pointValue.getY());
                if (isInArea(rawValueX, rawValueY, touchX, touchY, pointRadius + touchToleranceMargin)) {
                    selectedValue.set(lineIndex, valueIndex, SelectedValueType.LINE);
                }
                ++valueIndex;
            }
        }
        ++lineIndex;
    }
    return isTouched();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:23,代码来源:LineChartRenderer.java

示例2: calculateMaxViewport

import lecho.lib.hellocharts.model.Line; //导入方法依赖的package包/类
private void calculateMaxViewport() {
    tempMaximumViewport.set(Float.MAX_VALUE, Float.MIN_VALUE, Float.MIN_VALUE, Float.MAX_VALUE);
    LineChartData data = dataProvider.getLineChartData();

    for (Line line : data.getLines()) {
        // Calculate max and min for viewport.
        for (PointValue pointValue : line.getValues()) {
            if (pointValue.getX() < tempMaximumViewport.left) {
                tempMaximumViewport.left = pointValue.getX();
            }
            if (pointValue.getX() > tempMaximumViewport.right) {
                tempMaximumViewport.right = pointValue.getX();
            }
            if (pointValue.getY() < tempMaximumViewport.bottom) {
                tempMaximumViewport.bottom = pointValue.getY();
            }
            if (pointValue.getY() > tempMaximumViewport.top) {
                tempMaximumViewport.top = pointValue.getY();
            }

        }
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:24,代码来源:LineChartRenderer.java

示例3: drawPoints

import lecho.lib.hellocharts.model.Line; //导入方法依赖的package包/类
private void drawPoints(Canvas canvas, Line line, int lineIndex, int mode) {
    pointPaint.setColor(line.getPointColor());
    int valueIndex = 0;
    for (PointValue pointValue : line.getValues()) {
        int pointRadius = ChartUtils.dp2px(density, line.getPointRadius());
        final float rawX = computator.computeRawX(pointValue.getX());
        final float rawY = computator.computeRawY(pointValue.getY());
        if (computator.isWithinContentRect(rawX, rawY, checkPrecision)) {
            // Draw points only if they are within contentRectMinusAllMargins, using contentRectMinusAllMargins
            // instead of viewport to avoid some
            // float rounding problems.
            if (MODE_DRAW == mode) {
                drawPoint(canvas, line, pointValue, rawX, rawY, pointRadius);
                if (line.hasLabels()) {
                    drawLabel(canvas, line, pointValue, rawX, rawY, pointRadius + labelOffset);
                }
            } else if (MODE_HIGHLIGHT == mode) {
                highlightPoint(canvas, line, pointValue, rawX, rawY, lineIndex, valueIndex);
            } else {
                throw new IllegalStateException("Cannot process points in mode: " + mode);
            }
        }
        ++valueIndex;
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:26,代码来源:LineChartRenderer.java

示例4: calculateMaxViewport

import lecho.lib.hellocharts.model.Line; //导入方法依赖的package包/类
private void calculateMaxViewport() {
    this.tempMaximumViewport.set(AutoScrollHelper.NO_MAX, Float.MIN_VALUE, Float.MIN_VALUE, AutoScrollHelper.NO_MAX);
    for (Line line : this.dataProvider.getLineChartData().getLines()) {
        for (PointValue pointValue : line.getValues()) {
            if (pointValue.getX() < this.tempMaximumViewport.left) {
                this.tempMaximumViewport.left = pointValue.getX();
            }
            if (pointValue.getX() > this.tempMaximumViewport.right) {
                this.tempMaximumViewport.right = pointValue.getX();
            }
            if (pointValue.getY() < this.tempMaximumViewport.bottom) {
                this.tempMaximumViewport.bottom = pointValue.getY();
            }
            if (pointValue.getY() > this.tempMaximumViewport.top) {
                this.tempMaximumViewport.top = pointValue.getY();
            }
        }
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:20,代码来源:LineChartRenderer.java

示例5: drawPath

import lecho.lib.hellocharts.model.Line; //导入方法依赖的package包/类
private void drawPath(Canvas canvas, Line line) {
    prepareLinePaint(line);
    int valueIndex = 0;
    for (PointValue pointValue : line.getValues()) {
        float rawX = this.computator.computeRawX(pointValue.getX());
        float rawY = this.computator.computeRawY(pointValue.getY());
        if (valueIndex == 0) {
            this.path.moveTo(rawX, rawY);
        } else {
            this.path.lineTo(rawX, rawY);
        }
        valueIndex++;
    }
    canvas.drawPath(this.path, this.linePaint);
    if (line.isFilled()) {
        drawArea(canvas, line);
    }
    this.path.reset();
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:20,代码来源:LineChartRenderer.java

示例6: drawSquarePath

import lecho.lib.hellocharts.model.Line; //导入方法依赖的package包/类
private void drawSquarePath(Canvas canvas, Line line) {
    prepareLinePaint(line);
    int valueIndex = 0;
    float previousRawY = 0.0f;
    for (PointValue pointValue : line.getValues()) {
        float rawX = this.computator.computeRawX(pointValue.getX());
        float rawY = this.computator.computeRawY(pointValue.getY());
        if (valueIndex == 0) {
            this.path.moveTo(rawX, rawY);
        } else {
            this.path.lineTo(rawX, previousRawY);
            this.path.lineTo(rawX, rawY);
        }
        previousRawY = rawY;
        valueIndex++;
    }
    canvas.drawPath(this.path, this.linePaint);
    if (line.isFilled()) {
        drawArea(canvas, line);
    }
    this.path.reset();
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:23,代码来源:LineChartRenderer.java

示例7: drawPath

import lecho.lib.hellocharts.model.Line; //导入方法依赖的package包/类
/**
 * Draws lines, uses path for drawing filled area on software canvas. Line is drawn with canvas.drawLines() method.
 */
private void drawPath(Canvas canvas, final Line line) {
    prepareLinePaint(line);

    int valueIndex = 0;
    for (PointValue pointValue : line.getValues()) {

        final float rawX = computator.computeRawX(pointValue.getX());
        final float rawY = computator.computeRawY(pointValue.getY());

        if (valueIndex == 0) {
            path.moveTo(rawX, rawY);
        } else {
            path.lineTo(rawX, rawY);
        }

        ++valueIndex;

    }

    canvas.drawPath(path, linePaint);

    if (line.isFilled()) {
        drawArea(canvas, line);
    }

    path.reset();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:31,代码来源:LineChartRenderer.java

示例8: drawSquarePath

import lecho.lib.hellocharts.model.Line; //导入方法依赖的package包/类
private void drawSquarePath(Canvas canvas, final Line line) {
    prepareLinePaint(line);

    int valueIndex = 0;
    float previousRawY = 0;
    for (PointValue pointValue : line.getValues()) {

        final float rawX = computator.computeRawX(pointValue.getX());
        final float rawY = computator.computeRawY(pointValue.getY());

        if (valueIndex == 0) {
            path.moveTo(rawX, rawY);
        } else {
            path.lineTo(rawX, previousRawY);
            path.lineTo(rawX, rawY);
        }

        previousRawY = rawY;

        ++valueIndex;

    }

    canvas.drawPath(path, linePaint);

    if (line.isFilled()) {
        drawArea(canvas, line);
    }

    path.reset();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:32,代码来源:LineChartRenderer.java

示例9: prepareDataAnimation

import lecho.lib.hellocharts.model.Line; //导入方法依赖的package包/类
/**
 * To animate values you have to change targets values and then call {@link Chart#startDataAnimation()}
 * method(don't confuse with View.animate()). If you operate on data that was set before you don't have to call
 * {@link LineChartView#setLineChartData(LineChartData)} again.
 */
private void prepareDataAnimation() {
    for (Line line : data.getLines()) {
        for (PointValue value : line.getValues()) {
            // Here I modify target only for Y values but it is OK to modify X targets as well.
            value.setTarget(value.getX(), (float) Math.random() * 100);
        }
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:14,代码来源:LineChartActivity.java

示例10: generateLineData

import lecho.lib.hellocharts.model.Line; //导入方法依赖的package包/类
private void generateLineData(int color, float range) {
    // Cancel last animation if not finished.
    chartTop.cancelDataAnimation();

    // Modify data targets
    Line line = lineData.getLines().get(0);// For this example there is always only one line.
    line.setColor(color);
    for (PointValue value : line.getValues()) {
        // Change target only for Y value.
        value.setTarget(value.getX(), (float) Math.random() * range);
    }

    // Start new data animation with 300ms duration;
    chartTop.startDataAnimation(300);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:16,代码来源:LineColumnDependencyActivity.java

示例11: checkTouch

import lecho.lib.hellocharts.model.Line; //导入方法依赖的package包/类
public boolean checkTouch(float touchX, float touchY) {
    this.selectedValue.clear();
    LineChartData data = this.dataProvider.getLineChartData();
    int lineIndex = 0;
    float imageValueY = (float) (this.lineChartView.getMeasuredHeight() - ChartUtils.dp2px(this.density, 30));
    int imgRadius = ChartUtils.dp2px(this.density, data.getImgRadius()) + 10;
    for (Line line : data.getLines()) {
        int pointRadius = ChartUtils.dp2px(this.density, line.getPointRadius());
        int valueIndex = 0;
        for (PointValue pointValue : line.getValues()) {
            float rawValueX = this.computator.computeRawX(pointValue.getX());
            float rawValueY = this.computator.computeRawY(pointValue.getY());
            if (isInArea(rawValueX, rawValueY, touchX, touchY, (float) (this.touchToleranceMargin + pointRadius))) {
                this.pointIndex = valueIndex;
                this.selectedValue.set(lineIndex, valueIndex, SelectedValueType.LINE, 0);
            } else {
                if (isInArea(rawValueX, imageValueY, touchX, touchY, (float) imgRadius)) {
                    this.selectedValue.set(lineIndex, valueIndex, SelectedValueType.LINE, 1);
                } else {
                    if (isInArea(rawValueX, rawValueY - ((float) ChartUtils.dp2px(this.density, 40)), touchX, touchY, (float) ChartUtils.dp2px(this.density, 40)) && this.pointIndex == valueIndex) {
                        this.selectedValue.set(lineIndex, valueIndex, SelectedValueType.LINE, 2);
                    }
                }
            }
            valueIndex++;
        }
        lineIndex++;
    }
    return isTouched();
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:31,代码来源:LineChartRenderer.java

示例12: drawPoints

import lecho.lib.hellocharts.model.Line; //导入方法依赖的package包/类
private void drawPoints(Canvas canvas, Line line, int lineIndex, int mode) {
    this.pointPaint.setColor(line.getColor());
    int valueIndex = 0;
    if (this.pointIndex == -1 && line.hasLabels()) {
        this.pointIndex = line.getValues().size() - 1;
    }
    for (PointValue pointValue : line.getValues()) {
        int pointRadius = ChartUtils.dp2px(this.density, line.getPointRadius());
        float rawX = this.computator.computeRawX(pointValue.getX());
        float rawY = this.computator.computeRawY(pointValue.getY());
        if (this.computator.isWithinContentRect(rawX, rawY, (float) this.checkPrecision)) {
            if (mode == 0) {
                if (line.hasPoints()) {
                    drawPoint(canvas, line, pointValue, rawX, rawY, (float) pointRadius);
                }
                if (line.hasLabels() && valueIndex == this.pointIndex && pointValue.getData() != null) {
                    drawLabel(canvas, line, pointValue, rawX, rawY, (float) (this.labelOffset + pointRadius));
                }
            } else if (1 == mode) {
                highlightPoint(canvas, line, pointValue, rawX, rawY, lineIndex, valueIndex);
            } else {
                throw new IllegalStateException("Cannot process points in mode: " + mode);
            }
        }
        valueIndex++;
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:28,代码来源:LineChartRenderer.java

示例13: setLineDatas

import lecho.lib.hellocharts.model.Line; //导入方法依赖的package包/类
private void setLineDatas(int color, float range) {
    //如果上一个动画未完成 先结束动画
    mLineView.cancelDataAnimation();

    // 设置第几条线变化 默认为第一条线
    Line line = mLineData.getLines().get(0);
    line.setColor(color);
    for (PointValue value : line.getValues()) {
        //这里只是随机值 可以添加相对应的数据
        value.setTarget(value.getX(), (float) Math.random() * range);
    }
    mLineView.startDataAnimation();
}
 
开发者ID:lupwei,项目名称:Croprotector,代码行数:14,代码来源:disease_num_chart_fragment.java

示例14: autoSplitLine

import lecho.lib.hellocharts.model.Line; //导入方法依赖的package包/类
private ArrayList<Line> autoSplitLine(Line macroline, final float jumpthresh) {
    ArrayList<Line> linearray = new ArrayList<>();
    float lastx = -999999;

    List<PointValue> macropoints = macroline.getValues();
    List<PointValue> thesepoints = new ArrayList<>();

    if (macropoints.size() > 0) {
        final float endmarker = macropoints.get(macropoints.size() - 1).getX();
        for (PointValue thispoint : macropoints) {

            // a jump too far for a line? make it a new one
            if (((lastx != -999999) && (Math.abs(thispoint.getX() - lastx) > jumpthresh))
                    || thispoint.getX() == endmarker) {

                if (thispoint.getX() == endmarker) {
                    thesepoints.add(thispoint);
                }
                Line line = (Line) cloneObject(macroline); // aieeee
                try {
                    line.setValues(thesepoints);
                    linearray.add(line);
                } catch (NullPointerException e) {
                //
                }
                    thesepoints = new ArrayList<PointValue>();
            }
            lastx = thispoint.getX();
            thesepoints.add(thispoint); // grow current line list
        }
    }
    return linearray;
}
 
开发者ID:NightscoutFoundation,项目名称:xDrip,代码行数:34,代码来源:BgGraphBuilder.java

示例15: autoSplitLine

import lecho.lib.hellocharts.model.Line; //导入方法依赖的package包/类
public ArrayList<Line> autoSplitLine(Line macroline, final float jumpthresh) {
   // if (d) Log.d(TAG, "Enter autoSplit Line");
    ArrayList<Line> linearray = new ArrayList<Line>();
    float lastx = -999999;

    List<PointValue> macropoints = macroline.getValues();
    List<PointValue> thesepoints = new ArrayList<PointValue>();

    if (macropoints.size() > 0) {

        final float endmarker = macropoints.get(macropoints.size() - 1).getX();
        for (PointValue thispoint : macropoints) {

            // a jump too far for a line? make it a new one
            if (((lastx != -999999) && (Math.abs(thispoint.getX() - lastx) > jumpthresh))
                    || thispoint.getX() == endmarker) {

                if (thispoint.getX() == endmarker) {
                    thesepoints.add(thispoint);
                }
                Line line = (Line) cloneObject(macroline); // aieeee
                line.setValues(thesepoints);
                linearray.add(line);
                thesepoints = new ArrayList<PointValue>();
            }

            lastx = thispoint.getX();
            thesepoints.add(thispoint); // grow current line list
        }
    }
 //   if (d) Log.d(TAG, "Exit autoSplit Line");
    return linearray;
}
 
开发者ID:NightscoutFoundation,项目名称:xDrip,代码行数:34,代码来源:BgGraphBuilder.java


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