Java Code Examples for com.github.mikephil.charting.data.LineData#getDataSets()

The following examples show how to use com.github.mikephil.charting.data.LineData#getDataSets() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GraphsActivity.java    From your-local-weather with GNU General Public License v3.0 5 votes vote down vote up
private void toggleValuesForGraph(LineData lineData) {
    if (lineData == null) {
        return;
    }
    for (IDataSet set : lineData.getDataSets()) {
        set.setDrawValues(!set.isDrawValuesEnabled());
    }
}
 
Example 2
Source File: LineChartRenderer.java    From StockChart-MPAndroidChart with MIT License 5 votes vote down vote up
@Override
public void drawData(Canvas c) {

    int width = (int) mViewPortHandler.getChartWidth();
    int height = (int) mViewPortHandler.getChartHeight();

    Bitmap drawBitmap = mDrawBitmap == null ? null : mDrawBitmap.get();

    if (drawBitmap == null
            || (drawBitmap.getWidth() != width)
            || (drawBitmap.getHeight() != height)) {

        if (width > 0 && height > 0) {
            drawBitmap = Bitmap.createBitmap(width, height, mBitmapConfig);
            mDrawBitmap = new WeakReference<>(drawBitmap);
            mBitmapCanvas = new Canvas(drawBitmap);
        } else
            return;
    }

    drawBitmap.eraseColor(Color.TRANSPARENT);

    LineData lineData = mChart.getLineData();

    for (ILineDataSet set : lineData.getDataSets()) {

        if (set.isVisible()) {
            drawDataSet(c, set);
        }
    }

    c.drawBitmap(drawBitmap, 0, 0, mRenderPaint);
}
 
Example 3
Source File: LineChartRenderer.java    From Ticket-Analysis with MIT License 5 votes vote down vote up
@Override
public void drawData(Canvas c) {

    int width = (int) mViewPortHandler.getChartWidth();
    int height = (int) mViewPortHandler.getChartHeight();

    if (mDrawBitmap == null
            || (mDrawBitmap.get().getWidth() != width)
            || (mDrawBitmap.get().getHeight() != height)) {

        if (width > 0 && height > 0) {

            mDrawBitmap = new WeakReference<Bitmap>(Bitmap.createBitmap(width, height, mBitmapConfig));
            mBitmapCanvas = new Canvas(mDrawBitmap.get());
        } else
            return;
    }

    mDrawBitmap.get().eraseColor(Color.TRANSPARENT);

    LineData lineData = mChart.getLineData();

    for (ILineDataSet set : lineData.getDataSets()) {

        if (set.isVisible())
            drawDataSet(c, set);
    }

    c.drawBitmap(mDrawBitmap.get(), 0, 0, mRenderPaint);
}
 
Example 4
Source File: LineChartRenderer.java    From android-kline with Apache License 2.0 5 votes vote down vote up
@Override
public void drawData(Canvas c) {

    int width = (int) mViewPortHandler.getChartWidth();
    int height = (int) mViewPortHandler.getChartHeight();

    if (mDrawBitmap == null
            || (mDrawBitmap.get().getWidth() != width)
            || (mDrawBitmap.get().getHeight() != height)) {

        if (width > 0 && height > 0) {

            mDrawBitmap = new WeakReference<Bitmap>(Bitmap.createBitmap(width, height, mBitmapConfig));
            mBitmapCanvas = new Canvas(mDrawBitmap.get());
        } else
            return;
    }

    mDrawBitmap.get().eraseColor(Color.TRANSPARENT);

    LineData lineData = mChart.getLineData();

    for (ILineDataSet set : lineData.getDataSets()) {

        if (set.isVisible())
            drawDataSet(c, set);
    }

    c.drawBitmap(mDrawBitmap.get(), 0, 0, mRenderPaint);
}
 
