本文整理汇总了Java中com.github.mikephil.charting.utils.Utils.FLOAT_EPSILON属性的典型用法代码示例。如果您正苦于以下问题:Java Utils.FLOAT_EPSILON属性的具体用法?Java Utils.FLOAT_EPSILON怎么用?Java Utils.FLOAT_EPSILON使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.github.mikephil.charting.utils.Utils
的用法示例。
在下文中一共展示了Utils.FLOAT_EPSILON属性的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: equalTo
/**
* Compares value, xIndex and data of the entries. Returns true if entries
* are equal in those points, false if not. Does not check by hash-code like
* it's done by the "equals" method.
*
* @param e
* @return
*/
public boolean equalTo(Entry e) {
if (e == null)
return false;
if (e.getData() != this.getData())
return false;
if (Math.abs(e.x - this.x) > Utils.FLOAT_EPSILON)
return false;
if (Math.abs(e.getY() - this.getY()) > Utils.FLOAT_EPSILON)
return false;
return true;
}
示例2: drawRoundedSlices
/**
* This gives all pie-slices a rounded edge.
*
* @param c
*/
protected void drawRoundedSlices(Canvas c) {
if (!mChart.isDrawRoundedSlicesEnabled())
return;
IPieDataSet dataSet = mChart.getData().getDataSet();
if (!dataSet.isVisible())
return;
float phaseX = mAnimator.getPhaseX();
float phaseY = mAnimator.getPhaseY();
MPPointF center = mChart.getCenterCircleBox();
float r = mChart.getRadius();
// calculate the radius of the "slice-circle"
float circleRadius = (r - (r * mChart.getHoleRadius() / 100f)) / 2f;
float[] drawAngles = mChart.getDrawAngles();
float angle = mChart.getRotationAngle();
for (int j = 0; j < dataSet.getEntryCount(); j++) {
float sliceAngle = drawAngles[j];
Entry e = dataSet.getEntryForIndex(j);
// draw only if the value is greater than zero
if ((Math.abs(e.getY()) > Utils.FLOAT_EPSILON)) {
float x = (float) ((r - circleRadius)
* Math.cos(Math.toRadians((angle + sliceAngle)
* phaseY)) + center.x);
float y = (float) ((r - circleRadius)
* Math.sin(Math.toRadians((angle + sliceAngle)
* phaseY)) + center.y);
mRenderPaint.setColor(dataSet.getColor(j));
mBitmapCanvas.drawCircle(x, y, circleRadius, mRenderPaint);
}
angle += sliceAngle * phaseX;
}
MPPointF.recycleInstance(center);
}