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


Java PointValue.getY方法代码示例

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


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

示例1: 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

示例2: 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

示例3: drawLabel

import lecho.lib.hellocharts.model.PointValue; //导入方法依赖的package包/类
private void drawLabel(Canvas canvas, Line line, PointValue pointValue, float rawX, float rawY, float offset) {
    Rect contentRect = this.computator.getContentRectMinusAllMargins();
    int numChars = line.getFormatter().formatChartValue(this.labelBuffer, pointValue);
    if (numChars != 0) {
        float top;
        float bottom;
        float labelWidth = this.labelPaint.measureText(this.labelBuffer, this.labelBuffer.length - numChars, numChars);
        int labelHeight = Math.abs(this.fontMetrics.ascent);
        float left = (rawX - (labelWidth / 2.0f)) - ((float) this.labelMargin);
        float right = ((labelWidth / 2.0f) + rawX) + ((float) this.labelMargin);
        if (pointValue.getY() >= this.baseValue) {
            top = ((rawY - offset) - ((float) labelHeight)) - ((float) (this.labelMargin * 2));
            bottom = rawY - offset;
        } else {
            top = rawY + offset;
            bottom = ((rawY + offset) + ((float) labelHeight)) + ((float) (this.labelMargin * 2));
        }
        if (top < ((float) contentRect.top)) {
            top = rawY + offset;
            bottom = ((rawY + offset) + ((float) labelHeight)) + ((float) (this.labelMargin * 2));
        }
        if (bottom > ((float) contentRect.bottom)) {
            top = ((rawY - offset) - ((float) labelHeight)) - ((float) (this.labelMargin * 2));
            bottom = rawY - offset;
        }
        if (left < ((float) contentRect.left)) {
            left = rawX;
            right = (rawX + labelWidth) + ((float) (this.labelMargin * 2));
        }
        if (right > ((float) contentRect.right)) {
            left = (rawX - labelWidth) - ((float) (this.labelMargin * 2));
            right = rawX;
        }
        this.labelBackgroundRect.set(left, top, right, bottom);
        View view = getMarkView(this.context, pointValue);
        if (view != null) {
            drawLabelTextAndBackgroundForMarkView(canvas, this.labelBuffer, this.labelBuffer.length - numChars, numChars, line.getColor(), line.getLabelColor(), ChartUtils.getBitmapFromView(view));
        }
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:41,代码来源:LineChartRenderer.java

示例4: addBloodTests

import lecho.lib.hellocharts.model.PointValue; //导入方法依赖的package包/类
private void addBloodTests() {
    // enumerate blood tests
    try {
        for (BgWatchData bloodtest : btDataList) {
            if(bloodtest.timestamp > start_time) {
                final long adjusted_timestamp = (Math.round(bloodtest.timestamp) + (estimatedInterstitialLagSeconds * 1000));
                final PointValueExtended this_point = new PointValueExtended((float) (adjusted_timestamp / FUZZER), (float) unitized(bloodtest.sgv));
                this_point.type = PointValueExtended.BloodTest;
                //this_point.uuid = bloodtest.uuid; //TODO
                this_point.real_timestamp = (long)bloodtest.timestamp;
                // exclude any which have been used for calibration
                boolean matches = false;
                for (PointValue calibration_point : calibrationValues) {
                    if ((Math.abs(calibration_point.getX() - this_point.getX())) <= ((estimatedInterstitialLagSeconds * 1000) / FUZZER) && (calibration_point.getY() == calibration_point.getY())) {
                        matches = true;
                        break;
                    }
                }
                //if (!matches) bloodTestValues.add(this_point);
                if (!matches)
                    bloodTestValues.add(new PointValue(fuzz(adjusted_timestamp), (float) unitized(bloodtest.sgv)));//KS bloodtest.timestamp
                if (d)
                    Log.d(TAG, "bloodtest total record: " + bloodtest.sgv + " " + " adjusted_timestamp: " + fuzz(bloodtest.timestamp) + " timestamp=" + JoH.dateTimeText((long) bloodtest.timestamp));
            }
        }
    } catch (Exception e) {
        Log.e(TAG, "Exception doing bloodtest values in bggraphbuilder: " + e.toString());
    }

}
 
开发者ID:NightscoutFoundation,项目名称:xDrip,代码行数:31,代码来源:BgGraphBuilder.java

示例5: drawLabel

import lecho.lib.hellocharts.model.PointValue; //导入方法依赖的package包/类
private void drawLabel(Canvas canvas, Line line, PointValue pointValue, float rawX, float rawY, float offset) {
    final Rect contentRect = computator.getContentRectMinusAllMargins();
    final int numChars = line.getFormatter().formatChartValue(labelBuffer, pointValue);
    if (numChars == 0) {
        // No need to draw empty label
        return;
    }

    final float labelWidth = labelPaint.measureText(labelBuffer, labelBuffer.length - numChars, numChars);
    final int labelHeight = Math.abs(fontMetrics.ascent);
    float left = rawX - labelWidth / 2 - labelMargin;
    float right = rawX + labelWidth / 2 + labelMargin;

    float top;
    float bottom;

    if (pointValue.getY() >= baseValue) {
        top = rawY - offset - labelHeight - labelMargin * 2;
        bottom = rawY - offset;
    } else {
        top = rawY + offset;
        bottom = rawY + offset + labelHeight + labelMargin * 2;
    }

    if (top < contentRect.top) {
        top = rawY + offset;
        bottom = rawY + offset + labelHeight + labelMargin * 2;
    }
    if (bottom > contentRect.bottom) {
        top = rawY - offset - labelHeight - labelMargin * 2;
        bottom = rawY - offset;
    }
    if (left < contentRect.left) {
        left = rawX;
        right = rawX + labelWidth + labelMargin * 2;
    }
    if (right > contentRect.right) {
        left = rawX - labelWidth - labelMargin * 2;
        right = rawX;
    }

    labelBackgroundRect.set(left, top, right, bottom);
    drawLabelTextAndBackground(canvas, labelBuffer, labelBuffer.length - numChars, numChars,
            line.getDarkenColor());
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:46,代码来源:LineChartRenderer.java

示例6: onValueSelected

import lecho.lib.hellocharts.model.PointValue; //导入方法依赖的package包/类
@Override
public synchronized void onValueSelected(int i, int i1, PointValue pointValue) {

    Log.d(TAG, "onValueSelected pointValue=" + pointValue.getX() + "," + pointValue.getY());
    String filtered = "";
    String alternate = "";
    String uuid = "";
    int type = 0;
    long real_timestamp = 0;
    try {
        PointValueExtended pve = (PointValueExtended) pointValue;
        type = pve.type;
        if (pve.calculatedFilteredValue != -1) {
            filtered = " (" + Math.round(pve.calculatedFilteredValue * 10) / 10d + ")";
        }
        if (pve.note != null) {
            alternate = pve.note;
        }
        if (pve.uuid != null) {
            uuid = pve.uuid;
        }
        real_timestamp = pve.real_timestamp;

    } catch (ClassCastException e) {
        Log.e(TAG, "Error casting a point from pointValue to PointValueExtended", e);
    }

    final java.text.DateFormat timeFormat = DateFormat.getTimeFormat(context);
    //Won't give the exact time of the reading but the time on the grid: close enough.
    final Long time = (real_timestamp > 0) ? real_timestamp : ((long) pointValue.getX()) * FUZZER;
    final double ypos = pointValue.getY();

    final String message;

    if (alternate.length() > 0) {
        message = timeFormat.format(time) + "    " + alternate;
    } else {
        message = timeFormat.format(time) + "      " + (Math.round(pointValue.getY() * 10) / 10d) + " " + unit() + filtered;
    }
    Log.d(TAG, "onValueSelected message=" + message);
    JoH.static_toast(xdrip.getAppContext(), message, Toast.LENGTH_SHORT);

    /*switch (type) {
        case com.eveningoutpost.dexdrip.UtilityModels.PointValueExtended.BloodTest:
            final String fuuid = uuid;
            final View.OnClickListener mBtOnClickListener = new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Home.startHomeWithExtra(xdrip.getAppContext(), Home.BLOOD_TEST_ACTION, time.toString(), fuuid);
                }
            };
            Home.snackBar(R.string.blood_test, message, mBtOnClickListener, callerActivity);
            break;
        default:
            final View.OnClickListener mOnClickListener = new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Home.startHomeWithExtra(xdrip.getAppContext(), Home.CREATE_TREATMENT_NOTE, time.toString(), Double.toString(ypos));
                }
            };
            Home.snackBar(R.string.add_note, message, mOnClickListener, callerActivity);
            break;
    }*/
}
 
开发者ID:NightscoutFoundation,项目名称:xDrip,代码行数:65,代码来源:BgGraphBuilder.java


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