Example 5
Source File: LineChartRenderer.java    From android-kline with Apache License 2.0 5 votes vote down vote up
@Override
public void drawData(Canvas c) {

    int width = (int) mViewPortHandler.getChartWidth();
    int height = (int) mViewPortHandler.getChartHeight();

    if (mDrawBitmap == null
            || (mDrawBitmap.get().getWidth() != width)
            || (mDrawBitmap.get().getHeight() != height)) {

        if (width > 0 && height > 0) {

            mDrawBitmap = new WeakReference<Bitmap>(Bitmap.createBitmap(width, height, mBitmapConfig));
            mBitmapCanvas = new Canvas(mDrawBitmap.get());
        } else
            return;
    }

    mDrawBitmap.get().eraseColor(Color.TRANSPARENT);

    LineData lineData = mChart.getLineData();

    for (ILineDataSet set : lineData.getDataSets()) {

        if (set.isVisible())
            drawDataSet(c, set);
    }

    c.drawBitmap(mDrawBitmap.get(), 0, 0, mRenderPaint);
}
 
Example 6
Source File: LineChartRenderer.java    From iMoney with Apache License 2.0 5 votes vote down vote up
@Override
public void drawData(Canvas c) {

    int width = (int) mViewPortHandler.getChartWidth();
    int height = (int) mViewPortHandler.getChartHeight();

    if (mDrawBitmap == null
            || (mDrawBitmap.getWidth() != width)
            || (mDrawBitmap.getHeight() != height)) {

        if (width > 0 && height > 0) {

            mDrawBitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_4444);
            mBitmapCanvas = new Canvas(mDrawBitmap);
        } else
            return;
    }

    mDrawBitmap.eraseColor(Color.TRANSPARENT);

    LineData lineData = mChart.getLineData();

    for (LineDataSet set : lineData.getDataSets()) {

        if (set.isVisible() && set.getEntryCount() > 0)
            drawDataSet(c, set);
    }

    c.drawBitmap(mDrawBitmap, 0, 0, mRenderPaint);
}
 
Example 7
Source File: LineChartRenderer.java    From Stayfit with Apache License 2.0 5 votes vote down vote up
@Override
public void drawData(Canvas c) {

    int width = (int) mViewPortHandler.getChartWidth();
    int height = (int) mViewPortHandler.getChartHeight();

    if (mDrawBitmap == null
            || (mDrawBitmap.get().getWidth() != width)
            || (mDrawBitmap.get().getHeight() != height)) {

        if (width > 0 && height > 0) {

            mDrawBitmap = new WeakReference<Bitmap>(Bitmap.createBitmap(width, height, mBitmapConfig));
            mBitmapCanvas = new Canvas(mDrawBitmap.get());
        } else
            return;
    }

    mDrawBitmap.get().eraseColor(Color.TRANSPARENT);

    LineData lineData = mChart.getLineData();

    for (ILineDataSet set : lineData.getDataSets()) {

        if (set.isVisible() && set.getEntryCount() > 0)
            drawDataSet(c, set);
    }

    c.drawBitmap(mDrawBitmap.get(), 0, 0, mRenderPaint);
}
 
Example 8
Source File: LineChartRenderer.java    From NetKnight with Apache License 2.0 5 votes vote down vote up
@Override
public void drawData(Canvas c) {

    int width = (int) mViewPortHandler.getChartWidth();
    int height = (int) mViewPortHandler.getChartHeight();

    if (mDrawBitmap == null
            || (mDrawBitmap.get().getWidth() != width)
            || (mDrawBitmap.get().getHeight() != height)) {

        if (width > 0 && height > 0) {

            mDrawBitmap = new WeakReference<Bitmap>(Bitmap.createBitmap(width, height, mBitmapConfig));
            mBitmapCanvas = new Canvas(mDrawBitmap.get());
        } else
            return;
    }

    mDrawBitmap.get().eraseColor(Color.TRANSPARENT);

    LineData lineData = mChart.getLineData();

    for (ILineDataSet set : lineData.getDataSets()) {

        if (set.isVisible() && set.getEntryCount() > 0)
            drawDataSet(c, set);
    }

    c.drawBitmap(mDrawBitmap.get(), 0, 0, mRenderPaint);
}