本文整理汇总了Java中com.github.mikephil.charting.data.BarData.setValueTextSize方法的典型用法代码示例。如果您正苦于以下问题:Java BarData.setValueTextSize方法的具体用法?Java BarData.setValueTextSize怎么用?Java BarData.setValueTextSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.github.mikephil.charting.data.BarData
的用法示例。
在下文中一共展示了BarData.setValueTextSize方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setData
import com.github.mikephil.charting.data.BarData; //导入方法依赖的package包/类
private void setData(int count, float range) {
ArrayList<BarEntry> yVals1 = new ArrayList<BarEntry>();
ArrayList<String> xVals = new ArrayList<String>();
for (int i = 0; i < count; i++) {
xVals.add(mMonths[i % 12]);
yVals1.add(new BarEntry((float) (Math.random() * range), i));
}
BarDataSet set1 = new BarDataSet(yVals1, "DataSet 1");
ArrayList<IBarDataSet> dataSets = new ArrayList<IBarDataSet>();
dataSets.add(set1);
BarData data = new BarData(xVals, dataSets);
data.setValueTextSize(10f);
data.setValueTypeface(tf);
mChart.setData(data);
}
示例2: setData
import com.github.mikephil.charting.data.BarData; //导入方法依赖的package包/类
private static void setData(Chart barChart, List<Pair<String, Integer>> chartData, String title, Context context) {
ArrayList<BarEntry> yVals = new ArrayList<>();
int count = chartData.size() > 10 ? 10 : chartData.size();
for (int i = 0; i < count; i++) { //10 top states
yVals.add(new BarEntry(i,chartData.get(i).second));
}
BarDataSet barDataSet = new BarDataSet(yVals, title);
int[] colors = new int[]{context.getResources().getColor(R.color.colorChart1),
context.getResources().getColor(R.color.colorChart2),
context.getResources().getColor(R.color.colorChart3),
context.getResources().getColor(R.color.colorChart4),
context.getResources().getColor(R.color.colorChart5)};
barDataSet.setColors(colors);
BarData data = new BarData(barDataSet);
data.setValueTextSize(12f);
barChart.setData(data);
}
示例3: setData
import com.github.mikephil.charting.data.BarData; //导入方法依赖的package包/类
private void setData(List<Integer> valueList, String format) {
mChart.setVisibility(View.VISIBLE);
ArrayList<String> xVals = new ArrayList<String>();
ArrayList<BarEntry> yVals1 = new ArrayList<BarEntry>();
for (int i = 0; i < valueList.size(); i++) {
xVals.add(i + "s");
yVals1.add(new BarEntry(valueList.get(i), i));
}
String legend = "reception rate per second";
if (!format.equals("%"))
legend = "packet count per second";
BarDataSet set1 = new BarDataSet(yVals1, legend);
set1.setBarSpacePercent(35f);
set1.setColor(Color.parseColor("#0288D1"));
ArrayList<IBarDataSet> dataSets = new ArrayList<IBarDataSet>();
dataSets.add(set1);
BarData data = new BarData(xVals, dataSets);
data.setValueTextSize(10f);
data.setDrawValues(false);
YAxisValueFormatter custom = new DataAxisFormatter(format);
YAxis leftAxis = mChart.getAxisLeft();
YAxis rightAxis = mChart.getAxisRight();
leftAxis.setValueFormatter(custom);
rightAxis.setValueFormatter(custom);
mChart.setData(data);
}
示例4: createBarChartData
import com.github.mikephil.charting.data.BarData; //导入方法依赖的package包/类
public BarData createBarChartData()
{
NumberFormat numberFormat = NumberFormat.getInstance();
numberFormat.setMinimumFractionDigits(0);
numberFormat.setMaximumFractionDigits(2);
mDashboardHelper = new DashboardHelper(getActivity());
HashMap<String, ArrayList> holder = mDashboardHelper.generateTimesPerDayMap();
ArrayList<String> xVals = holder.get("dayOfThisMonth");
ArrayList<BarEntry> yVals1 = holder.get("episodesPerDay");
BarDataSet set1 = new BarDataSet(yVals1, "DataSet");
set1.setColor(0xFF2196f3);
set1.setBarSpacePercent(40f);
ArrayList<IBarDataSet> dataSets = new ArrayList<>();
dataSets.add(set1);
BarData data = new BarData(xVals, dataSets);
data.setValueTextSize(10);
data.setValueTypeface(Typeface.create("sans-serif-medium", Typeface.BOLD));
data.setValueTextColor(Color.WHITE);
data.setValueFormatter((value, entry, dataSetIndex, viewPortHandler) -> numberFormat.format(
value));
return data;
}
示例5: setData
import com.github.mikephil.charting.data.BarData; //导入方法依赖的package包/类
private void setData(int count, float range) {
ArrayList<String> xVals = new ArrayList<String>();
for (int i = 0; i < count; i++) {
xVals.add(mMonths[i % 12]);
}
ArrayList<BarEntry> yVals1 = new ArrayList<BarEntry>();
for (int i = 0; i < count; i++) {
float mult = (range + 1);
float val = (float) (Math.random() * mult);
yVals1.add(new BarEntry(val, i));
}
BarDataSet set1 = new BarDataSet(yVals1, "DataSet");
set1.setBarSpacePercent(35f);
ArrayList<IBarDataSet> dataSets = new ArrayList<IBarDataSet>();
dataSets.add(set1);
BarData data = new BarData(xVals, dataSets);
data.setValueTextSize(10f);
data.setValueTypeface(mTf);
mChart.setData(data);
}
示例6: setData
import com.github.mikephil.charting.data.BarData; //导入方法依赖的package包/类
private void setData(int count) {
ArrayList<String> xVals = new ArrayList<String>();
ArrayList<BarEntry> entries = new ArrayList<BarEntry>();
for (int i = 0; i < count; i++) {
xVals.add(i+"");
entries.add(mSinusData.get(i));
}
BarDataSet set = new BarDataSet(entries, "Sinus Function");
set.setBarSpacePercent(40f);
set.setColor(Color.rgb(240, 120, 124));
BarData data = new BarData(xVals, set);
data.setValueTextSize(10f);
data.setValueTypeface(mTf);
data.setDrawValues(false);
mChart.setData(data);
}
示例7: setData
import com.github.mikephil.charting.data.BarData; //导入方法依赖的package包/类
private void setData(List<Data> dataList) {
ArrayList<BarEntry> values = new ArrayList<BarEntry>();
String[] dates = new String[dataList.size()];
List<Integer> colors = new ArrayList<Integer>();
int green = Color.rgb(110, 190, 102);
int red = Color.rgb(211, 74, 88);
for (int i = 0; i < dataList.size(); i++) {
Data d = dataList.get(i);
BarEntry entry = new BarEntry(d.yValue, d.xIndex);
values.add(entry);
dates[i] = dataList.get(i).xAxisValue;
// specific colors
if (d.yValue >= 0)
colors.add(red);
else
colors.add(green);
}
BarDataSet set = new BarDataSet(values, "Values");
set.setBarSpacePercent(40f);
set.setColors(colors);
set.setValueTextColors(colors);
BarData data = new BarData(dates, set);
data.setValueTextSize(13f);
data.setValueTypeface(mTf);
data.setValueFormatter(new ValueFormatter());
mChart.setData(data);
mChart.invalidate();
}
示例8: setData
import com.github.mikephil.charting.data.BarData; //导入方法依赖的package包/类
private void setData(List<Integer> valueList, String format) {
mChart.setVisibility(View.VISIBLE);
ArrayList<String> xVals = new ArrayList<String>();
ArrayList<BarEntry> yVals1 = new ArrayList<BarEntry>();
if (valueList != null) {
for (int i = 0; i < valueList.size(); i++) {
xVals.add(i + "s");
yVals1.add(new BarEntry(valueList.get(i), i));
}
}
String legend = getResources().getString(R.string.caption_receptin_rate);
if (!format.equals("%"))
legend = getResources().getString(R.string.caption_packet_count);
BarDataSet set1 = new BarDataSet(yVals1, legend);
set1.setBarSpacePercent(35f);
set1.setColor(Color.parseColor("#0288D1"));
ArrayList<IBarDataSet> dataSets = new ArrayList<IBarDataSet>();
dataSets.add(set1);
BarData data = new BarData(xVals, dataSets);
data.setValueTextSize(10f);
data.setDrawValues(false);
YAxisValueFormatter custom = new DataAxisFormatter(format);
YAxis leftAxis = mChart.getAxisLeft();
YAxis rightAxis = mChart.getAxisRight();
leftAxis.setValueFormatter(custom);
rightAxis.setValueFormatter(custom);
mChart.setData(data);
}
示例9: setData
import com.github.mikephil.charting.data.BarData; //导入方法依赖的package包/类
/**
* update data for visualization chart
*
* @param valueList list of values for the chart
* @param unit data unit
*/
private void setData(List<Integer> valueList, String unit) {
mChart.setVisibility(View.VISIBLE);
ArrayList<String> xVals = new ArrayList<String>();
ArrayList<BarEntry> yVals1 = new ArrayList<BarEntry>();
for (int i = 0; i < valueList.size(); i++) {
xVals.add(i + "s");
yVals1.add(new BarEntry(valueList.get(i), i));
}
String legend = getResources().getString(R.string.caption_receptin_rate);
if (!unit.equals("%"))
legend = getResources().getString(R.string.caption_packet_count);
BarDataSet set1 = new BarDataSet(yVals1, legend);
set1.setBarSpacePercent(35f);
set1.setColor(Color.parseColor("#0288D1"));
ArrayList<IBarDataSet> dataSets = new ArrayList<IBarDataSet>();
dataSets.add(set1);
BarData data = new BarData(xVals, dataSets);
data.setValueTextSize(10f);
data.setDrawValues(false);
YAxisValueFormatter custom = new DataAxisFormatter(unit);
YAxis leftAxis = mChart.getAxisLeft();
YAxis rightAxis = mChart.getAxisRight();
leftAxis.setValueFormatter(custom);
rightAxis.setValueFormatter(custom);
mChart.setData(data);
}
示例10: setData
import com.github.mikephil.charting.data.BarData; //导入方法依赖的package包/类
public boolean setData(List<Day> list) {
int count = list.size();
if (count > 0) {
ArrayList<Day> days = new ArrayList<>(list);
ArrayList<String> chartLabel = new ArrayList<>();
ArrayList<BarEntry> chartValue = new ArrayList<>();
for (int i = 0; i < count; i++) {
chartLabel.add(days.get(i).getThedate());
chartValue.add(new BarEntry((float) days.get(i).getPushups(), i));
}
BarDataSet dataSet = new BarDataSet(chartValue, "PUSH UP");
dataSet.setBarSpacePercent(35f);
dataSet.setColors(ColorTemplate.VORDIPLOM_COLORS);
ArrayList<IBarDataSet> barDataSets = new ArrayList<>();
barDataSets.add(dataSet);
BarData barData = new BarData(chartLabel, barDataSets);
barData.setValueTextSize(10f);
mChart.setData(barData);
return true;
}
return false;
}
示例11: showAnalysis
import com.github.mikephil.charting.data.BarData; //导入方法依赖的package包/类
@Override
public void showAnalysis(Report report) {
List<BarEntry> barEntries = new ArrayList<>();
List<Expense> expenses = report.getExpenses();
for (int i = 0; i < expenses.size(); i++) {
Expense expense = expenses.get(i);
barEntries.add(new BarEntry(
i,
expense.getAmount().floatValue())
);
}
BarDataSet barSet = new BarDataSet(barEntries, "");
barSet.setColor(selectedCategory.getColor());
List<IBarDataSet> dataSets = new ArrayList<>();
dataSets.add(barSet);
BarData data = new BarData(dataSets);
data.setValueTextSize(10f);
data.setValueTextColor(getOutlayTheme().secondaryTextColor);
data.setBarWidth(0.9f);
dayAxisValueFormatter.setExpenses(expenses);
barChart.setData(data);
barChart.invalidate();
barChart.animateY(500);
}
示例12: createBarChartData
import com.github.mikephil.charting.data.BarData; //导入方法依赖的package包/类
public BarData createBarChartData()
{
NumberFormat numberFormat = NumberFormat.getInstance();
numberFormat.setMinimumFractionDigits(0);
numberFormat.setMaximumFractionDigits(2);
ArrayList<String> xVals = new ArrayList<>();
for(int i = 0; i < 12; i++)
{
xVals.add(i + "");
}
ArrayList<BarEntry> yVals1 = new ArrayList<>();
for(int i = 0; i < 12; i++)
{
float mult = (5 + 1);
int val = (int) (Math.random() * mult);
yVals1.add(new BarEntry((val == 0 ? 1 : val), i));
}
BarDataSet set1 = new BarDataSet(yVals1, "DataSet");
set1.setColor(0xFF2196f3);
set1.setBarSpacePercent(40f);
ArrayList<IBarDataSet> dataSets = new ArrayList<>();
dataSets.add(set1);
BarData data = new BarData(xVals, dataSets);
data.setValueTextSize(10);
data.setValueTypeface(Typeface.create("sans-serif-medium", Typeface.BOLD));
data.setValueTextColor(Color.WHITE);
data.setValueFormatter((value, entry, dataSetIndex, viewPortHandler) -> numberFormat.format(
value));
return data;
}
示例13: createStackedBarChartData
import com.github.mikephil.charting.data.BarData; //导入方法依赖的package包/类
public BarData createStackedBarChartData()
{
NumberFormat numberFormat = NumberFormat.getInstance();
numberFormat.setMinimumFractionDigits(0);
numberFormat.setMaximumFractionDigits(2);
ArrayList<String> xVals = new ArrayList<>();
for(int i = 0; i < 12; i++)
{
xVals.add(i + "");
}
ArrayList<BarEntry> yVals1 = new ArrayList<>();
for(int i = 0; i < 12; i++)
{
float mult = (5 + 1);
int val = (int) (Math.random() * mult);
yVals1.add(new BarEntry(new float[] {(val == 0 ? 1 : val - 1), 1}, i));
}
BarDataSet set1 = new BarDataSet(yVals1, "DataSet");
set1.setColors(new int[] {0xFF2196f3, 0xFF3f51b5});
set1.setBarSpacePercent(40f);
ArrayList<IBarDataSet> dataSets = new ArrayList<>();
dataSets.add(set1);
BarData data = new BarData(xVals, dataSets);
data.setValueTextSize(10);
data.setValueTypeface(Typeface.create("sans-serif-medium", Typeface.BOLD));
data.setValueTextColor(Color.WHITE);
data.setValueFormatter((value, entry, dataSetIndex, viewPortHandler) -> numberFormat.format(
value));
return data;
}