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


Java CandleEntry类代码示例

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


CandleEntry类属于com.github.mikephil.charting.data包,在下文中一共展示了CandleEntry类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: generateCandleData

import com.github.mikephil.charting.data.CandleEntry; //导入依赖的package包/类
protected CandleData generateCandleData() {

        CandleData d = new CandleData();

        ArrayList<CandleEntry> entries = new ArrayList<CandleEntry>();

        for (int index = 0; index < itemcount; index += 2)
            entries.add(new CandleEntry(index + 1f, 90, 70, 85, 75f));

        CandleDataSet set = new CandleDataSet(entries, "Candle DataSet");
        set.setDecreasingColor(Color.rgb(142, 150, 175));
        set.setShadowColor(Color.DKGRAY);
        set.setBarSpace(0.3f);
        set.setValueTextSize(10f);
        set.setDrawValues(false);
        d.addDataSet(set);

        return d;
    }
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:20,代码来源:CombinedChartActivity.java

示例2: refreshContent

import com.github.mikephil.charting.data.CandleEntry; //导入依赖的package包/类
@Override
public void refreshContent(Entry e, Highlight highlight) {
    if (e instanceof CandleEntry) {
        CandleEntry ce = (CandleEntry) e;
        tvContent.setText(getContext().getString(R.string.salaries_format_salary,
                (int) ce.getHigh()));
    } else {
        EntryMarkerData data = (EntryMarkerData) e.getData();
        tvContent.setText(getContext().getString(R.string.exp_format_marker,
                String.valueOf(data.getValue()),
                String.valueOf(data.getCount())
                )
        );
    }
    super.refreshContent(e, highlight);
}
 
开发者ID:graviton57,项目名称:DOUSalaries,代码行数:17,代码来源:ExperienceMarker.java

示例3: refreshContent

import com.github.mikephil.charting.data.CandleEntry; //导入依赖的package包/类
@Override
public void refreshContent(Entry e, Highlight highlight) {
    SharedPreferences sharedPrefs = PreferenceManager
            .getDefaultSharedPreferences(tvContent.getContext().getApplicationContext());

    if (e instanceof CandleEntry) {

        CandleEntry ce = (CandleEntry) e;

        tvContent.setText("" + Utils.formatNumber(ce.getHigh(), 0, true));
    } else {
        if(sharedPrefs.getString("pref_unit", "mg/dl").equals("mg/dl")) {
            tvContent.setText("" + Utils.formatNumber(e.getVal(), 0, true));
        }else{
            tvContent.setText("" + Utils.formatNumber(e.getVal(), 1, true));
        }
    }
}
 
开发者ID:CMKlug,项目名称:Liapp,代码行数:19,代码来源:MyMarkerView.java

示例4: generateCandleData

import com.github.mikephil.charting.data.CandleEntry; //导入依赖的package包/类
protected CandleData generateCandleData() {

        CandleData d = new CandleData();

        ArrayList<CandleEntry> entries = new ArrayList<CandleEntry>();

        for (int index = 0; index < itemcount; index++)
            entries.add(new CandleEntry(index, 20f, 10f, 13f, 17f));

        CandleDataSet set = new CandleDataSet(entries, "Candle DataSet");
        set.setColor(Color.rgb(80, 80, 80));
        set.setBarSpace(0.3f);
        set.setValueTextSize(10f);
        set.setDrawValues(false);
        d.addDataSet(set);

        return d;
    }
 
开发者ID:rahulmaddineni,项目名称:Stayfit,代码行数:19,代码来源:CombinedChartActivity.java

示例5: generateCandleData

import com.github.mikephil.charting.data.CandleEntry; //导入依赖的package包/类
/**
 * Prepare CandleData for candlestick chart
 * @param xIndex - float
 * @param shadowH - float
 * @param shadowL - float
 * @param open - float
 * @param close - float
 * @param seriesName - String
 * @return CandleData
 */
private CandleData generateCandleData(float xIndex, float shadowH, float shadowL, float open, float close, String seriesName){
  CandleData d = new CandleData();
  ArrayList<CandleEntry> entries = new ArrayList<>();
  entries.add(new CandleEntry(xIndex, shadowH, shadowL, open, close));
  CandleDataSet set = new CandleDataSet(entries, seriesName);
  set.setDecreasingColor(Color.rgb(142, 150, 175));
  set.setShadowColor(Color.DKGRAY);
  set.setDecreasingColor(Color.parseColor("#2196F3"));
  set.setBarSpace(0.3f);
  set.setValueTextSize(10f);
  set.setShadowWidth(2f);
  set.setDrawValues(false);
  d.addDataSet(set);
  return d;
}
 
开发者ID:Esri,项目名称:ecological-marine-unit-android,代码行数:26,代码来源:SummaryChartPresenter.java

示例6: createEntry

import com.github.mikephil.charting.data.CandleEntry; //导入依赖的package包/类
@Override
CandleEntry createEntry(ReadableArray yValues, int index) {
    if (!ReadableType.Map.equals(yValues.getType(index))) {
        throw new IllegalArgumentException();
    }

    ReadableMap entryData = yValues.getMap(index);
    if (!BridgeUtils.validate(entryData, ReadableType.Number, "shadowH") ||
            !BridgeUtils.validate(entryData, ReadableType.Number, "shadowL") ||
            !BridgeUtils.validate(entryData, ReadableType.Number, "open") ||
            !BridgeUtils.validate(entryData, ReadableType.Number, "close")) {
        throw new IllegalArgumentException("CandleStick data must contain: shadowH, shadowL, open and close values");
    }

    float shadowH = (float) entryData.getDouble("shadowH");
    float shadowL = (float) entryData.getDouble("shadowL");
    float open = (float) entryData.getDouble("open");
    float close = (float) entryData.getDouble("close");

    return new CandleEntry(index, shadowH, shadowL, open, close);
}
 
开发者ID:mskec,项目名称:react-native-mp-android-chart,代码行数:22,代码来源:CandleStickChartManager.java

示例7: generateTransformedValuesCandle

import com.github.mikephil.charting.data.CandleEntry; //导入依赖的package包/类
/**
 * Transforms an List of Entry into a float array containing the x and
 * y values transformed with all matrices for the CANDLESTICKCHART.
 *
 * @param data
 * @return
 */
