• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java CandleEntry类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: buildEntryFromResultObject

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

    return new CandleEntry(
            mXValuesField == null ? x : dynamicObject.getFloat(mXValuesField),
            dynamicObject.getFloat(mHighField),
            dynamicObject.getFloat(mLowField),
            dynamicObject.getFloat(mOpenField),
            dynamicObject.getFloat(mCloseField));
}
 
开发者ID:PhilJay,项目名称:MPAndroidChart-Realm,代码行数:12,代码来源:RealmCandleDataSet.java


示例17: calcMinMax

import com.github.mikephil.charting.data.CandleEntry; //导入依赖的package包/类
@Override
protected void calcMinMax(CandleEntry e) {

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

    if (e.getHigh() > mYMax)
        mYMax = e.getHigh();

    calcMinMaxX(e);
}
 
开发者ID:PhilJay,项目名称:MPAndroidChart-Realm,代码行数:12,代码来源:RealmCandleDataSet.java


示例18: calcMinMaxY

import com.github.mikephil.charting.data.CandleEntry; //导入依赖的package包/类
@Override
protected void calcMinMaxY(CandleEntry e) {

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

    if (e.getHigh() > mYMax)
        mYMax = e.getHigh();

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

    if (e.getLow() > mYMax)
        mYMax = e.getLow();
}
 
开发者ID:PhilJay,项目名称:MPAndroidChart-Realm,代码行数:16,代码来源:RealmCandleDataSet.java


示例19: transformBody

import com.github.mikephil.charting.data.CandleEntry; //导入依赖的package包/类
/**
 * Transforms the values of an entry in order to draw the candle-body.
 * 
 * @param bodyPoints
 * @param e
 * @param bodySpace
 */
private void transformBody(float[] bodyPoints, CandleEntry e, float bodySpace) {

    bodyPoints[0] = e.getXIndex() + bodySpace;
    bodyPoints[1] = e.getClose() * mPhaseY;
    bodyPoints[2] = e.getXIndex() + (1f - bodySpace);
    bodyPoints[3] = e.getOpen() * mPhaseY;

    mTrans.pointValuesToPixel(bodyPoints);
}
 
开发者ID:LINKIWI,项目名称:mobile-manager-for-cloudflare,代码行数:17,代码来源:CandleStickChart.java


示例20: transformShadow

import com.github.mikephil.charting.data.CandleEntry; //导入依赖的package包/类
/**
 * Transforms the values of an entry in order to draw the candle-shadow.
 * 
 * @param shadowPoints
 * @param e
 */
private void transformShadow(float[] shadowPoints, CandleEntry e) {

    shadowPoints[0] = e.getXIndex() + 0.5f;
    shadowPoints[1] = e.getHigh() * mPhaseY;
    shadowPoints[2] = e.getXIndex() + 0.5f;
    shadowPoints[3] = e.getLow() * mPhaseY;

    mTrans.pointValuesToPixel(shadowPoints);
}
 
开发者ID:LINKIWI,项目名称:mobile-manager-for-cloudflare,代码行数:16,代码来源:CandleStickChart.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ArrayModel类代码示例发布时间:2022-05-21
下一篇:
Java CreateQueueResult类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap