本文整理汇总了Java中com.github.mikephil.charting.charts.PieChart.setHoleRadius方法的典型用法代码示例。如果您正苦于以下问题:Java PieChart.setHoleRadius方法的具体用法?Java PieChart.setHoleRadius怎么用?Java PieChart.setHoleRadius使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.github.mikephil.charting.charts.PieChart
的用法示例。
在下文中一共展示了PieChart.setHoleRadius方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreateView
import com.github.mikephil.charting.charts.PieChart; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.frag_simple_pie, container, false);
mChart = (PieChart) v.findViewById(R.id.pieChart1);
mChart.setDescription("");
Typeface tf = Typeface.createFromAsset(getActivity().getAssets(), "OpenSans-Light.ttf");
mChart.setCenterTextTypeface(tf);
mChart.setCenterText(generateCenterText());
mChart.setCenterTextSize(10f);
mChart.setCenterTextTypeface(tf);
// radius of the center hole in percent of maximum radius
mChart.setHoleRadius(45f);
mChart.setTransparentCircleRadius(50f);
Legend l = mChart.getLegend();
l.setPosition(LegendPosition.RIGHT_OF_CHART);
mChart.setData(generatePieData());
return v;
}
示例2: setDefaultPieChartConfig
import com.github.mikephil.charting.charts.PieChart; //导入方法依赖的package包/类
public static PieChart setDefaultPieChartConfig(PieChart chart) {
chart.setDrawHoleEnabled(true);
chart.setHoleColor(Color.WHITE);
chart.setTransparentCircleColor(Color.WHITE);
chart.setTransparentCircleAlpha(110);
chart.setDragDecelerationFrictionCoef(0.95f);
chart.setHoleRadius(58f);
chart.setTransparentCircleRadius(61f);
chart.setDescription("");
chart.setUsePercentValues(true);
chart.setEntryLabelColor(Color.WHITE);
chart.setDrawCenterText(true);
chart.setCenterTextSize(18f);
chart.setCenterTextColor(ContextCompat.getColor(chart.getContext(), R.color.colorSecondaryText));
chart.setRotationAngle(0);
chart.setRotationEnabled(true);
chart.setHighlightPerTapEnabled(true);
chart.setMaxHighlightDistance(400f);
chart.setCenterTextTypeface(Typeface.createFromAsset(chart.getContext().getAssets(), "fonts/Lato-Regular.ttf"));
chart.setEntryLabelTypeface(Typeface.createFromAsset(chart.getContext().getAssets(), "fonts/Lato-Regular.ttf"));
chart.animateY(1400, Easing.EasingOption.EaseInOutQuad);
return chart;
}
示例3: initializeViews
import com.github.mikephil.charting.charts.PieChart; //导入方法依赖的package包/类
private void initializeViews() {
titleTextView = (TextView) findViewById(R.id.view_chart_pie_title);
titleTextView.setText(titleText);
titleTextView.setTextColor(titleTextColor);
titleTextView.setTextSize(TypedValue.COMPLEX_UNIT_PX, titleTextSize);
titleTextView.setTypeface(Typeface.create(titleTextTypeface, Typeface.NORMAL));
chart = (PieChart) findViewById(R.id.view_chart_pie);
chart.setDrawSliceText(false);
chart.setTouchEnabled(false);
chart.setHoleRadius(0);
chart.setTransparentCircleRadius(0);
chart.getLegend().setEnabled(false);
chart.setDescription("");
chart.setDrawCenterText(false);
rowContainer = (LinearLayout) findViewById(R.id.view_chart_pie_rows);
}
示例4: initializeViews
import com.github.mikephil.charting.charts.PieChart; //导入方法依赖的package包/类
private void initializeViews() {
titleTextView = (TextView) findViewById(R.id.view_chart_progress_title);
titleTextView.setText(titleText);
titleTextView.setTextColor(titleTextColor);
titleTextView.setTextSize(TypedValue.COMPLEX_UNIT_PX, titleTextSize);
titleTextView.setTypeface(Typeface.create(titleTextTypeface, Typeface.NORMAL));
finishView = (TextView) findViewById(R.id.view_chart_progress_finish);
finishView.setText(finishText);
finishView.setTextColor(finishTextColor);
tabLayout = (TabLayout) findViewById(R.id.view_chart_progress_tabs);
tabLayout.setSelectedTabIndicatorColor(tabIndicatorColor);
tabLayout.setTabTextColors(tabTextColor, tabSelectedTextColor);
chart = (PieChart) findViewById(R.id.view_chart_progress_chart);
chart.setDrawSliceText(false);
chart.setTouchEnabled(false);
chart.setHoleColor(Color.TRANSPARENT);
chart.setHoleRadius(95f);
chart.getLegend().setEnabled(false);
chart.setDescription("");
chart.setCenterTextColor(centerTextColor);
chart.setCenterTextSize(centerTextSize);
chart.setCenterTextTypeface(Typeface.create(centerTextTypeface, Typeface.NORMAL));
}
示例5: buildView
import com.github.mikephil.charting.charts.PieChart; //导入方法依赖的package包/类
@Override
public View buildView(Context context, ViewGroup viewGroup, FragmentManager fragmentManager) {
PieChart chart = new PieChart(context);
chart.setUsePercentValues(true);
chart.setDragDecelerationFrictionCoef(0.95f);
chart.setDrawHoleEnabled(true);
chart.setHoleColorTransparent(true);
chart.setTransparentCircleColor(Color.WHITE);
chart.setHoleRadius(58f);
chart.setTransparentCircleRadius(61f);
chart.setDrawCenterText(true);
chart.setRotationAngle(0);
chart.setRotationEnabled(true);
chart.animateY(1500, Easing.EasingOption.EaseInOutQuad);
return chart;
}
示例6: onCreateView
import com.github.mikephil.charting.charts.PieChart; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.frag_simple_pie, container, false);
mChart = (PieChart) v.findViewById(R.id.pieChart1);
mChart.getDescription().setEnabled(false);
Typeface tf = Typeface.createFromAsset(getActivity().getAssets(), "OpenSans-Light.ttf");
mChart.setCenterTextTypeface(tf);
mChart.setCenterText(generateCenterText());
mChart.setCenterTextSize(10f);
mChart.setCenterTextTypeface(tf);
// radius of the center hole in percent of maximum radius
mChart.setHoleRadius(45f);
mChart.setTransparentCircleRadius(50f);
Legend l = mChart.getLegend();
l.setVerticalAlignment(Legend.LegendVerticalAlignment.TOP);
l.setHorizontalAlignment(Legend.LegendHorizontalAlignment.RIGHT);
l.setOrientation(Legend.LegendOrientation.VERTICAL);
l.setDrawInside(false);
mChart.setData(generatePieData());
return v;
}
示例7: onCreate
import com.github.mikephil.charting.charts.PieChart; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_piechart);
tvX = (TextView) findViewById(R.id.tvXMax);
tvY = (TextView) findViewById(R.id.tvYMax);
mSeekBarX = (SeekBar) findViewById(R.id.seekBar1);
mSeekBarY = (SeekBar) findViewById(R.id.seekBar2);
mSeekBarX.setProgress(4);
mSeekBarY.setProgress(10);
mChart = (PieChart) findViewById(R.id.chart1);
mChart.setUsePercentValues(true);
mChart.getDescription().setEnabled(false);
mChart.setExtraOffsets(5, 10, 5, 5);
mChart.setDragDecelerationFrictionCoef(0.95f);
mChart.setCenterTextTypeface(mTfLight);
mChart.setCenterText(generateCenterSpannableText());
mChart.setDrawHoleEnabled(true);
mChart.setHoleColor(Color.WHITE);
mChart.setTransparentCircleColor(Color.WHITE);
mChart.setTransparentCircleAlpha(110);
mChart.setHoleRadius(58f);
mChart.setTransparentCircleRadius(61f);
mChart.setDrawCenterText(true);
mChart.setRotationAngle(0);
// enable rotation of the chart by touch
mChart.setRotationEnabled(true);
mChart.setHighlightPerTapEnabled(true);
// mChart.setUnit(" €");
// mChart.setDrawUnitsInChart(true);
// add a selection listener
mChart.setOnChartValueSelectedListener(this);
setData(4, 100);
mChart.animateY(1400, Easing.EasingOption.EaseInOutQuad);
// mChart.spin(2000, 0, 360);
mSeekBarX.setOnSeekBarChangeListener(this);
mSeekBarY.setOnSeekBarChangeListener(this);
Legend l = mChart.getLegend();
l.setVerticalAlignment(Legend.LegendVerticalAlignment.TOP);
l.setHorizontalAlignment(Legend.LegendHorizontalAlignment.RIGHT);
l.setOrientation(Legend.LegendOrientation.VERTICAL);
l.setDrawInside(false);
l.setXEntrySpace(7f);
l.setYEntrySpace(0f);
l.setYOffset(0f);
// entry label styling
mChart.setEntryLabelColor(Color.WHITE);
mChart.setEntryLabelTypeface(mTfRegular);
mChart.setEntryLabelTextSize(12f);
}
示例8: configChart
import com.github.mikephil.charting.charts.PieChart; //导入方法依赖的package包/类
private void configChart(Station station, PieChart mChart) {
mChart.setDescription("");
mChart.setExtraOffsets(5, 10, 5, 5);
mChart.setDragDecelerationFrictionCoef(0.95f);
mChart.setCenterText(getString(R.string.base_state));
mChart.setDrawHoleEnabled(true);
mChart.setHoleColorTransparent(true);
mChart.setUsePercentValues(false);
mChart.setTransparentCircleColor(Color.WHITE);
mChart.setTransparentCircleAlpha(110);
mChart.setHoleRadius(58f);
mChart.setTransparentCircleRadius(61f);
mChart.setDrawCenterText(true);
mChart.setTouchEnabled(false);
mChart.setRotationEnabled(false);
mChart.setRotationAngle(0);
setData(mChart, station);
mChart.animateY(1400, Easing.EasingOption.EaseInOutQuad);
// mChart.spin(2000, 0, 360);
Legend l = mChart.getLegend();
l.setEnabled(false);
l.setPosition(Legend.LegendPosition.RIGHT_OF_CHART);
l.setXEntrySpace(7f);
l.setYEntrySpace(0f);
l.setYOffset(0f);
}
示例9: setPieChart
import com.github.mikephil.charting.charts.PieChart; //导入方法依赖的package包/类
/**
* Set the pie pattern
* @param pieChart chart
* @param chartData pie chart data
* @param title chart title
* @param tf Typeface font
*/
public static void setPieChart(PieChart pieChart, ChartData<?> chartData,
SpannableString title, Typeface tf) {
chartData.setValueFormatter(new PercentFormatter());
chartData.setValueTextSize(11f);
chartData.setValueTextColor(Color.BLACK);
chartData.setValueTypeface(tf);
pieChart.setUsePercentValues(true);
pieChart.getDescription().setEnabled(false);
pieChart.setExtraOffsets(5, 10, 5, 5);
pieChart.setDragDecelerationFrictionCoef(0.95f);
pieChart.setCenterTextTypeface(tf);
pieChart.setCenterText(title);
pieChart.setExtraOffsets(20.f, 0.f, 20.f, 0.f);
pieChart.setDrawHoleEnabled(true);
pieChart.setHoleColor(Color.WHITE);
pieChart.setTransparentCircleColor(Color.WHITE);
pieChart.setTransparentCircleAlpha(110);
pieChart.setHoleRadius(58f);
pieChart.setTransparentCircleRadius(61f);
pieChart.setDrawCenterText(true);
pieChart.setRotationAngle(0);
pieChart.setRotationEnabled(true);// enable rotation of the chart by touch
pieChart.setHighlightPerTapEnabled(true);
pieChart.setEntryLabelTextSize(10f);
Legend l = pieChart.getLegend();
l.setVerticalAlignment(Legend.LegendVerticalAlignment.TOP);
l.setHorizontalAlignment(Legend.LegendHorizontalAlignment.RIGHT);
l.setOrientation(Legend.LegendOrientation.VERTICAL);
l.setDrawInside(false);
l.setEnabled(false);
pieChart.setData((PieData) chartData);
pieChart.animateY(DURATION_MEDIUM, Easing.EasingOption.EaseInOutQuad);
pieChart.highlightValues(null);// undo all highlights
pieChart.invalidate();
}
示例10: setChartOptions
import com.github.mikephil.charting.charts.PieChart; //导入方法依赖的package包/类
private void setChartOptions(PieChart chart) {
Paint p = chart.getPaint(PieChart.PAINT_INFO);
p.setTextSize(32);
p.setColor(0xFF444444);
chart.setNoDataText("Dados indisponíveis.");
chart.setUsePercentValues(true);
chart.setHoleColor(Color.TRANSPARENT);
chart.setHoleRadius(40f);
chart.setTransparentCircleRadius(40f);
chart.setDrawCenterText(true);
chart.setDescription("");
chart.setRotationAngle(0);
chart.setRotationEnabled(true);
chart.getLegend().setEnabled(false);
}
示例11: seteffect
import com.github.mikephil.charting.charts.PieChart; //导入方法依赖的package包/类
private void seteffect(PieChart colorPie) {
colorPie.animateXY(2000, 2000, Easing.EasingOption.EaseInBounce, Easing.EasingOption.EaseInBounce);
colorPie.invalidate();
colorPie.setDrawHoleEnabled(true);
colorPie.setExtraOffsets(10, 10, 10, 10);
colorPie.setContentDescription("");
colorPie.setDragDecelerationFrictionCoef(0.95f);
colorPie.setDrawCenterText(true);
colorPie.setRotationAngle(0);
// enable rotation of the chart by touch
colorPie.setRotationEnabled(true);
colorPie.setHighlightPerTapEnabled(true);
colorPie.setDrawHoleEnabled(true);
colorPie.setHoleColor(Color.WHITE);
//disable the label and description
colorPie.getDescription().setEnabled(false);
colorPie.getLegend().setEnabled(false);
colorPie.setTransparentCircleColor(Color.WHITE);
colorPie.setTransparentCircleAlpha(80);
colorPie.setElevation(10f);
colorPie.setHoleRadius(60f);
colorPie.setTransparentCircleRadius(61f);
// add a selection listener
colorPie.setOnChartValueSelectedListener(this);
}
示例12: setEffectPieChart
import com.github.mikephil.charting.charts.PieChart; //导入方法依赖的package包/类
private void setEffectPieChart(PieChart colorPie) {
colorPie.animateXY(1500, 1500, Easing.EasingOption.EaseInBounce, Easing.EasingOption.EaseInBounce);
colorPie.invalidate();
colorPie.setDrawHoleEnabled(true);
colorPie.setExtraOffsets(10, 10, 10, 10);
colorPie.setContentDescription("");
colorPie.setDragDecelerationFrictionCoef(0.95f);
colorPie.setDrawCenterText(true);
colorPie.setRotationAngle(0);
// enable rotation of the chart by touch
colorPie.setRotationEnabled(true);
colorPie.setHighlightPerTapEnabled(true);
colorPie.setDrawHoleEnabled(true);
colorPie.setHoleColor(Color.WHITE);
colorPie.getLegend().setFormSize(10f);
colorPie.getLegend().setFormToTextSpace(5f);
//disable the label and description
colorPie.getDescription().setEnabled(false);
colorPie.getLegend().setEnabled(false);
colorPie.setTransparentCircleColor(Color.WHITE);
colorPie.setTransparentCircleAlpha(80);
colorPie.setElevation(10f);
colorPie.setHoleRadius(90f);
colorPie.setTransparentCircleRadius(61f);
// add a selection listener
colorPie.setOnChartValueSelectedListener(this);
}
示例13: preparePieChart
import com.github.mikephil.charting.charts.PieChart; //导入方法依赖的package包/类
public PieChart preparePieChart(PieChart pieChart) {
pieChart.setUsePercentValues(true);
pieChart.getDescription().setEnabled(false);
pieChart.setExtraOffsets(5, 10, 5, 5);
pieChart.setDragDecelerationFrictionCoef(0.96f);
pieChart.setDrawHoleEnabled(true);
pieChart.setHoleColor(android.R.color.transparent);
pieChart.setTransparentCircleColor(utilsUI.getColor(android.R.color.white));
pieChart.setTransparentCircleAlpha(50);
pieChart.setHoleRadius(40f);
pieChart.setTransparentCircleRadius(45f);
pieChart.setDrawCenterText(true);
pieChart.setCenterText("Balance");
pieChart.setRotationAngle(0);
// enable rotation of the chart by touch
pieChart.setRotationEnabled(false);
pieChart.setHighlightPerTapEnabled(true);
pieChart.setDrawEntryLabels(true);
pieChart.setEntryLabelColor(utilsUI.getColor(android.R.color.white));
pieChart.setEntryLabelTextSize(15f);
Legend l = pieChart.getLegend();
l.setVerticalAlignment(Legend.LegendVerticalAlignment.BOTTOM);
l.setHorizontalAlignment(Legend.LegendHorizontalAlignment.CENTER);
l.setOrientation(Legend.LegendOrientation.HORIZONTAL);
l.setDrawInside(false);
return pieChart;
}
示例14: getFormattedPieChart
import com.github.mikephil.charting.charts.PieChart; //导入方法依赖的package包/类
/**
* Formats a pie chart in a standardized way
* @param c Context
* @param p Pie chart
* @param shouldShowLegend
* @return the PieChart, whose data must be set and invalidated
*/
public static PieChart getFormattedPieChart(Context c, PieChart p, boolean shouldShowLegend) {
Legend cLegend = p.getLegend();
if (shouldShowLegend) {
cLegend.setEnabled(true);
cLegend.setHorizontalAlignment(Legend.LegendHorizontalAlignment.CENTER);
cLegend.setVerticalAlignment(Legend.LegendVerticalAlignment.BOTTOM);
cLegend.setOrientation(Legend.LegendOrientation.HORIZONTAL);
cLegend.setDrawInside(false);
cLegend.setForm(Legend.LegendForm.CIRCLE);
cLegend.setTextSize(15);
cLegend.setWordWrapEnabled(true);
} else {
cLegend.setEnabled(false);
}
p.setDrawEntryLabels(false);
p.setDescription(EMPTY_CHART_DESCRIPTION);
p.setHoleRadius(60f);
p.setTransparentCircleRadius(65f);
p.setCenterTextSize(20);
if (SettingsActivity.getTheme(c) == SettingsActivity.THEME_NOIR) {
int colorPrimaryNoir = ContextCompat.getColor(c, R.color.colorPrimaryNoir);
int colorPrimaryTextNoir = ContextCompat.getColor(c, R.color.colorPrimaryTextNoir);
p.setHoleColor(colorPrimaryNoir);
p.setTransparentCircleColor(colorPrimaryNoir);
p.setCenterTextColor(colorPrimaryTextNoir);
cLegend.setTextColor(colorPrimaryTextNoir);
}
p.setRotationEnabled(false);
p.setOnChartValueSelectedListener(new PieChartListener(p));
return p;
}
示例15: onCreateView
import com.github.mikephil.charting.charts.PieChart; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
//return buildChart();
mLayout = (LinearLayout) inflater.inflate(R.layout.chart_pie_fragment, container, false);
mChart = (PieChart) mLayout.findViewById(R.id.chartPie);
mChart.setUsePercentValues(true);
// change the color of the center-hole
mChart.setHoleColor(Color.TRANSPARENT);
mChart.setHoleRadius(30f);
mChart.setDescription("");
mChart.setDrawCenterText(true);
mChart.setDrawHoleEnabled(true);
mChart.setRotationAngle(0);
// enable rotation of the chart by touch
mChart.setRotationEnabled(true);
// mChart.setUnit(" €");
// mChart.setDrawUnitsInChart(true);
// add a selection listener
mChart.setOnChartValueSelectedListener(this);
// mChart.setTouchEnabled(false);
//mChart.setCenterText("MPAndroidChart\nLibrary");
mChart.animateXY(1500, 1500);
return mLayout;
}