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

Java ICandleDataSet类代码示例

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

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



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

示例1: setData

import com.github.mikephil.charting.interfaces.datasets.ICandleDataSet; //导入依赖的package包/类
private void setData() {

        RealmResults<RealmDemoData> result = mRealm.where(RealmDemoData.class).findAll();

        RealmCandleDataSet<RealmDemoData> set = new RealmCandleDataSet<RealmDemoData>(result, "xValue", "high", "low", "open", "close");
        set.setLabel("Realm CandleDataSet");
        set.setShadowColor(Color.DKGRAY);
        set.setShadowWidth(0.7f);
        set.setDecreasingColor(Color.RED);
        set.setDecreasingPaintStyle(Paint.Style.FILL);
        set.setIncreasingColor(Color.rgb(122, 242, 84));
        set.setIncreasingPaintStyle(Paint.Style.STROKE);
        set.setNeutralColor(Color.BLUE);

        ArrayList<ICandleDataSet> dataSets = new ArrayList<ICandleDataSet>();
        dataSets.add(set); // add the dataset

        // create a data object with the dataset list
        CandleData data = new CandleData(dataSets);
        styleData(data);

        // set data
        mChart.setData(data);
        mChart.animateY(1400, Easing.EasingOption.EaseInOutQuart);
    }
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:26,代码来源:RealmDatabaseActivityCandle.java


示例2: setData

import com.github.mikephil.charting.interfaces.datasets.ICandleDataSet; //导入依赖的package包/类
private void setData() {

        RealmResults<RealmDemoData> result = mRealm.allObjects(RealmDemoData.class);

        RealmCandleDataSet<RealmDemoData> set = new RealmCandleDataSet<RealmDemoData>(result, "high", "low", "open", "close", "xIndex");
        set.setLabel("Realm Realm CandleDataSet");
        set.setShadowColor(Color.DKGRAY);
        set.setShadowWidth(0.7f);
        set.setDecreasingColor(Color.RED);
        set.setDecreasingPaintStyle(Paint.Style.FILL);
        set.setIncreasingColor(Color.rgb(122, 242, 84));
        set.setIncreasingPaintStyle(Paint.Style.STROKE);
        set.setNeutralColor(Color.BLUE);

        ArrayList<ICandleDataSet> dataSets = new ArrayList<ICandleDataSet>();
        dataSets.add(set); // add the dataset

        // create a data object with the dataset list
        RealmCandleData data = new RealmCandleData(result, "xValue", dataSets);
        styleData(data);

        // set data
        mChart.setData(data);
        mChart.animateY(1400, Easing.EasingOption.EaseInOutQuart);
    }
 
开发者ID:rahulmaddineni,项目名称:Stayfit,代码行数:26,代码来源:RealmDatabaseActivityCandle.java


示例3: drawData

