/** * calculates the maximum stacksize that occurs in the Entries array of this * DataSet */ private void calcStackSize(List<BarEntry> yVals) { for (int i = 0; i < yVals.size(); i++) { float[] vals = yVals.get(i).getYVals(); if (vals != null && vals.length > mStackSize) mStackSize = vals.length; } }
/** * Calculates the total number of entries this DataSet represents, including * stacks. All values belonging to a stack are calculated separately. */ private void calcEntryCountIncludingStacks(List<BarEntry> yVals) { mEntryCountStacks = 0; for (int i = 0; i < yVals.size(); i++) { float[] vals = yVals.get(i).getYVals(); if (vals == null) mEntryCountStacks++; else mEntryCountStacks += vals.length; } }
@Override public void onValueSelected(Entry e, Highlight h) { BarEntry entry = (BarEntry) e; Log.i("VAL SELECTED", "Value: " + Math.abs(entry.getYVals()[h.getStackIndex()])); }
@Override public String getBarStackedLabel(float value, BarEntry entry) { if (!mDrawWholeStack) { float[] vals = entry.getYVals(); if (vals != null) { // find out if we are on top of the stack if (vals[vals.length - 1] == value) { // return the "sum" across all stack values return mFormat.format(entry.getY()) + mSuffix; } else { return ""; // return empty } } } // return the "proposed" value return mFormat.format(value) + mSuffix; } }
@Override public void refreshContent(Entry e, Highlight highlight) { if (e instanceof BarEntry) { BarEntry be = (BarEntry) e; if(be.getYVals() != null) { // draw the stack value tvContent.setText(Utils.formatNumber(be.getYVals()[highlight.getStackIndex()], 0, true)); } else { tvContent.setText(Utils.formatNumber(be.getY(), 0, true)); } } else { tvContent.setText(Utils.formatNumber(e.getY(), 0, true)); } super.refreshContent(e, highlight); }
protected void calcRanges() { float[] values = getYVals(); if (values == null || values.length == 0) return; mRanges = new Range[values.length]; float negRemain = -getNegativeSum(); float posRemain = 0f; for (int i = 0; i < mRanges.length; i++) { float value = values[i]; if (value < 0) { mRanges[i] = new Range(negRemain, negRemain - value); negRemain -= value; } else { mRanges[i] = new Range(posRemain, posRemain + value); posRemain += value; } } } }
@Override protected void calcMinMax(BarEntry e) { if (e != null && !Float.isNaN(e.getY())) { if (e.getYVals() == null) { if (e.getY() < mYMin) mYMin = e.getY(); if (e.getY() > mYMax) mYMax = e.getY(); } else { if (-e.getNegativeSum() < mYMin) mYMin = -e.getNegativeSum(); if (e.getPositiveSum() > mYMax) mYMax = e.getPositiveSum(); } calcMinMaxX(e); } }
float[] vals = e.getYVals();
float[] vals = e.getYVals();
if (entry.getYVals() == null) { return high; } else {
float[] vals = entry.getYVals(); float x = (buffer.buffer[bufferIndex] + buffer.buffer[bufferIndex + 2]) / 2f;
float[] vals = entry.getYVals();
/** * calculates the maximum stacksize that occurs in the Entries array of this * DataSet */ private void calcStackSize(List<BarEntry> yVals) { for (int i = 0; i < yVals.size(); i++) { float[] vals = yVals.get(i).getYVals(); if (vals != null && vals.length > mStackSize) mStackSize = vals.length; } }
/** * calculates the maximum stacksize that occurs in the Entries array of this * DataSet */ private void calcStackSize(List<BarEntry> yVals) { for (int i = 0; i < yVals.size(); i++) { float[] vals = yVals.get(i).getYVals(); if (vals != null && vals.length > mStackSize) mStackSize = vals.length; } }
/** * calculates the maximum stacksize that occurs in the Entries array of this * DataSet */ private void calcStackSize(List<BarEntry> yVals) { for (int i = 0; i < yVals.size(); i++) { float[] vals = yVals.get(i).getYVals(); if (vals != null && vals.length > mStackSize) mStackSize = vals.length; } }
/** * calculates the maximum stacksize that occurs in the Entries array of this * DataSet */ private void calcStackSize(List<BarEntry> yVals) { for (int i = 0; i < yVals.size(); i++) { float[] vals = yVals.get(i).getYVals(); if (vals != null && vals.length > mStackSize) { mStackSize = vals.length; } } }
/** * Calculates the total number of entries this DataSet represents, including * stacks. All values belonging to a stack are calculated separately. */ private void calcEntryCountIncludingStacks(List<BarEntry> yVals) { mEntryCountStacks = 0; for (int i = 0; i < yVals.size(); i++) { float[] vals = yVals.get(i).getYVals(); if (vals == null) mEntryCountStacks++; else mEntryCountStacks += vals.length; } }
@Override public void onValueSelected(Entry e, Highlight h) { BarEntry entry = (BarEntry) e; Log.i("VAL SELECTED", "Value: " + Math.abs(entry.getYVals()[h.getStackIndex()])); }