當前位置: 首頁>>代碼示例>>Java>>正文


Java Entry.getY方法代碼示例

本文整理匯總了Java中com.github.mikephil.charting.data.Entry.getY方法的典型用法代碼示例。如果您正苦於以下問題:Java Entry.getY方法的具體用法?Java Entry.getY怎麽用?Java Entry.getY使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.github.mikephil.charting.data.Entry的用法示例。


在下文中一共展示了Entry.getY方法的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: updateBalance

import com.github.mikephil.charting.data.Entry; //導入方法依賴的package包/類
/**
 *
 * @param balance
 */
public void updateBalance(String balance) {
   // _balanceTxt.setText(balance);
    _lastBalance = balance;
    _walletFragView.updateBalance(balance);

    if(_btcChartEntries != null && !_btcChartEntries.isEmpty()) {
        Entry latestValue = _btcChartEntries.get(_btcChartEntries.size() - 1);
        Double actualBalance = Double.parseDouble(balance);
        Locale locale = new Locale("en", "US");
        NumberFormat currencyFormatter = NumberFormat.getCurrencyInstance(locale);

        double conversionValue = actualBalance * latestValue.getY();
        String subBalance = String.format(Locale.getDefault(), "(%s$)", currencyFormatter.format(conversionValue));
        //_subBalanceTxt.setText(subBalance);
        _walletFragView.updateConversion(subBalance);
    }
}
 
開發者ID:ehanoc,項目名稱:xwallet,代碼行數:22,代碼來源:WalletFragment.java

示例2: getPosition

import com.github.mikephil.charting.data.Entry; //導入方法依賴的package包/類
/**
 * Returns a recyclable MPPointF instance.
 *
 * @param e
 * @param axis
 * @return
 */
