Java Code Examples for com.github.mikephil.charting.interfaces.datasets.IBarDataSet#setDrawValues()

The following examples show how to use com.github.mikephil.charting.interfaces.datasets.IBarDataSet#setDrawValues() . 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: BarChartActivitySinus.java    From Stayfit with Apache License 2.0 4 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {

    switch (item.getItemId()) {
        case R.id.actionToggleValues: {
            for (IBarDataSet set : mChart.getData().getDataSets())
                set.setDrawValues(!set.isDrawValuesEnabled());

            mChart.invalidate();
            break;
        }
        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.actionToggleHighlightArrow: {
            if (mChart.isDrawHighlightArrowEnabled())
                mChart.setDrawHighlightArrow(false);
            else
                mChart.setDrawHighlightArrow(true);
            mChart.invalidate();
            break;
        }
        case R.id.animateX: {
            mChart.animateX(1500);
            break;
        }
        case R.id.animateY: {
            mChart.animateY(1500);
            break;
        }
        case R.id.animateXY: {

            mChart.animateXY(2000, 2000);
            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;
}
 
Example 2
Source File: BarChartActivityMultiDataset.java    From Stayfit with Apache License 2.0 4 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {

    switch (item.getItemId()) {
        case R.id.actionToggleValues: {
            for (IBarDataSet set : mChart.getData().getDataSets())
                set.setDrawValues(!set.isDrawValuesEnabled());

            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.actionToggleHighlight: {
            if(mChart.getData() != null) {
                mChart.getData().setHighlightEnabled(!mChart.getData().isHighlightEnabled());
                mChart.invalidate();
            }
            break;
        }
        case R.id.actionToggleHighlightArrow: {
            if (mChart.isDrawHighlightArrowEnabled())
                mChart.setDrawHighlightArrow(false);
            else
                mChart.setDrawHighlightArrow(true);
            mChart.invalidate();
            break;
        }
        case R.id.actionSave: {
            // mChart.saveToGallery("title"+System.currentTimeMillis());
            mChart.saveToPath("title" + System.currentTimeMillis(), "");
            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;
        }
    }
    return true;
}
 
Example 3
Source File: HorizontalBarChartActivity.java    From Stayfit with Apache License 2.0 4 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {

    switch (item.getItemId()) {
        case R.id.actionToggleValues: {
            List<IBarDataSet> sets = mChart.getData()
                    .getDataSets();

            for (IBarDataSet iSet : sets) {

                IBarDataSet set = (BarDataSet) iSet;
                set.setDrawValues(!set.isDrawValuesEnabled());
            }

            mChart.invalidate();
            break;
        }
        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.actionToggleHighlightArrow: {
            if (mChart.isDrawHighlightArrowEnabled())
                mChart.setDrawHighlightArrow(false);
            else
                mChart.setDrawHighlightArrow(true);
            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;
}