@Deprecated @Override public float getX() { return super.getX(); } }
@Deprecated @Override public float getX() { Log.i("DEPRECATED", "Pie entries do not have x values"); return super.getX(); }
@Override public void addEntryOrdered(T e) { if (e == null) return; if (mValues == null) { mValues = new ArrayList<T>(); } calcMinMax(e); if (mValues.size() > 0 && mValues.get(mValues.size() - 1).getX() > e.getX()) { int closestIndex = getEntryIndex(e.getX(), e.getY(), Rounding.UP); mValues.add(closestIndex, e); } else { mValues.add(e); } }
@Override public void onValueSelected(Entry e, Highlight h) { Log.i("VAL SELECTED", "Value: " + e.getY() + ", xIndex: " + e.getX() + ", DataSet index: " + h.getDataSetIndex()); }
@Override public void onValueSelected(Entry e, Highlight h) { Log.i("VAL SELECTED", "Value: " + e.getY() + ", xIndex: " + e.getX() + ", DataSet index: " + h.getDataSetIndex()); }
@Override public void onValueSelected(Entry e, Highlight h) { if (e == null) return; Log.i("VAL SELECTED", "Value: " + e.getY() + ", xIndex: " + e.getX() + ", DataSet index: " + h.getDataSetIndex()); }
@Override public void onValueSelected(Entry e, Highlight h) { Log.i("VAL SELECTED", "Value: " + e.getY() + ", xIndex: " + e.getX() + ", DataSet index: " + h.getDataSetIndex()); }
@Override public void onValueSelected(Entry e, Highlight h) { Log.i("VAL SELECTED", "Value: " + e.getY() + ", xIndex: " + e.getX() + ", DataSet index: " + h.getDataSetIndex()); }
@Override public void onValueSelected(Entry e, Highlight h) { Log.i("VAL SELECTED", "Value: " + e.getY() + ", xIndex: " + e.getX() + ", DataSet index: " + h.getDataSetIndex()); }
@Override public void refreshContent(Entry e, Highlight highlight) { tvContent.setText(String.format("x: %s, y: %s", xAxisValueFormatter.getFormattedValue(e.getX()), format.format(e.getY()))); super.refreshContent(e, highlight); }
/** * ###### ###### DATA RELATED METHODS ###### ###### */ @Override public int getIndexInEntries(int xIndex) { for (int i = 0; i < getEntryCount(); i++) { if (xIndex == getEntryForIndex(i).getX()) return i; } return -1; }
/** * Returns the DataSet that contains the provided Entry, or null, if no * DataSet contains this Entry. * * @param e * @return */ public T getDataSetForEntry(Entry e) { if (e == null) return null; for (int i = 0; i < mDataSets.size(); i++) { T set = mDataSets.get(i); for (int j = 0; j < set.getEntryCount(); j++) { if (e.equalTo(set.getEntryForXValue(e.getX(), e.getY()))) return set; } } return null; }
protected void drawCubicFill(Canvas c, ILineDataSet dataSet, Path spline, Transformer trans, XBounds bounds) { float fillMin = dataSet.getFillFormatter() .getFillLinePosition(dataSet, mChart); spline.lineTo(dataSet.getEntryForIndex(bounds.min + bounds.range).getX(), fillMin); spline.lineTo(dataSet.getEntryForIndex(bounds.min).getX(), fillMin); spline.close(); trans.pathValueToPixel(spline); final Drawable drawable = dataSet.getFillDrawable(); if (drawable != null) { drawFilledPath(c, spline, drawable); } else { drawFilledPath(c, spline, dataSet.getFillColor(), dataSet.getFillAlpha()); } }
/** * 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]); }
/** * 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]); }
@Override public void onValueSelected(Entry e, Highlight h) { Log.i("Entry selected", e.toString()); chart.centerViewToAnimated(e.getX(), e.getY(), chart.getData().getDataSetByIndex(h.getDataSetIndex()) .getAxisDependency(), 500); //chart.zoomAndCenterAnimated(2.5f, 2.5f, e.getX(), e.getY(), chart.getData().getDataSetByIndex(dataSetIndex) // .getAxisDependency(), 1000); //chart.zoomAndCenterAnimated(1.8f, 1.8f, e.getX(), e.getY(), chart.getData().getDataSetByIndex(dataSetIndex) // .getAxisDependency(), 1000); }
@Override public void drawHighlighted(Canvas c, Highlight[] indices) { LineData lineData = mChart.getLineData(); for (Highlight high : indices) { ILineDataSet set = lineData.getDataSetByIndex(high.getDataSetIndex()); if (set == null || !set.isHighlightEnabled()) continue; Entry e = set.getEntryForXValue(high.getX(), high.getY()); if (!isInBoundsX(e, set)) continue; MPPointD pix = mChart.getTransformer(set.getAxisDependency()).getPixelForValues(e.getX(), e.getY() * mAnimator .getPhaseY()); high.setDraw((float) pix.x, (float) pix.y); // draw the lines drawHighlightLines(c, (float) pix.x, (float) pix.y, set); } }
@Override public void drawHighlighted(Canvas c, Highlight[] indices) { ScatterData scatterData = mChart.getScatterData(); for (Highlight high : indices) { IScatterDataSet set = scatterData.getDataSetByIndex(high.getDataSetIndex()); if (set == null || !set.isHighlightEnabled()) continue; final Entry e = set.getEntryForXValue(high.getX(), high.getY()); if (!isInBoundsX(e, set)) continue; MPPointD pix = mChart.getTransformer(set.getAxisDependency()).getPixelForValues(e.getX(), e.getY() * mAnimator .getPhaseY()); high.setDraw((float) pix.x, (float) pix.y); // draw the lines drawHighlightLines(c, (float) pix.x, (float) pix.y, set); } } }