本文整理汇总了Java中lecho.lib.hellocharts.model.PieChartData.setHasLabelsOnlyForSelected方法的典型用法代码示例。如果您正苦于以下问题:Java PieChartData.setHasLabelsOnlyForSelected方法的具体用法?Java PieChartData.setHasLabelsOnlyForSelected怎么用?Java PieChartData.setHasLabelsOnlyForSelected使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lecho.lib.hellocharts.model.PieChartData
的用法示例。
在下文中一共展示了PieChartData.setHasLabelsOnlyForSelected方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initMealsPie
import lecho.lib.hellocharts.model.PieChartData; //导入方法依赖的package包/类
public static void initMealsPie(PieChartView pieChartView, TodayDiets todayDiets) {
List<SliceValue> values = new ArrayList();
if (todayDiets.breakfast != null && todayDiets.breakfast.percentage > 0.0f) {
values.add(new SliceValue(todayDiets.breakfast.percentage, MEALS_COLORS[0]).setLabel(
((int) (todayDiets.breakfast.percentage * 100.0f)) + "%早餐"));
}
if (todayDiets.lunch != null && todayDiets.lunch.percentage > 0.0f) {
values.add(new SliceValue(todayDiets.lunch.percentage, MEALS_COLORS[1]).setLabel((
(int) (todayDiets.lunch.percentage * 100.0f)) + "%午餐"));
}
if (todayDiets.dinner != null && todayDiets.dinner.percentage > 0.0f) {
values.add(new SliceValue(todayDiets.dinner.percentage, MEALS_COLORS[2]).setLabel((
(int) (todayDiets.dinner.percentage * 100.0f)) + "%晚餐"));
}
PieChartData data = new PieChartData(values);
data.setHasLabels(true);
data.setHasLabelsOnlyForSelected(false);
data.setHasLabelsOutside(false);
data.setHasCenterCircle(false);
data.setSlicesSpacing(3);
data.setValueLabelBackgroundColor(0);
data.setValueLabelBackgroundEnabled(true);
pieChartView.setValueSelectionEnabled(true);
pieChartView.setPieChartData(data);
pieChartView.startDataAnimation();
}
示例2: generateData
import lecho.lib.hellocharts.model.PieChartData; //导入方法依赖的package包/类
private void generateData() {
List<SliceValue> values = new ArrayList<SliceValue>();
String s1 = String.format("%.2f", ((double) yes / all) * 100);
SliceValue sliceValue1 = new SliceValue(yes, ChartUtils.pickColor());
sliceValue1.setLabel("已报到" + s1 + "%");
values.add(sliceValue1);
String s2 = String.format("%.2f", ((double) no / all) * 100);
SliceValue sliceValue2 = new SliceValue(no, ChartUtils.pickColor());
sliceValue2.setLabel("未报到" + s2 + "%");
values.add(sliceValue2);
data = new PieChartData(values);
data.setHasLabels(true);
data.setHasLabelsOnlyForSelected(false);
data.setHasLabelsOutside(false);
chart.setValueSelectionEnabled(true);
chart.setCircleFillRatio(1.0f);
chart.setPieChartData(data);
}
示例3: generateData
import lecho.lib.hellocharts.model.PieChartData; //导入方法依赖的package包/类
private void generateData() {
List<SliceValue> values = new ArrayList<SliceValue>();
String s1 = String.format("%.2f", ((double) yes / all) * 100);
SliceValue sliceValue1 = new SliceValue(yes, ChartUtils.pickColor());
sliceValue1.setLabel("已报到" + s1 + "%");
values.add(sliceValue1);
String s2 = String.format("%.2f", ((double) no / all) * 100);
SliceValue sliceValue2 = new SliceValue(no, ChartUtils.pickColor());
sliceValue2.setLabel("未报到" + s2 + "%");
values.add(sliceValue2);
data = new PieChartData(values);
data.setHasLabels(true);
data.setHasLabelsOnlyForSelected(false);
data.setHasLabelsOutside(false);
chart.setValueSelectionEnabled(true);
chart.setCircleFillRatio(1.0f);
chart.setPieChartData(data);
}
示例4: generateData
import lecho.lib.hellocharts.model.PieChartData; //导入方法依赖的package包/类
private void generateData() {
List<SliceValue> values = new ArrayList<SliceValue>();
String s1 = String.format("%.2f", ((double) yes / all) * 100);
SliceValue sliceValue1 = new SliceValue(yes, ChartUtils.pickColor());
sliceValue1.setLabel("已报到"+s1+"%");
values.add(sliceValue1);
String s2 = String.format("%.2f", ((double) no / all) * 100);
SliceValue sliceValue2 = new SliceValue(no, ChartUtils.pickColor());
sliceValue2.setLabel("未报到"+s2+"%");
values.add(sliceValue2);
data = new PieChartData(values);
data.setHasLabels(true);
data.setHasLabelsOnlyForSelected(false);
data.setHasLabelsOutside(false);
chart.setValueSelectionEnabled(true);
chart.setCircleFillRatio(1.0f);
chart.setPieChartData(data);
}
示例5: setPieDatas
import lecho.lib.hellocharts.model.PieChartData; //导入方法依赖的package包/类
private void setPieDatas() {
int numValues = 6; //把一张饼切成6块
/*===== 随机设置每块的颜色和数据 =====*/
List<SliceValue> values = new ArrayList<>();
for (int i = 0; i < numValues; ++i) {
SliceValue sliceValue = new SliceValue((float) Math.random() * 30 + 15, ChartUtils.pickColor());
values.add(sliceValue);
}
/*===== 设置相关属性 类似Line Chart =====*/
mPieChartData = new PieChartData(values);
mPieChartData.setHasLabels(isHasLabelsInside);
mPieChartData.setHasLabelsOnlyForSelected(isPiesHasSelected);
mPieChartData.setHasLabelsOutside(isHasLabelsOutside);
mPieChartData.setHasCenterCircle(isHasCenterCircle);
//是否分离
if (isExploded) {
mPieChartData.setSlicesSpacing(18); //分离间距为18
}
//是否显示单行文本
if (isHasCenterSingleText) {
mPieChartData.setCenterText1("病虫害"); //文本内容
}
//标签显示样式
mPieChartView.setCircleFillRatio(1.0f);
//是否显示双行文本
if (isHasCenterDoubleText) {
mPieChartData.setCenterText2("种类比例"); //文本内容
mPieChartData.setCenterText2FontSize(ChartUtils.px2sp(getResources().getDisplayMetrics().scaledDensity,
(int) getResources().getDimension(R.dimen.pie_chart_double_text_size)));
}
mPieChartView.setPieChartData(mPieChartData); //设置控件
}
示例6: onCreateView
import lecho.lib.hellocharts.model.PieChartData; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
List<SliceValue> list = new ArrayList<SliceValue>();
// incomePieChart = (PieChartView) findViewById(R.id.income_chart);
incomePieChart.setOnValueTouchListener(new ValueTouchListener());
MyDBHelper myDBHelper = MyDBHelper.newInstance(null);
SQLiteDatabase db = myDBHelper.getWritableDatabase();
/*Cursor cursor = db.rawQuery("Select " + DBTablesDefinition.Records.TABLE_RECORDS_NAME + "." + DBTablesDefinition.Records.ID + "," +
DBTablesDefinition.Accounts.TABLE_ACCOUNT_NAME + "." + DBTablesDefinition.Accounts.COLUMN_ACCOUNT_NAME + "," + DBTablesDefinition.Records.TABLE_RECORDS_NAME + "." + DBTablesDefinition.Records.COLUMN_RECORDS_DATE
+ "," + DBTablesDefinition.Records.TABLE_RECORDS_NAME + "." + DBTablesDefinition.Records.COLUMN_RECORDS_AMOUNT + " from " + DBTablesDefinition.Records.TABLE_RECORDS_NAME + " left join " +
DBTablesDefinition.Accounts.TABLE_ACCOUNT_NAME + " on " + DBTablesDefinition.Records.TABLE_RECORDS_NAME + "." + DBTablesDefinition.Records.COLUMN_RECORDS_ACCOUNT_NAME_ID
+ " = " + DBTablesDefinition.Accounts.TABLE_ACCOUNT_NAME + "." + DBTablesDefinition.Accounts.ID + " where " + DBTablesDefinition.Records.TABLE_RECORDS_NAME + "." + DBTablesDefinition.Records.COLUMN_RECORDS_FLAG_OF_INCOME_OR_EXPENSE
+ " = " + DBTablesDefinition.INCOME, null);
*/
Cursor cursor = db.rawQuery("select records.id,accounts.name,records.date,SUM(records.amount),incomeOrExpenses.name from records,accounts,incomeOrExpenses where records.accountNameId=accounts.id and records.incomeOrExpense=incomeOrExpenses.id and incomeOrExpenses.flag=0 group by accounts.name", null);
// System.out.println("Cursor count is " + cursor.getCount());
while (cursor.moveToNext()) {
// System.out.println(cursor.getInt(0) + " " + cursor.getString(1) + " " + cursor.getString(2) + " " + cursor.getDouble(3) + " " + cursor.getString(4));
SliceValue sliceValue = new SliceValue((float) cursor.getDouble(3), ChartUtils.pickColor());
list.add(sliceValue);
}
incomePiedata = new PieChartData(list);
incomePiedata.setHasLabels(hasLabels);
incomePiedata.setHasLabelsOnlyForSelected(hasLabelForSelected);
incomePiedata.setHasLabelsOutside(hasLabelsOutside);
incomePiedata.setHasCenterCircle(hasCenterCircle);
incomePieChart.setPieChartData(incomePiedata);
return null;
}
示例7: generateData
import lecho.lib.hellocharts.model.PieChartData; //导入方法依赖的package包/类
private void generateData() {
List<SliceValue> values = new ArrayList<SliceValue>();
if (yes != 0) {
SliceValue sliceValue1 = new SliceValue(yes, ChartUtils.pickColor());
sliceValue1.setLabel(this.pay + yes + "人");
values.add(sliceValue1);
}
if (no != 0) {
SliceValue sliceValue2 = new SliceValue(no, ChartUtils.pickColor());
sliceValue2.setLabel(this.notPay+ no + "人");
values.add(sliceValue2);
}
if (loanPay != 0) {
SliceValue sliceValue3 = new SliceValue(loanPay, ChartUtils.pickColor());
sliceValue3.setLabel(this.loanPay1 + loanPay + "人");
values.add(sliceValue3);
}
if (latePay != 0) {
SliceValue sliceValue4 = new SliceValue(latePay, ChartUtils.pickColor());
sliceValue4.setLabel(this.latePay1 + latePay + "人");
values.add(sliceValue4);
}
data = new PieChartData(values);
data.setHasLabels(true);
data.setHasLabelsOnlyForSelected(false);
data.setHasLabelsOutside(false);
chart.setValueSelectionEnabled(true);
chart.setCircleFillRatio(1.0f);
chart.setPieChartData(data);
}
示例8: initPieChartDataSet
import lecho.lib.hellocharts.model.PieChartData; //导入方法依赖的package包/类
private void initPieChartDataSet(PieChartData dataSet) {
initBaseChartDataSet(dataSet);
dataSet.setCenterText1Color(mTextColorPrimary);
dataSet.setCenterText1FontSize(mTextSizePrimary);
dataSet.setCenterText2Color(mTextColorSecondary);
dataSet.setCenterText2FontSize(mTextSizeSecondary);
dataSet.setHasCenterCircle(true);
dataSet.setHasLabels(true);
dataSet.setHasLabelsOnlyForSelected(false);
}
示例9: initData
import lecho.lib.hellocharts.model.PieChartData; //导入方法依赖的package包/类
private void initData() {
List<Subject> subjects = student.getActualSubjects();
//TODO: use enum values instead of static variables
float approvedCount = 0f;
float repprovedCount = 0f;
float waitingCount = 0f;
float totalCount;
for (Subject subject : subjects) {
SubjectStatus actualSubjectStatus = subject.getActualSubjectStatus();
if (actualSubjectStatus == null) continue;
switch (actualSubjectStatus.getFlowSituation()) {
case APPROVED:
approvedCount++;
break;
case REPROVED:
repprovedCount++;
break;
case WAITING:
case WAITING_FINAL:
waitingCount++;
break;
}
}
totalCount = approvedCount + repprovedCount + waitingCount;
PieChartView pieChartView = (PieChartView) findViewById(R.id.graph);
pieChartView.setValueSelectionEnabled(true);
List<SliceValue> sliceValues = new ArrayList<>();
float approvedPercentage = (approvedCount / totalCount) * 100f;
int approvedColor = getResources().getColor(android.R.color.holo_green_light);
SliceValue approvedSliceValue = new SliceValue();
approvedSliceValue.setColor(approvedColor);
approvedSliceValue.setValue(approvedPercentage);
approvedSliceValue.setLabel(getLabelForValue(approvedPercentage));
sliceValues.add(approvedSliceValue);
float repprovedPercentage = (repprovedCount / totalCount) * 100f;
int repprovedColor = getResources().getColor(android.R.color.holo_red_light);
SliceValue repprovedSliceValue = new SliceValue();
repprovedSliceValue.setColor(repprovedColor);
repprovedSliceValue.setValue(repprovedPercentage);
repprovedSliceValue.setLabel(getLabelForValue(repprovedPercentage));
sliceValues.add(repprovedSliceValue);
float waitingPercentage = (waitingCount / totalCount) * 100f;
int waitingColor = getResources().getColor(R.color.unicap_gray_level_2);
SliceValue waitingSliceValue = new SliceValue();
waitingSliceValue.setColor(waitingColor);
waitingSliceValue.setValue(waitingPercentage);
waitingSliceValue.setLabel(getLabelForValue(waitingPercentage));
sliceValues.add(waitingSliceValue);
PieChartData data = new PieChartData(sliceValues);
data.setHasLabelsOnlyForSelected(true);
data.setHasCenterCircle(true);
data.setCenterCircleScale(0.3f);
pieChartView.setPieChartData(data);
}