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


Java BarEntry.getYVals方法代码示例

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


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

示例1: getFormattedValue

import com.github.mikephil.charting.data.BarEntry; //导入方法依赖的package包/类
@Override
public String getFormattedValue(float value, Entry entry, int dataSetIndex, ViewPortHandler viewPortHandler) {

    if (!mDrawWholeStack && entry instanceof BarEntry) {

        BarEntry barEntry = (BarEntry) entry;
        float[] vals = barEntry.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(barEntry.getY()) + mAppendix;
            } else {
                return ""; // return empty
            }
        }
    }

    // return the "proposed" value
    return mFormat.format(value) + mAppendix;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:25,代码来源:StackedValueFormatter.java

示例2: refreshContent

import com.github.mikephil.charting.data.BarEntry; //导入方法依赖的package包/类
@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);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:22,代码来源:StackedBarsMarkerView.java

示例3: addChartEntry

import com.github.mikephil.charting.data.BarEntry; //导入方法依赖的package包/类
private void addChartEntry(HabitEvent event) {
    String date = event.getCompletedate().format(formatter);
    int index = dateMap.get(date);
    BarEntry entry = entries.get(index);

    float[] stacks = entry.getYVals();

    String attribute = event.getHabitAttribute();
    if (attribute.equals("Physical")) {
        stacks[0] += 1;
    } else if (attribute.equals("Mental")) {
        stacks[1] += 1;
    } else if (attribute.equals("Discipline")) {
        stacks[2] += 1;
    } else if (attribute.equals("Social")) {
        stacks[3] += 1;
    }
    entry.setVals(stacks);
}
 
开发者ID:CMPUT301F17T29,项目名称:HabitUp,代码行数:20,代码来源:ChartFragment.java

示例4: calcMinMax

import com.github.mikephil.charting.data.BarEntry; //导入方法依赖的package包/类
@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);
    }
}
 
开发者ID:PhilJay,项目名称:MPAndroidChart-Realm,代码行数:25,代码来源:RealmBarDataSet.java

示例5: getStackedHighlight

import com.github.mikephil.charting.data.BarEntry; //导入方法依赖的package包/类
/**
 * This method creates the Highlight object that also indicates which value of a stacked BarEntry has been
 * selected.
 *
 * @param high the Highlight to work with looking for stacked values
 * @param set
 * @param xVal
 * @param yVal
 * @return
 */
public Highlight getStackedHighlight(Highlight high, IBarDataSet set, float xVal, float yVal) {

    BarEntry entry = set.getEntryForXValue(xVal, yVal);

    if (entry == null)
        return null;

    // not stacked
    if (entry.getYVals() == null) {
        return high;
    } else {
        Range[] ranges = entry.getRanges();

        if (ranges.length > 0) {
            int stackIndex = getClosestStackIndex(ranges, yVal);

            MPPointD pixels = mChart.getTransformer(set.getAxisDependency()).getPixelForValues(high.getX(), ranges[stackIndex].to);

            Highlight stackedHigh = new Highlight(
                    entry.getX(),
                    entry.getY(),
                    (float) pixels.x,
                    (float) pixels.y,
                    high.getDataSetIndex(),
                    stackIndex,
                    high.getAxis()
            );

            MPPointD.recycleInstance(pixels);

            return stackedHigh;
        }
    }

    return null;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:47,代码来源:BarHighlighter.java

示例6: onValueSelected

import com.github.mikephil.charting.data.BarEntry; //导入方法依赖的package包/类
@Override
public void onValueSelected(Entry e, Highlight h) {

    BarEntry entry = (BarEntry) e;

    if (entry.getYVals() != null)
        Log.i("VAL SELECTED", "Value: " + entry.getYVals()[h.getStackIndex()]);
    else
        Log.i("VAL SELECTED", "Value: " + entry.getY());
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:11,代码来源:StackedBarActivity.java

示例7: getFormattedValue

import com.github.mikephil.charting.data.BarEntry; //导入方法依赖的package包/类
@Override
public String getFormattedValue(float value, Entry entry, int dataSetIndex, ViewPortHandler viewPortHandler) {

    FormattedStringCache.Generic chosenCache = mFormattedStringCache;
    int chosenIndex = dataSetIndex;
    float chosenValue = value;

    if (!mDrawWholeStack && entry instanceof BarEntry) {

        BarEntry barEntry = (BarEntry) entry;
        float[] vals = barEntry.getYVals();

        if (vals != null) {

            // find out if we are on top of the stack
            if (vals[vals.length - 1] == value) {
                chosenCache = mFormattedStringCacheWholeStack;
                chosenValue = barEntry.getY();
            } else {
                chosenCache = null;
            }
        }
    }

    if(chosenCache == null){
        return "";
    }

    // return the "proposed" value
    return chosenCache.getFormattedValue(chosenValue, chosenIndex) + mAppendix;
}
 
开发者ID:letolab,项目名称:LETO-Toggl_Android,代码行数:32,代码来源:StackedValueFormatter.java

示例8: getStackedHighlight

import com.github.mikephil.charting.data.BarEntry; //导入方法依赖的package包/类
/**
 * This method creates the Highlight object that also indicates which value of a stacked BarEntry has been
 * selected.
 *
 * @param high the Highlight to work with looking for stacked values
 * @param set
 * @param xVal
 * @param yVal
 * @return
 */
public Highlight getStackedHighlight(Highlight high, IBarDataSet set, float xVal, float yVal) {

    BarEntry entry = set.getEntryForXPos(xVal);

    if (entry == null)
        return null;

    // not stacked
    if (entry.getYVals() == null) {
        return high;
    } else {
        Range[] ranges = entry.getRanges();

        if (ranges.length > 0) {
            int stackIndex = getClosestStackIndex(ranges, yVal);

            MPPointD pixels = mChart.getTransformer(set.getAxisDependency()).getPixelsForValues(high.getX(), ranges[stackIndex].to);

            Highlight stackedHigh = new Highlight(
                    entry.getX(),
                    entry.getY(),
                    (float) pixels.x,
                    (float) pixels.y,
                    high.getDataSetIndex(),
                    stackIndex,
                    high.getAxis()
            );

            MPPointD.recycleInstance(pixels);

            return stackedHigh;
        }
    }

    return null;
}
 
开发者ID:letolab,项目名称:LETO-Toggl_Android,代码行数:47,代码来源:BarHighlighter.java


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