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

Java IScatterDataSet类代码示例

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

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



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

示例1: renderShape

import com.github.mikephil.charting.interfaces.datasets.IScatterDataSet; //导入依赖的package包/类
@Override
public void renderShape(Canvas c, IScatterDataSet dataSet, ViewPortHandler viewPortHandler,
                        float posX, float posY, Paint renderPaint) {

    final float shapeHalf = dataSet.getScatterShapeSize() / 2f;

    renderPaint.setStyle(Paint.Style.STROKE);
    renderPaint.setStrokeWidth(Utils.convertDpToPixel(1f));

    c.drawLine(
            posX - shapeHalf,
            posY - shapeHalf,
            posX + shapeHalf,
            posY + shapeHalf,
            renderPaint);
    c.drawLine(
            posX + shapeHalf,
            posY - shapeHalf,
            posX - shapeHalf,
            posY + shapeHalf,
            renderPaint);

}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:24,代码来源:XShapeRenderer.java


示例2: renderShape

import com.github.mikephil.charting.interfaces.datasets.IScatterDataSet; //导入依赖的package包/类
@Override
public void renderShape(Canvas c, IScatterDataSet dataSet, ViewPortHandler viewPortHandler,
                        float posX, float posY, Paint renderPaint) {

    final float shapeHalf = dataSet.getScatterShapeSize() / 2f;

    renderPaint.setStyle(Paint.Style.STROKE);
    renderPaint.setStrokeWidth(Utils.convertDpToPixel(1f));

    c.drawLine(
            posX - shapeHalf,
            posY,
            posX + shapeHalf,
            posY,
            renderPaint);
    c.drawLine(
            posX,
            posY - shapeHalf,
            posX,
            posY + shapeHalf,
            renderPaint);

}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:24,代码来源:CrossShapeRenderer.java


示例3: renderShape

import com.github.mikephil.charting.interfaces.datasets.IScatterDataSet; //导入依赖的package包/类
@Override
public void renderShape(Canvas c, IScatterDataSet dataSet, ViewPortHandler viewPortHandler,
                        float posX, float posY, Paint renderPaint) {

    final float shapeHalf = dataSet.getScatterShapeSize() / 2f;

    renderPaint.setStyle(Paint.Style.STROKE);
    renderPaint.setStrokeWidth(Utils.convertDpToPixel(1f));

    c.drawLine(
            posX,
            posY - (2 * shapeHalf),
            posX + (2 * shapeHalf),
            posY,
            renderPaint);

    c.drawLine(
            posX,
            posY - (2 * shapeHalf),
            posX - (2 * shapeHalf),
            posY,
            renderPaint);

}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:25,代码来源:ChevronUpShapeRenderer.java


示例4: renderShape