@Override
public MPPointF getPosition(Entry e, AxisDependency axis) {

    if (e == null)
        return null;

    float[] vals = mGetPositionBuffer;
    vals[0] = e.getY();
    vals[1] = e.getX();

    getTransformer(axis).pointValuesToPixel(vals);

    return MPPointF.getInstance(vals[0], vals[1]);
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:22,代碼來源:HorizontalBarChart.java

示例3: generateTransformedValuesScatter

import com.github.mikephil.charting.data.Entry; //導入方法依賴的package包/類
/**
 * Transforms an List of Entry into a float array containing the x and
 * y values transformed with all matrices for the SCATTERCHART.
 *
 * @param data
 * @return
 */
public float[] generateTransformedValuesScatter(IScatterDataSet data, float phaseX,
                                                float phaseY, int from, int to) {

    final int count = (int) ((to - from) * phaseX + 1) * 2;

    if (valuePointsForGenerateTransformedValuesScatter.length != count) {
        valuePointsForGenerateTransformedValuesScatter = new float[count];
    }
    float[] valuePoints = valuePointsForGenerateTransformedValuesScatter;

    for (int j = 0; j < count; j += 2) {

        Entry e = data.getEntryForIndex(j / 2 + from);

        if (e != null) {
            valuePoints[j] = e.getX();
            valuePoints[j + 1] = e.getY() * phaseY;
        } else {
            valuePoints[j] = 0;
            valuePoints[j + 1] = 0;
        }
    }

    getValueToPixelMatrix().mapPoints(valuePoints);

    return valuePoints;
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:35,代碼來源:Transformer.java

示例4: generateTransformedValuesBubble

import com.github.mikephil.charting.data.Entry; //導入方法依賴的package包/類
/**
 * Transforms an List of Entry into a float array containing the x and
 * y values transformed with all matrices for the BUBBLECHART.
 *
 * @param data
 * @return
 */
public float[] generateTransformedValuesBubble(IBubbleDataSet data, float phaseY, int from, int to) {

    final int count = (to - from + 1) * 2; // (int) Math.ceil((to - from) * phaseX) * 2;

    if (valuePointsForGenerateTransformedValuesBubble.length != count) {
        valuePointsForGenerateTransformedValuesBubble = new float[count];
    }
    float[] valuePoints = valuePointsForGenerateTransformedValuesBubble;

    for (int j = 0; j < count; j += 2) {

        Entry e = data.getEntryForIndex(j / 2 + from);

        if (e != null) {
            valuePoints[j] = e.getX();
            valuePoints[j + 1] = e.getY() * phaseY;
        } else {
            valuePoints[j] = 0;
            valuePoints[j + 1] = 0;
        }
    }

    getValueToPixelMatrix().mapPoints(valuePoints);

    return valuePoints;
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:34,代碼來源:Transformer.java

示例5: generateTransformedValuesLine

import com.github.mikephil.charting.data.Entry; //導入方法依賴的package包/類
/**
 * Transforms an List of Entry into a float array containing the x and
 * y values transformed with all matrices for the LINECHART.
 *
 * @param data
 * @return
 */
public float[] generateTransformedValuesLine(ILineDataSet data,
                                             float phaseX, float phaseY,
                                             int min, int max) {

    final int count = ((int) ((max - min) * phaseX) + 1) * 2;

    if (valuePointsForGenerateTransformedValuesLine.length != count) {
        valuePointsForGenerateTransformedValuesLine = new float[count];
    }
    float[] valuePoints = valuePointsForGenerateTransformedValuesLine;

    for (int j = 0; j < count; j += 2) {

        Entry e = data.getEntryForIndex(j / 2 + min);

        if (e != null) {
            valuePoints[j] = e.getX();
            valuePoints[j + 1] = e.getY() * phaseY;
        } else {
            valuePoints[j] = 0;
            valuePoints[j + 1] = 0;
        }
    }

    getValueToPixelMatrix().mapPoints(valuePoints);

    return valuePoints;
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:36,代碼來源:Transformer.java

示例6: refreshContent

import com.github.mikephil.charting.data.Entry; //導入方法依賴的package包/類
@Override
public void refreshContent(Entry e, Highlight highlight) {
    float seconds = e.getY();
    String formattedTime = FormatUtils.getFormattedTime(context, (int) Math.ceil(seconds));
    DateTime nextDate = date.plusDays((int) e.getX());
    textView.setText(context.getString(R.string.marker_text, formattedTime, dateFormat.print(nextDate)));
    Timber.d(formattedTime);
    super.refreshContent(e, highlight);
}
 
開發者ID:Protino,項目名稱:CodeWatch,代碼行數:10,代碼來源:CustomMarkerView.java

示例7: drawCubicBezier

import com.github.mikephil.charting.data.Entry; //導入方法依賴的package包/類
protected void drawCubicBezier(ILineDataSet dataSet) {

        float phaseX = Math.max(0.f, Math.min(1.f, mAnimator.getPhaseX()));
        float phaseY = mAnimator.getPhaseY();

        Transformer trans = mChart.getTransformer(dataSet.getAxisDependency());

        mXBounds.set(mChart, dataSet);

        float intensity = dataSet.getCubicIntensity();

        cubicPath.reset();

        if (mXBounds.range >= 1) {

            float prevDx = 0f;
            float prevDy = 0f;
            float curDx = 0f;
            float curDy = 0f;

            // Take an extra point from the left, and an extra from the right.
            // That's because we need 4 points for a cubic bezier (cubic=4), otherwise we get lines moving and doing weird stuff on the edges of the chart.
            // So in the starting `prev` and `cur`, go -2, -1
            // And in the `lastIndex`, add +1

            final int firstIndex = mXBounds.min + 1;
            final int lastIndex = mXBounds.min + mXBounds.range;

            Entry prevPrev;
            Entry prev = dataSet.getEntryForIndex(Math.max(firstIndex - 2, 0));
            Entry cur = dataSet.getEntryForIndex(Math.max(firstIndex - 1, 0));
            Entry next = cur;
            int nextIndex = -1;

            if (cur == null) return;

            // let the spline start
            cubicPath.moveTo(cur.getX(), cur.getY() * phaseY);

            for (int j = mXBounds.min + 1; j <= mXBounds.range + mXBounds.min; j++) {

                prevPrev = prev;
                prev = cur;
                cur = nextIndex == j ? next : dataSet.getEntryForIndex(j);

                nextIndex = j + 1 < dataSet.getEntryCount() ? j + 1 : j;
                next = dataSet.getEntryForIndex(nextIndex);

                prevDx = (cur.getX() - prevPrev.getX()) * intensity;
                prevDy = (cur.getY() - prevPrev.getY()) * intensity;
                curDx = (next.getX() - prev.getX()) * intensity;
                curDy = (next.getY() - prev.getY()) * intensity;

                cubicPath.cubicTo(prev.getX() + prevDx, (prev.getY() + prevDy) * phaseY,
                        cur.getX() - curDx,
                        (cur.getY() - curDy) * phaseY, cur.getX(), cur.getY() * phaseY);
            }
        }

        // if filled is enabled, close the path
        if (dataSet.isDrawFilledEnabled()) {

            cubicFillPath.reset();
            cubicFillPath.addPath(cubicPath);

            drawCubicFill(mBitmapCanvas, dataSet, cubicFillPath, trans, mXBounds);
        }

        mRenderPaint.setColor(dataSet.getColor());

        mRenderPaint.setStyle(Paint.Style.STROKE);

        trans.pathValueToPixel(cubicPath);

        mBitmapCanvas.drawPath(cubicPath, mRenderPaint);

        mRenderPaint.setPathEffect(null);
    }
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:79,代碼來源:LineChartRenderer.java

示例8: drawCircles

import com.github.mikephil.charting.data.Entry; //導入方法依賴的package包/類
protected void drawCircles(Canvas c) {

        mRenderPaint.setStyle(Paint.Style.FILL);

        float phaseY = mAnimator.getPhaseY();

        mCirclesBuffer[0] = 0;
        mCirclesBuffer[1] = 0;

        List<ILineDataSet> dataSets = mChart.getLineData().getDataSets();

        for (int i = 0; i < dataSets.size(); i++) {

            ILineDataSet dataSet = dataSets.get(i);

            if (!dataSet.isVisible() || !dataSet.isDrawCirclesEnabled() ||
                    dataSet.getEntryCount() == 0)
                continue;

            mCirclePaintInner.setColor(dataSet.getCircleHoleColor());

            Transformer trans = mChart.getTransformer(dataSet.getAxisDependency());

            mXBounds.set(mChart, dataSet);

            float circleRadius = dataSet.getCircleRadius();
            float circleHoleRadius = dataSet.getCircleHoleRadius();
            boolean drawCircleHole = dataSet.isDrawCircleHoleEnabled() &&
                    circleHoleRadius < circleRadius &&
                    circleHoleRadius > 0.f;
            boolean drawTransparentCircleHole = drawCircleHole &&
                    dataSet.getCircleHoleColor() == ColorTemplate.COLOR_NONE;

            DataSetImageCache imageCache;

            if (mImageCaches.containsKey(dataSet)) {
                imageCache = mImageCaches.get(dataSet);
            } else {
                imageCache = new DataSetImageCache();
                mImageCaches.put(dataSet, imageCache);
            }

            boolean changeRequired = imageCache.init(dataSet);

            // only fill the cache with new bitmaps if a change is required
            if (changeRequired) {
                imageCache.fill(dataSet, drawCircleHole, drawTransparentCircleHole);
            }

            int boundsRangeCount = mXBounds.range + mXBounds.min;

            for (int j = mXBounds.min; j <= boundsRangeCount; j++) {

                Entry e = dataSet.getEntryForIndex(j);

                if (e == null) break;

                mCirclesBuffer[0] = e.getX();
                mCirclesBuffer[1] = e.getY() * phaseY;

                trans.pointValuesToPixel(mCirclesBuffer);

                if (!mViewPortHandler.isInBoundsRight(mCirclesBuffer[0]))
                    break;

                if (!mViewPortHandler.isInBoundsLeft(mCirclesBuffer[0]) ||
                        !mViewPortHandler.isInBoundsY(mCirclesBuffer[1]))
                    continue;

                Bitmap circleBitmap = imageCache.getBitmap(j);

                if (circleBitmap != null) {
                    c.drawBitmap(circleBitmap, mCirclesBuffer[0] - circleRadius, mCirclesBuffer[1] - circleRadius, null);
                }
            }
        }
    }
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:78,代碼來源:LineChartRenderer.java

示例9: drawDataSet

import com.github.mikephil.charting.data.Entry; //導入方法依賴的package包/類
protected void drawDataSet(Canvas c, IScatterDataSet dataSet) {

        ViewPortHandler viewPortHandler = mViewPortHandler;

        Transformer trans = mChart.getTransformer(dataSet.getAxisDependency());

        float phaseY = mAnimator.getPhaseY();

        IShapeRenderer renderer = dataSet.getShapeRenderer();
        if (renderer == null) {
            Log.i("MISSING", "There's no IShapeRenderer specified for ScatterDataSet");
            return;
        }

        int max = (int)(Math.min(
                Math.ceil((float)dataSet.getEntryCount() * mAnimator.getPhaseX()),
                (float)dataSet.getEntryCount()));

        for (int i = 0; i < max; i++) {

            Entry e = dataSet.getEntryForIndex(i);

            mPixelBuffer[0] = e.getX();
            mPixelBuffer[1] = e.getY() * phaseY;

            trans.pointValuesToPixel(mPixelBuffer);

            if (!viewPortHandler.isInBoundsRight(mPixelBuffer[0]))
                break;

            if (!viewPortHandler.isInBoundsLeft(mPixelBuffer[0])
                    || !viewPortHandler.isInBoundsY(mPixelBuffer[1]))
                continue;

            mRenderPaint.setColor(dataSet.getColor(i / 2));
            renderer.renderShape(
                    c, dataSet, mViewPortHandler,
                    mPixelBuffer[0], mPixelBuffer[1],
                    mRenderPaint);
        }
    }
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:42,代碼來源:ScatterChartRenderer.java

示例10: getPosition

import com.github.mikephil.charting.data.Entry; //導入方法依賴的package包/類
/**
 * Returns a recyclable MPPointF instance.
 * Returns the position (in pixels) the provided Entry has inside the chart
 * view or null, if the provided Entry is null.
 *
 * @param e
 * @return
 */
public MPPointF getPosition(Entry e, AxisDependency axis) {

    if (e == null)
        return null;

    mGetPositionBuffer[0] = e.getX();
    mGetPositionBuffer[1] = e.getY();

    getTransformer(axis).pointValuesToPixel(mGetPositionBuffer);

    return MPPointF.getInstance(mGetPositionBuffer[0], mGetPositionBuffer[1]);
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:21,代碼來源:BarLineChartBase.java

示例11: getHighlightsAtIndex

import com.github.mikephil.charting.data.Entry; //導入方法依賴的package包/類
/**
 * Returns an array of Highlight objects for the given index. The Highlight
 * objects give information about the value at the selected index and the
 * DataSet it belongs to. INFORMATION: This method does calculations at
 * runtime. Do not over-use in performance critical situations.
 *
 * @param index
 * @return
 */
protected List<Highlight> getHighlightsAtIndex(int index) {

    mHighlightBuffer.clear();

    float phaseX = mChart.getAnimator().getPhaseX();
    float phaseY = mChart.getAnimator().getPhaseY();
    float sliceangle = mChart.getSliceAngle();
    float factor = mChart.getFactor();

    MPPointF pOut = MPPointF.getInstance(0,0);
    for (int i = 0; i < mChart.getData().getDataSetCount(); i++) {

        IDataSet<?> dataSet = mChart.getData().getDataSetByIndex(i);

        final Entry entry = dataSet.getEntryForIndex(index);

        float y = (entry.getY() - mChart.getYChartMin());

        Utils.getPosition(
                mChart.getCenterOffsets(), y * factor * phaseY,
                sliceangle * index * phaseX + mChart.getRotationAngle(), pOut);

        mHighlightBuffer.add(new Highlight(index, entry.getY(), pOut.x, pOut.y, i, dataSet.getAxisDependency()));
    }

    return mHighlightBuffer;
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:37,代碼來源:RadarHighlighter.java

示例12: getClosestHighlight

import com.github.mikephil.charting.data.Entry; //導入方法依賴的package包/類
@Override
protected Highlight getClosestHighlight(int index, float x, float y) {

    IPieDataSet set = mChart.getData().getDataSet();

    final Entry entry = set.getEntryForIndex(index);

    return new Highlight(index, entry.getY(), x, y, 0, set.getAxisDependency());
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:10,代碼來源:PieHighlighter.java


注:本文中的com.github.mikephil.charting.data.Entry.getY方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。