本文整理汇总了Java中lecho.lib.hellocharts.util.ChartUtils.pickColor方法的典型用法代码示例。如果您正苦于以下问题:Java ChartUtils.pickColor方法的具体用法?Java ChartUtils.pickColor怎么用?Java ChartUtils.pickColor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lecho.lib.hellocharts.util.ChartUtils
的用法示例。
在下文中一共展示了ChartUtils.pickColor方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: generateData
import lecho.lib.hellocharts.util.ChartUtils; //导入方法依赖的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);
}
示例2: generateData
import lecho.lib.hellocharts.util.ChartUtils; //导入方法依赖的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.util.ChartUtils; //导入方法依赖的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: onOptionsItemSelected
import lecho.lib.hellocharts.util.ChartUtils; //导入方法依赖的package包/类
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
if (id == R.id.action_reset) {
generateDefaultData();
chart.setColumnChartData(data);
previewChart.setColumnChartData(previewData);
previewX(true);
return true;
}
if (id == R.id.action_preview_both) {
previewXY();
previewChart.setZoomType(ZoomType.HORIZONTAL_AND_VERTICAL);
return true;
}
if (id == R.id.action_preview_horizontal) {
previewX(true);
return true;
}
if (id == R.id.action_preview_vertical) {
previewY();
return true;
}
if (id == R.id.action_change_color) {
int color = ChartUtils.pickColor();
while (color == previewChart.getPreviewColor()) {
color = ChartUtils.pickColor();
}
previewChart.setPreviewColor(color);
return true;
}
return super.onOptionsItemSelected(item);
}
示例5: onOptionsItemSelected
import lecho.lib.hellocharts.util.ChartUtils; //导入方法依赖的package包/类
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
if (id == R.id.action_reset) {
generateDefaultData();
chart.setLineChartData(data);
previewChart.setLineChartData(previewData);
previewX(true);
return true;
}
if (id == R.id.action_preview_both) {
previewXY();
previewChart.setZoomType(ZoomType.HORIZONTAL_AND_VERTICAL);
return true;
}
if (id == R.id.action_preview_horizontal) {
previewX(true);
return true;
}
if (id == R.id.action_preview_vertical) {
previewY();
return true;
}
if (id == R.id.action_change_color) {
int color = ChartUtils.pickColor();
while (color == previewChart.getPreviewColor()) {
color = ChartUtils.pickColor();
}
previewChart.setPreviewColor(color);
return true;
}
return super.onOptionsItemSelected(item);
}
示例6: setPieDatas
import lecho.lib.hellocharts.util.ChartUtils; //导入方法依赖的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); //设置控件
}
示例7: onCreateView
import lecho.lib.hellocharts.util.ChartUtils; //导入方法依赖的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;
}
示例8: generateData
import lecho.lib.hellocharts.util.ChartUtils; //导入方法依赖的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);
}