import com.github.mikephil.charting.interfaces.datasets.IScatterDataSet; //导入依赖的package包/类
@Override
public void renderShape(Canvas c, IScatterDataSet dataSet, ViewPortHandler viewPortHandler,
                 float posX, float posY, Paint renderPaint) {

    final float shapeHalf = dataSet.getScatterShapeSize() / 2f;

    renderPaint.setStyle(Paint.Style.STROKE);
    renderPaint.setStrokeWidth(Utils.convertDpToPixel(1f));

    c.drawLine(
            posX,
            posY + (2 * shapeHalf),
            posX + (2 * shapeHalf),
            posY,
            renderPaint);

    c.drawLine(
            posX,
            posY + (2 * shapeHalf),
            posX - (2 * shapeHalf),
            posY,
            renderPaint);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:24,代码来源:ChevronDownShapeRenderer.java


示例5: generateScatterData

import com.github.mikephil.charting.interfaces.datasets.IScatterDataSet; //导入依赖的package包/类
protected ScatterData generateScatterData(int dataSets, float range, int count) {
    
    ArrayList<IScatterDataSet> sets = new ArrayList<IScatterDataSet>();
    
    ScatterChart.ScatterShape[] shapes = ScatterChart.ScatterShape.getAllDefaultShapes();
    
    for(int i = 0; i < dataSets; i++) {
       
        ArrayList<Entry> entries = new ArrayList<Entry>();
        
        for(int j = 0; j < count; j++) {        
            entries.add(new Entry(j, (float) (Math.random() * range) + range / 4));
        }
        
        ScatterDataSet ds = new ScatterDataSet(entries, getLabel(i));
        ds.setScatterShapeSize(12f);
        ds.setScatterShape(shapes[i % shapes.length]);
        ds.setColors(ColorTemplate.COLORFUL_COLORS);
        ds.setScatterShapeSize(9f);
        sets.add(ds);
    }
    
    ScatterData d = new ScatterData(sets);
    d.setValueTypeface(tf);
    return d;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:27,代码来源:SimpleFragment.java


示例6: setData

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

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

        RealmScatterDataSet<RealmDemoData> set = new RealmScatterDataSet<RealmDemoData>(result, "xValue", "yValue");
        set.setLabel("Realm ScatterDataSet");
        set.setScatterShapeSize(9f);
        set.setColor(ColorTemplate.rgb("#CDDC39"));
        set.setScatterShape(ScatterChart.ScatterShape.CIRCLE);

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

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

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


示例7: generateTransformedValuesScatter

import com.github.mikephil.charting.interfaces.datasets.IScatterDataSet; //导入依赖的package包/类
/**
 * Transforms an List of Entry into a float array containing the x and
 * y values transformed with all matrices for the SCATTERCHART.
 *
 * @param data
 * @return
 */
public float[] generateTransformedValuesScatter(IScatterDataSet data,
                                                float phaseY) {

    float[] valuePoints = new float[data.getEntryCount() * 2];

    for (int j = 0; j < valuePoints.length; j += 2) {

        Entry e = data.getEntryForIndex(j / 2);

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

    getValueToPixelMatrix().mapPoints(valuePoints);

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


示例8: generateScatterData

import com.github.mikephil.charting.interfaces.datasets.IScatterDataSet; //导入依赖的package包/类
protected ScatterData generateScatterData(int dataSets, float range, int count) {
    
    ArrayList<IScatterDataSet> sets = new ArrayList<IScatterDataSet>();
    
    ScatterShape[] shapes = ScatterChart.getAllPossibleShapes();
    
    for(int i = 0; i < dataSets; i++) {
       
        ArrayList<Entry> entries = new ArrayList<Entry>();
        
        for(int j = 0; j < count; j++) {        
            entries.add(new Entry((float) (Math.random() * range) + range / 4, j));
        }
        
        ScatterDataSet ds = new ScatterDataSet(entries, getLabel(i));
        ds.setScatterShapeSize(12f);
        ds.setScatterShape(shapes[i % shapes.length]);
        ds.setColors(ColorTemplate.COLORFUL_COLORS);
        ds.setScatterShapeSize(9f);
        sets.add(ds);
    }
    
    ScatterData d = new ScatterData(ChartData.generateXVals(0, count), sets);
    d.setValueTypeface(tf);
    return d;
}
 
开发者ID:rahulmaddineni,项目名称:Stayfit,代码行数:27,代码来源:SimpleFragment.java


示例9: setData

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

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

        RealmScatterDataSet<RealmDemoData> set = new RealmScatterDataSet<RealmDemoData>(result, "value", "xIndex");
        set.setLabel("Realm ScatterDataSet");
        set.setScatterShapeSize(9f);
        set.setColor(ColorTemplate.rgb("#CDDC39"));
        set.setScatterShape(ScatterChart.ScatterShape.CIRCLE);

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

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

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


示例10: drawDataSet

import com.github.mikephil.charting.interfaces.datasets.IScatterDataSet; //导入依赖的package包/类
protected void drawDataSet(Canvas c, IScatterDataSet dataSet) {

        Transformer trans = mChart.getTransformer(dataSet.getAxisDependency());

        float phaseX = Math.max(0.f, Math.min(1.f, mAnimator.getPhaseX()));
        float phaseY = mAnimator.getPhaseY();

        final float shapeSize = Utils.convertDpToPixel(dataSet.getScatterShapeSize());

        ScatterBuffer buffer = mScatterBuffers[mChart.getScatterData().getIndexOfDataSet(
                dataSet)];
        buffer.setPhases(phaseX, phaseY);
        buffer.feed(dataSet);

        trans.pointValuesToPixel(buffer.buffer);

        String shape = dataSet.getScatterShape();
        ShapeRenderer renderer = mChart.getShapeRenderer(shape);

        if (renderer != null) {
            renderer.renderShape(c, dataSet, mViewPortHandler, buffer, mRenderPaint, shapeSize);
        } else {
            throw new RuntimeException("No ShapeRenderer found for provided identifier. Please make sure to add a ShapeRenderer" +
                    " capable of rendering the provided shape.");
        }
    }
 
开发者ID:pencil-box,项目名称:NetKnight,代码行数:27,代码来源:ScatterChartRenderer.java


示例11: drawDataSet

import com.github.mikephil.charting.interfaces.datasets.IScatterDataSet; //导入依赖的package包/类
protected void drawDataSet(Canvas c, IScatterDataSet dataSet) {

        Transformer trans = mChart.getTransformer(dataSet.getAxisDependency());

        float phaseX = Math.max(0.f, Math.min(1.f, mAnimator.getPhaseX()));
        float phaseY = mAnimator.getPhaseY();

        final float shapeSize = Utils.convertDpToPixel(dataSet.getScatterShapeSize());

        ScatterBuffer buffer = mScatterBuffers[mChart.getScatterData().getIndexOfDataSet(dataSet)];
        buffer.setPhases(phaseX, phaseY);
        buffer.feed(dataSet);

        trans.pointValuesToPixel(buffer.buffer);

        ShapeRenderer renderer = dataSet.getShapeRenderer();

        if (renderer != null) {
            renderer.renderShape(c, dataSet, mViewPortHandler, buffer, mRenderPaint, shapeSize);
        } else {
            throw new RuntimeException("No ShapeRenderer found for provided identifier. Please make sure to add a ShapeRenderer" +
                    " capable of rendering the provided shape.");
        }
    }
 
开发者ID:letolab,项目名称:LETO-Toggl_Android,代码行数:25,代码来源:ScatterChartRenderer.java


示例12: getGreatestShapeSize

import com.github.mikephil.charting.interfaces.datasets.IScatterDataSet; //导入依赖的package包/类
/**
 * Returns the maximum shape-size across all DataSets.
 *
 * @return
 */
public float getGreatestShapeSize() {

    float max = 0f;

    for (IScatterDataSet set : mDataSets) {
        float size = set.getScatterShapeSize();

        if (size > max)
            max = size;
    }

    return max;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:19,代码来源:ScatterData.java


示例13: drawData

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

    ScatterData scatterData = mChart.getScatterData();

    for (IScatterDataSet set : scatterData.getDataSets()) {

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


示例14: generateTransformedValuesScatter

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

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

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

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

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

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

    getValueToPixelMatrix().mapPoints(valuePoints);

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


示例15: renderShape

import com.github.mikephil.charting.interfaces.datasets.IScatterDataSet; //导入依赖的package包/类
@Override
public void renderShape(Canvas c, IScatterDataSet dataSet, ViewPortHandler viewPortHandler,
                        float posX, float posY, Paint renderPaint) {

    final float shapeHalf = dataSet.getScatterShapeSize() / 2f;

    c.drawLine(
            posX - shapeHalf,
            posY - shapeHalf,
            posX + shapeHalf,
            posY + shapeHalf,
            renderPaint);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:14,代码来源:CustomScatterShapeRenderer.java


示例16: getGreatestShapeSize

import com.github.mikephil.charting.interfaces.datasets.IScatterDataSet; //导入依赖的package包/类
/**
 * Returns the maximum shape-size across all DataSets.
 * 
 * @return
 */
public float getGreatestShapeSize() {

    float max = 0f;

    for (IScatterDataSet set : mDataSets) {
        float size = set.getScatterShapeSize();

        if (size > max)
            max = size;
    }

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


示例17: initBuffers

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

    ScatterData scatterData = mChart.getScatterData();

    mScatterBuffers = new ScatterBuffer[scatterData.getDataSetCount()];

    for (int i = 0; i < mScatterBuffers.length; i++) {
        IScatterDataSet set = scatterData.getDataSetByIndex(i);
        mScatterBuffers[i] = new ScatterBuffer(set.getEntryCount() * 2);
    }
}
 
开发者ID:rahulmaddineni,项目名称:Stayfit,代码行数:13,代码来源:ScatterChartRenderer.java


示例18: renderShape

import com.github.mikephil.charting.interfaces.datasets.IScatterDataSet; //导入依赖的package包/类
@Override
public void renderShape(
        Canvas c, IScatterDataSet dataSet,
        ViewPortHandler mViewPortHandler, ScatterBuffer buffer, Paint mRenderPaint, final float shapeSize) {

    final float shapeHalf = shapeSize / 2f;

    mRenderPaint.setStyle(Paint.Style.STROKE);
    mRenderPaint.setStrokeWidth(Utils.convertDpToPixel(1f));

    for (int i = 0; i < buffer.size(); i += 2) {

        if (!mViewPortHandler.isInBoundsRight(buffer.buffer[i]))
            break;

        if (!mViewPortHandler.isInBoundsLeft(buffer.buffer[i])
                || !mViewPortHandler.isInBoundsY(buffer.buffer[i + 1]))
            continue;

        mRenderPaint.setColor(dataSet.getColor(i / 2));

        c.drawLine(
                buffer.buffer[i] - shapeHalf,
                buffer.buffer[i + 1] - shapeHalf,
                buffer.buffer[i] + shapeHalf,
                buffer.buffer[i + 1] + shapeHalf,
                mRenderPaint);
        c.drawLine(
                buffer.buffer[i] + shapeHalf,
                buffer.buffer[i + 1] - shapeHalf,
                buffer.buffer[i] - shapeHalf,
                buffer.buffer[i + 1] + shapeHalf,
                mRenderPaint);
    }

}
 
开发者ID:pencil-box,项目名称:NetKnight,代码行数:37,代码来源:XShapeRenderer.java


示例19: renderShape

import com.github.mikephil.charting.interfaces.datasets.IScatterDataSet; //导入依赖的package包/类
@Override
public void renderShape(
        Canvas c, IScatterDataSet dataSet,
        ViewPortHandler mViewPortHandler, ScatterBuffer buffer, Paint mRenderPaint, final float shapeSize) {

    final float shapeHalf = shapeSize / 2f;


    mRenderPaint.setStyle(Paint.Style.STROKE);
    mRenderPaint.setStrokeWidth(Utils.convertDpToPixel(1f));

    for (int i = 0; i < buffer.size(); i += 2) {

        if (!mViewPortHandler.isInBoundsRight(buffer.buffer[i]))
            break;

        if (!mViewPortHandler.isInBoundsLeft(buffer.buffer[i])
                || !mViewPortHandler.isInBoundsY(buffer.buffer[i + 1]))
            continue;

        mRenderPaint.setColor(dataSet.getColor(i / 2));

        c.drawLine(
                buffer.buffer[i] - shapeHalf,
                buffer.buffer[i + 1],
                buffer.buffer[i] + shapeHalf,
                buffer.buffer[i + 1],
                mRenderPaint);
        c.drawLine(
                buffer.buffer[i],
                buffer.buffer[i + 1] - shapeHalf,
                buffer.buffer[i],
                buffer.buffer[i + 1] + shapeHalf,
                mRenderPaint);
    }

}
 
开发者ID:pencil-box,项目名称:NetKnight,代码行数:38,代码来源:CrossShapeRenderer.java


示例20: renderShape

import com.github.mikephil.charting.interfaces.datasets.IScatterDataSet; //导入依赖的package包/类
@Override
public void renderShape(Canvas c, IScatterDataSet dataSet,
        ViewPortHandler mViewPortHandler, ScatterBuffer buffer, Paint mRenderPaint, final float shapeSize) {

    final float shapeHalf = shapeSize / 2f;

    mRenderPaint.setStyle(Paint.Style.STROKE);
    mRenderPaint.setStrokeWidth(Utils.convertDpToPixel(1f));

    for (int i = 0; i < buffer.size(); i += 2) {

        if (!mViewPortHandler.isInBoundsRight(buffer.buffer[i]))
            break;

        if (!mViewPortHandler.isInBoundsLeft(buffer.buffer[i])
                || !mViewPortHandler.isInBoundsY(buffer.buffer[i + 1]))
            continue;

        mRenderPaint.setColor(dataSet.getColor(i / 2));

        c.drawLine(
                buffer.buffer[i],
                buffer.buffer[i + 1] - (2 * shapeHalf),
                buffer.buffer[i] + (2 * shapeHalf),
                buffer.buffer[i + 1],
                mRenderPaint);

        c.drawLine(
                buffer.buffer[i],
                buffer.buffer[i + 1] - (2 * shapeHalf),
                buffer.buffer[i] - (2 * shapeHalf),
                buffer.buffer[i + 1],
                mRenderPaint);
    }

}
 
开发者ID:pencil-box,项目名称:NetKnight,代码行数:37,代码来源:ChevronUpShapeRenderer.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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