public float[] generateTransformedValuesCandle(ICandleDataSet data,
                                               float phaseX, float phaseY, int from, int to) {

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

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

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

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

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

    getValueToPixelMatrix().mapPoints(valuePoints);

    return valuePoints;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:35,代码来源:Transformer.java

示例8: refreshContent

import com.github.mikephil.charting.data.CandleEntry; //导入依赖的package包/类
@Override
public void refreshContent(Entry e, Highlight highlight) {
    if (e instanceof CandleEntry) {
        CandleEntry ce = (CandleEntry) e;
        tvContent.setText(getContext().getString(R.string.salaries_format_salary,
                (int) ce.getHigh()));
    } else {
        SalaryData salary = (SalaryData) e.getData();
        if (salary != null) {
                tvContent.setText(getContext().getString(R.string.salaries_format_marker_short,
                        salary.getDate(), salary.getSalariesCount(), (int) e.getY()));
        }
    }
    super.refreshContent(e, highlight);
}
 
开发者ID:graviton57,项目名称:DOUSalaries,代码行数:16,代码来源:SalaryMarker.java

示例9: calcMinMax

import com.github.mikephil.charting.data.CandleEntry; //导入依赖的package包/类
@Override
public void calcMinMax(int start, int end) {

    if (mValues == null)
        return;

    if (mValues.size() == 0)
        return;

    int endValue;

    if (end == 0 || end >= mValues.size())
        endValue = mValues.size() - 1;
    else
        endValue = end;

    mYMin = Float.MAX_VALUE;
    mYMax = -Float.MAX_VALUE;

    for (int i = start; i <= endValue; i++) {

        CandleEntry e = mValues.get(i);

        if (e.getLow() < mYMin)
            mYMin = e.getLow();

        if (e.getHigh() > mYMax)
            mYMax = e.getHigh();
    }
}
 
开发者ID:rahulmaddineni,项目名称:Stayfit,代码行数:31,代码来源:RealmCandleDataSet.java

示例10: refreshContent

import com.github.mikephil.charting.data.CandleEntry; //导入依赖的package包/类
@Override
public void refreshContent(Entry e, Highlight highlight) {
    if (e instanceof CandleEntry) {

        CandleEntry ce = (CandleEntry) e;

        tvContent.setText(Utils.formatNumber(ce.getHigh(), 0, true));
    } else {

        tvContent.setText(String.valueOf((int)e.getVal()));
    }
}
 
开发者ID:mrprona92,项目名称:SecretBrand,代码行数:13,代码来源:GraphMarkerView.java

示例11: buildEntryFromResultObject

import com.github.mikephil.charting.data.CandleEntry; //导入依赖的package包/类
public CandleEntry buildEntryFromResultObject(T realmObject, int xIndex) {
    DynamicRealmObject dynamicObject = new DynamicRealmObject(realmObject);

    return new CandleEntry(
            mIndexField == null ? xIndex : dynamicObject.getInt(mIndexField),
            dynamicObject.getFloat(mHighField),
            dynamicObject.getFloat(mLowField),
            dynamicObject.getFloat(mOpenField),
            dynamicObject.getFloat(mCloseField));
}
 
开发者ID:pencil-box,项目名称:NetKnight,代码行数:11,代码来源:RealmCandleDataSet.java

示例12: generateMarginCandleData

import com.github.mikephil.charting.data.CandleEntry; //导入依赖的package包/类
private CandleData generateMarginCandleData(List<MarketHistory> historyEntries) {

        SimpleDateFormat format = new SimpleDateFormat("MMM dd", Locale.getDefault());

        int size = historyEntries.size();
        List<CandleEntry> entries = new ArrayList<>(size);
        List<String> xAxis = new ArrayList<>(size);
        for (int i = 0; i < size; i++) {
            MarketHistory history = historyEntries.get(i);
            Date recordDate = new Date(history.getRecordDate());

            xAxis.add(format.format(recordDate));
            entries.add(new CandleEntry(i,
                (float) history.getHighPrice(),
                (float) history.getLowPrice(),
                (float) history.getAveragePrice(),
                (float) history.getAveragePrice()
            ));
        }

        CandleDataSet set = new CandleDataSet(entries, "Price Margins");
        set.setShadowColor(Color.DKGRAY);
        set.setShadowWidth(2.0f);
        set.setShowCandleBar(true);
        set.setBarSpace(0.35f);
        set.setNeutralColor(Color.DKGRAY);
        set.setDrawValues(false);

        set.setDrawHighlightIndicators(false);
        set.setDrawVerticalHighlightIndicator(false);

        set.setAxisDependency(YAxis.AxisDependency.LEFT);
        return new CandleData(xAxis, set);

    }
 
开发者ID:w9jds,项目名称:MarketBot,代码行数:36,代码来源:MarketHistoryTab.java

示例13: dataSetConfig

import com.github.mikephil.charting.data.CandleEntry; //导入依赖的package包/类
@Override
void dataSetConfig(IDataSet<CandleEntry> dataSet, ReadableMap config) {
    CandleDataSet candleDataSet = (CandleDataSet) dataSet;

    ChartDataSetConfigUtils.commonConfig(candleDataSet, config);
    ChartDataSetConfigUtils.commonBarLineScatterCandleBubbleConfig(candleDataSet, config);
    ChartDataSetConfigUtils.commonLineScatterCandleRadarConfig(candleDataSet, config);

    // CandleDataSet only config
    if (BridgeUtils.validate(config, ReadableType.Number, "barSpace")) {
        candleDataSet.setBarSpace((float) config.getDouble("barSpace"));
    }
    if (BridgeUtils.validate(config, ReadableType.Number, "shadowWidth")) {
        candleDataSet.setShadowWidth((float) config.getDouble("shadowWidth"));
    }
    if (BridgeUtils.validate(config, ReadableType.String, "shadowColor")) {
        candleDataSet.setShadowColor(Color.parseColor(config.getString("shadowColor")));
    }
    if (BridgeUtils.validate(config, ReadableType.Boolean, "shadowColorSameAsCandle")) {
        candleDataSet.setShadowColorSameAsCandle(config.getBoolean("shadowColorSameAsCandle"));
    }
    if (BridgeUtils.validate(config, ReadableType.String, "neutralColor")) {
        candleDataSet.setNeutralColor(Color.parseColor(config.getString("neutralColor")));
    }
    if (BridgeUtils.validate(config, ReadableType.String, "decreasingColor")) {
        candleDataSet.setDecreasingColor(Color.parseColor(config.getString("decreasingColor")));
    }
    if (BridgeUtils.validate(config, ReadableType.String, "decreasingPaintStyle")) {
        candleDataSet.setDecreasingPaintStyle(Paint.Style.valueOf(config.getString("decreasingPaintStyle").toUpperCase()));
    }
    if (BridgeUtils.validate(config, ReadableType.String, "increasingColor")) {
        candleDataSet.setIncreasingColor(Color.parseColor(config.getString("increasingColor")));
    }
    if (BridgeUtils.validate(config, ReadableType.String, "increasingPaintStyle")) {
        candleDataSet.setIncreasingPaintStyle(Paint.Style.valueOf(config.getString("increasingPaintStyle").toUpperCase()));
    }
}
 
开发者ID:mskec,项目名称:react-native-mp-android-chart,代码行数:38,代码来源:CandleStickChartManager.java

示例14: refreshContent

import com.github.mikephil.charting.data.CandleEntry; //导入依赖的package包/类
@Override
public void refreshContent(Entry e, Highlight highlight) {
    if (e instanceof CandleEntry) {
        CandleEntry ce = (CandleEntry) e;
        tvContent.setText(Utils.formatNumber(ce.getClose(), 2, true));
    } else {
        tvContent.setText(Utils.formatNumber(e.getVal(), 0, true));
    }
}
 
开发者ID:mskec,项目名称:react-native-mp-android-chart,代码行数:10,代码来源:RNMarkerView.java

示例15: refreshContent

import com.github.mikephil.charting.data.CandleEntry; //导入依赖的package包/类
@Override
public void refreshContent(Entry e, Highlight highlight) {
    if (e instanceof CandleEntry) {
        CandleEntry ce = (CandleEntry) e;
        tvContent.setText("" + Utils.formatNumber(ce.getHigh(), 0, true));
    } else {
        tvContent.setText("" + Utils.formatNumber(e.getY(), 0, true));
    }
    super.refreshContent(e, highlight);
}
 
开发者ID:davidmigloz,项目名称:go-bees,代码行数:11,代码来源:BeesMarkerView.java


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