import com.github.mikephil.charting.interfaces.datasets.ICandleDataSet; //导入依赖的package包/类
@Override
public void drawData(Canvas c) {

    CandleData candleData = mChart.getCandleData();

    for (ICandleDataSet set : candleData.getDataSets()) {

        if (set.isVisible())
            drawDataSet(c, set);
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:12,代码来源:CandleStickChartRenderer.java


示例4: generateTransformedValuesCandle

import com.github.mikephil.charting.interfaces.datasets.ICandleDataSet; //导入依赖的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


示例5: drawData

import com.github.mikephil.charting.interfaces.datasets.ICandleDataSet; //导入依赖的package包/类
@Override
public void drawData(Canvas c) {

    CandleData candleData = mChart.getCandleData();

    for (ICandleDataSet set : candleData.getDataSets()) {

        if (set.isVisible() && set.getEntryCount() > 0)
            drawDataSet(c, set);
    }
}
 
开发者ID:rahulmaddineni,项目名称:Stayfit,代码行数:12,代码来源:CandleStickChartRenderer.java


示例6: drawData

import com.github.mikephil.charting.interfaces.datasets.ICandleDataSet; //导入依赖的package包/类
@Override
public void drawData(Canvas c) {

    CandleData candleData = mChart.getCandleData();

    ICandleDataSet set;
    List<ICandleDataSet> dataSets = candleData.getDataSets();
    int setCount = dataSets.size();
    for (int i = 0; i < setCount; i++) {
        set = dataSets.get(i);

        if (set.isVisible())
            drawDataSet(c, set);
    }
}
 
开发者ID:letolab,项目名称:LETO-Toggl_Android,代码行数:16,代码来源:CandleStickChartRenderer.java


示例7: CandleData

import com.github.mikephil.charting.interfaces.datasets.ICandleDataSet; //导入依赖的package包/类
public CandleData(List<ICandleDataSet> dataSets) {
    super(dataSets);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:4,代码来源:CandleData.java


示例8: CandleData

import com.github.mikephil.charting.interfaces.datasets.ICandleDataSet; //导入依赖的package包/类
public CandleData(List<String> xVals, List<ICandleDataSet> dataSets) {
    super(xVals, dataSets);
}
 
开发者ID:rahulmaddineni,项目名称:Stayfit,代码行数:4,代码来源:CandleData.java


示例9: toList

import com.github.mikephil.charting.interfaces.datasets.ICandleDataSet; //导入依赖的package包/类
private static List<ICandleDataSet> toList(ICandleDataSet dataSet) {
    List<ICandleDataSet> sets = new ArrayList<ICandleDataSet>();
    sets.add(dataSet);
    return sets;
}
 
开发者ID:rahulmaddineni,项目名称:Stayfit,代码行数:6,代码来源:CandleData.java


示例10: RealmCandleData

import com.github.mikephil.charting.interfaces.datasets.ICandleDataSet; //导入依赖的package包/类
public RealmCandleData(RealmResults<? extends RealmObject> result, String xValuesField, List<ICandleDataSet> dataSets) {
    super(RealmUtils.toXVals(result, xValuesField), dataSets);
}
 
开发者ID:rahulmaddineni,项目名称:Stayfit,代码行数:4,代码来源:RealmCandleData.java


示例11: generateTransformedValuesCandle

import com.github.mikephil.charting.interfaces.datasets.ICandleDataSet; //导入依赖的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) Math.ceil((to - from) * phaseX) * 2;

    float[] valuePoints = new float[count];

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

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

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

    getValueToPixelMatrix().mapPoints(valuePoints);

    return valuePoints;
}
 
开发者ID:rahulmaddineni,项目名称:Stayfit,代码行数:29,代码来源:Transformer.java


示例12: onOptionsItemSelected

import com.github.mikephil.charting.interfaces.datasets.ICandleDataSet; //导入依赖的package包/类
@Override
public boolean onOptionsItemSelected(MenuItem item) {

    switch (item.getItemId()) {
        case R.id.actionToggleHighlight: {
            if(mChart.getData() != null) {
                mChart.getData().setHighlightEnabled(!mChart.getData().isHighlightEnabled());
                mChart.invalidate();
            }
            break;
        }
        case R.id.actionTogglePinch: {
            if (mChart.isPinchZoomEnabled())
                mChart.setPinchZoom(false);
            else
                mChart.setPinchZoom(true);

            mChart.invalidate();
            break;
        }
        case R.id.actionToggleAutoScaleMinMax: {
            mChart.setAutoScaleMinMaxEnabled(!mChart.isAutoScaleMinMaxEnabled());
            mChart.notifyDataSetChanged();
            break;
        }
        case R.id.actionToggleMakeShadowSameColorAsCandle: {
            for (ICandleDataSet set : mChart.getData().getDataSets()) {
               //TODO: set.setShadowColorSameAsCandle(!set.getShadowColorSameAsCandle());
            }

            mChart.invalidate();
            break;
        }
        case R.id.animateX: {
            mChart.animateX(3000);
            break;
        }
        case R.id.animateY: {
            mChart.animateY(3000);
            break;
        }
        case R.id.animateXY: {

            mChart.animateXY(3000, 3000);
            break;
        }
        case R.id.actionSave: {
            if (mChart.saveToGallery("title" + System.currentTimeMillis(), 50)) {
                Toast.makeText(getApplicationContext(), "Saving SUCCESSFUL!",
                        Toast.LENGTH_SHORT).show();
            } else
                Toast.makeText(getApplicationContext(), "Saving FAILED!", Toast.LENGTH_SHORT)
                        .show();
            break;
        }
    }
    return true;
}
 
开发者ID:rahulmaddineni,项目名称:Stayfit,代码行数:59,代码来源:CandleStickChartActivity.java


示例13: drawHighlighted

import com.github.mikephil.charting.interfaces.datasets.ICandleDataSet; //导入依赖的package包/类
@Override
public void drawHighlighted(Canvas c, Highlight[] indices) {

    CandleData candleData = mChart.getCandleData();

    for (Highlight high : indices) {

        final int minDataSetIndex = high.getDataSetIndex() == -1
                ? 0
                : high.getDataSetIndex();
        final int maxDataSetIndex = high.getDataSetIndex() == -1
                ? candleData.getDataSetCount()
                : (high.getDataSetIndex() + 1);
        if (maxDataSetIndex - minDataSetIndex < 1) continue;

        for (int dataSetIndex = minDataSetIndex;
             dataSetIndex < maxDataSetIndex;
             dataSetIndex++) {

            int xIndex = high.getXIndex(); // get the
            // x-position

            ICandleDataSet set = mChart.getCandleData().getDataSetByIndex(dataSetIndex);

            if (set == null || !set.isHighlightEnabled())
                continue;

            CandleEntry e = set.getEntryForXIndex(xIndex);

            if (e == null || e.getXIndex() != xIndex)
                continue;

            float lowValue = e.getLow() * mAnimator.getPhaseY();
            float highValue = e.getHigh() * mAnimator.getPhaseY();
            float y = (lowValue + highValue) / 2f;

            float[] pts = new float[]{
                    xIndex, y
            };

            mChart.getTransformer(set.getAxisDependency()).pointValuesToPixel(pts);

            // draw the lines
            drawHighlightLines(c, pts, set);
        }
    }
}
 
开发者ID:pencil-box,项目名称:NetKnight,代码行数:48,代码来源:CandleStickChartRenderer.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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