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


Java PointValue类代码示例

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


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

示例1: generateLineData

import lecho.lib.hellocharts.model.PointValue; //导入依赖的package包/类
private LineChartData generateLineData() {

            List<Line> lines = new ArrayList<Line>();
            for (int i = 0; i < numberOfLines; ++i) {

                List<PointValue> values = new ArrayList<PointValue>();
                for (int j = 0; j < numberOfPoints; ++j) {
                    values.add(new PointValue(j, randomNumbersTab[i][j]));
                }

                Line line = new Line(values);
                line.setColor(ChartUtils.COLORS[i]);
                line.setCubic(isCubic);
                line.setHasLabels(hasLabels);
                line.setHasLines(hasLines);
                line.setHasPoints(hasPoints);
                lines.add(line);
            }

            LineChartData lineChartData = new LineChartData(lines);

            return lineChartData;

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

示例2: checkTouch

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

示例3: calculateMaxViewport

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

示例4: drawPoints

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

示例5: drawPoint

import lecho.lib.hellocharts.model.PointValue; //导入依赖的package包/类
private void drawPoint(Canvas canvas, Line line, PointValue pointValue, float rawX, float rawY,
                       float pointRadius) {
    if (ValueShape.SQUARE.equals(line.getShape())) {
        canvas.drawRect(rawX - pointRadius, rawY - pointRadius, rawX + pointRadius, rawY + pointRadius,
                pointPaint);
    } else if (ValueShape.CIRCLE.equals(line.getShape())) {
        canvas.drawCircle(rawX, rawY, pointRadius, pointPaint);
    } else if (ValueShape.DIAMOND.equals(line.getShape())) {
        canvas.save();
        canvas.rotate(45, rawX, rawY);
        canvas.drawRect(rawX - pointRadius, rawY - pointRadius, rawX + pointRadius, rawY + pointRadius,
                pointPaint);
        canvas.restore();
    } else {
        throw new IllegalArgumentException("Invalid point shape: " + line.getShape());
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:18,代码来源:LineChartRenderer.java

示例6: generateLineChartData

import lecho.lib.hellocharts.model.PointValue; //导入依赖的package包/类
private LineChartData generateLineChartData() {
    int numValues = 20;

    List<PointValue> values = new ArrayList<PointValue>();
    for (int i = 0; i < numValues; ++i) {
        values.add(new PointValue(i, (float) Math.random() * 100f));
    }

    Line line = new Line(values);
    line.setColor(ChartUtils.COLOR_GREEN);

    List<Line> lines = new ArrayList<Line>();
    lines.add(line);

    LineChartData data = new LineChartData(lines);
    data.setAxisXBottom(new Axis().setName("Axis X"));
    data.setAxisYLeft(new Axis().setName("Axis Y").setHasLines(true));
    return data;

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

示例7: generatePreviewLineChartData

import lecho.lib.hellocharts.model.PointValue; //导入依赖的package包/类
private LineChartData generatePreviewLineChartData() {
    int numValues = 50;

    List<PointValue> values = new ArrayList<PointValue>();
    for (int i = 0; i < numValues; ++i) {
        values.add(new PointValue(i, (float) Math.random() * 100f));
    }

    Line line = new Line(values);
    line.setColor(ChartUtils.DEFAULT_DARKEN_COLOR);
    line.setHasPoints(false);// too many values so don't draw points.

    List<Line> lines = new ArrayList<Line>();
    lines.add(line);

    LineChartData data = new LineChartData(lines);
    data.setAxisXBottom(new Axis());
    data.setAxisYLeft(new Axis().setHasLines(true));

    return data;

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

示例8: generateDefaultData

import lecho.lib.hellocharts.model.PointValue; //导入依赖的package包/类
private void generateDefaultData() {
    int numValues = 50;

    List<PointValue> values = new ArrayList<PointValue>();
    for (int i = 0; i < numValues; ++i) {
        values.add(new PointValue(i, (float) Math.random() * 100f));
    }

    Line line = new Line(values);
    line.setColor(ChartUtils.COLOR_GREEN);
    line.setHasPoints(false);// too many values so don't draw points.

    List<Line> lines = new ArrayList<Line>();
    lines.add(line);

    data = new LineChartData(lines);
    data.setAxisXBottom(new Axis());
    data.setAxisYLeft(new Axis().setHasLines(true));

    // prepare preview data, is better to use separate deep copy for preview chart.
    // Set color to grey to make preview area more visible.
    previewData = new LineChartData(data);
    previewData.getLines().get(0).setColor(ChartUtils.DEFAULT_DARKEN_COLOR);

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

示例9: callTouchListener

import lecho.lib.hellocharts.model.PointValue; //导入依赖的package包/类
public void callTouchListener() {
    SelectedValue selectedValue = this.chartRenderer.getSelectedValue();
    if (selectedValue.isSet()) {
        Line line = (Line) this.data.getLines().get(selectedValue.getFirstIndex());
        PointValue point = (PointValue) line.getValues().get(selectedValue.getSecondIndex());
        switch (selectedValue.getSelectedType()) {
            case 0:
                this.onValueTouchListener.onValueSelected(selectedValue.getFirstIndex(), selectedValue.getSecondIndex(), point);
                return;
            case 1:
                this.onValueTouchListener.onImageSelected(selectedValue.getFirstIndex(), selectedValue.getSecondIndex(), point);
                return;
            case 2:
                if (line.hasLabels()) {
                    this.onValueTouchListener.onPopSelected(selectedValue.getFirstIndex(), selectedValue.getSecondIndex(), point);
                    return;
                }
                return;
            default:
                return;
        }
    }
    this.onValueTouchListener.onValueDeselected();
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:25,代码来源:LineChartView.java

示例10: calculateMaxViewport

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

示例11: drawPath

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

示例12: drawSquarePath

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

示例13: drawArea

import lecho.lib.hellocharts.model.PointValue; //导入依赖的package包/类
private void drawArea(Canvas canvas, Line line) {
    int lineSize = line.getValues().size();
    if (lineSize >= 2) {
        Rect contentRect = this.computator.getContentRectMinusAllMargins();
        float baseRawValue = Math.min((float) contentRect.bottom, Math.max(this.computator.computeRawY(this.baseValue), (float) contentRect.top));
        float left = Math.max(this.computator.computeRawX(((PointValue) line.getValues().get(0)).getX()), (float) contentRect.left);
        this.path.lineTo(Math.min(this.computator.computeRawX(((PointValue) line.getValues().get(lineSize - 1)).getX()), (float) contentRect.right), baseRawValue);
        this.path.lineTo(left, baseRawValue);
        this.path.close();
        this.linePaint.setStyle(Style.FILL);
        this.linePaint.setAlpha(line.getAreaTransparency());
        this.linePaint.setColor(line.getAreaColor());
        canvas.drawPath(this.path, this.linePaint);
        this.linePaint.setStyle(Style.STROKE);
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:17,代码来源:LineChartRenderer.java

示例14: getTargetLine

import lecho.lib.hellocharts.model.PointValue; //导入依赖的package包/类
private Line getTargetLine() {
    if (!needDrawTargetLine()) {
        return null;
    }
    PointValue lastRecordPoint = (PointValue) this.mPointValues.get(this.mPointValues.size()
            - 1);
    PointValue targetPoint = new PointValue(((AxisValue) this.mAxisValues.get(this
            .mAxisValues.size() - 1)).getValue(), this.mTargetWeight);
    List<PointValue> points = new ArrayList();
    points.add(lastRecordPoint);
    points.add(targetPoint);
    Line line = new Line(points);
    line.setColor(this.resources.getColor(R.color.da));
    line.setPathEffect(new DashPathEffect(new float[]{15.0f, 15.0f, 15.0f, 15.0f}, 0.0f));
    line.setHasLabels(false);
    if (this.mTypeMode > 0) {
        line.setHasPoints(false);
        return line;
    }
    line.setHasPoints(true);
    return line;
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:23,代码来源:ChartHelper.java

示例15: getYVals

import lecho.lib.hellocharts.model.PointValue; //导入依赖的package包/类
private List<PointValue> getYVals(List<WeightRecord> weightRecords) {
    this.mRecordValues.clear();
    ArrayList<PointValue> yVals = new ArrayList();
    if (weightRecords != null && weightRecords.size() > 0) {
        yVals.add(new PointValue(-2.0f, Float.parseFloat(((WeightRecord) weightRecords.get(0)
        ).weight)));
        for (int i = 0; i < weightRecords.size(); i++) {
            int xIndex = getXIndex(this.mXDates, ((WeightRecord) weightRecords.get(i))
                    .record_on);
            yVals.add(new PointValue((float) xIndex, Float.parseFloat(((WeightRecord)
                    weightRecords.get(i)).weight), ((WeightRecord) weightRecords.get(i))
                    .record_on));
            this.mRecordValues.add(Float.valueOf(Float.parseFloat(((WeightRecord)
                    weightRecords.get(i)).weight)));
            addPhoto((WeightRecord) weightRecords.get(i), xIndex);
        }
    }
    return yVals;
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:20,代码来源:ChartHelper.java


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