本文整理汇总了Java中com.github.mikephil.charting.data.LineData.setValueTextSize方法的典型用法代码示例。如果您正苦于以下问题:Java LineData.setValueTextSize方法的具体用法?Java LineData.setValueTextSize怎么用?Java LineData.setValueTextSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.github.mikephil.charting.data.LineData
的用法示例。
在下文中一共展示了LineData.setValueTextSize方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setData
import com.github.mikephil.charting.data.LineData; //导入方法依赖的package包/类
private void setData(int count, float range) {
// now in hours
long now = TimeUnit.MILLISECONDS.toHours(System.currentTimeMillis());
ArrayList<Entry> values = new ArrayList<Entry>();
float from = now;
// count = hours
float to = now + count;
// increment by 1 hour
for (float x = from; x < to; x++) {
float y = getRandom(range, 50);
values.add(new Entry(x, y)); // add one entry per hour
}
// create a dataset and give it a type
LineDataSet set1 = new LineDataSet(values, "DataSet 1");
set1.setAxisDependency(AxisDependency.LEFT);
set1.setColor(ColorTemplate.getHoloBlue());
set1.setValueTextColor(ColorTemplate.getHoloBlue());
set1.setLineWidth(1.5f);
set1.setDrawCircles(false);
set1.setDrawValues(false);
set1.setFillAlpha(65);
set1.setFillColor(ColorTemplate.getHoloBlue());
set1.setHighLightColor(Color.rgb(244, 117, 117));
set1.setDrawCircleHole(false);
// create a data object with the datasets
LineData data = new LineData(set1);
data.setValueTextColor(Color.WHITE);
data.setValueTextSize(9f);
// set data
mChart.setData(data);
}
示例2: marshallHumidity
import com.github.mikephil.charting.data.LineData; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
private void marshallHumidity(List<HumidityHolder> humidity) {
final int count = humidity.size();
List<String> xVals = new ArrayList<>();
List<Entry> humidityList = new ArrayList<>();
for(int i = 0; i < count; ++i) {
HumidityHolder humidityHolder = humidity.get(i);
xVals.add(humidityHolder.getDate());
humidityList.add(new Entry(humidityHolder.getHumidity(), i));
}
LineDataSet lineDataSet = new LineDataSet(humidityList, "湿度");
lineDataSet.setDrawCubic(true);
lineDataSet.setDrawFilled(true);
lineDataSet.setDrawCircles(false);
lineDataSet.setCircleColor(Color.WHITE);
lineDataSet.setHighLightColor(m_context.getResources().getColor(R.color.max));
lineDataSet.setColor(Color.WHITE);
lineDataSet.setFillColor(m_context.getResources().getColor(R.color.fill));
lineDataSet.setFillAlpha(100);
LineData data = new LineData(xVals, lineDataSet);
data.setValueTextSize(5f);
m_iWeatherForecastView.showHumidity(data);
}
示例3: setData
import com.github.mikephil.charting.data.LineData; //导入方法依赖的package包/类
private void setData(int count, float range) {
ArrayList<String> xVals = new ArrayList<String>();
for (int i = 0; i < count; i++) {
xVals.add((1990 +i) + "");
}
ArrayList<Entry> vals1 = new ArrayList<Entry>();
for (int i = 0; i < count; i++) {
float mult = (range + 1);
float val = (float) (Math.random() * mult) + 20;// + (float)
// ((mult *
// 0.1) / 10);
vals1.add(new Entry(val, i));
}
// create a dataset and give it a type
LineDataSet set1 = new LineDataSet(vals1, "DataSet 1");
set1.setDrawCubic(true);
set1.setCubicIntensity(0.2f);
//set1.setDrawFilled(true);
set1.setDrawCircles(false);
set1.setLineWidth(1.8f);
set1.setCircleRadius(4f);
set1.setCircleColor(Color.WHITE);
set1.setHighLightColor(Color.rgb(244, 117, 117));
set1.setColor(Color.WHITE);
set1.setFillColor(Color.WHITE);
set1.setFillAlpha(100);
set1.setDrawHorizontalHighlightIndicator(false);
set1.setFillFormatter(new FillFormatter() {
@Override
public float getFillLinePosition(ILineDataSet dataSet, LineDataProvider dataProvider) {
return -10;
}
});
// create a data object with the datasets
LineData data = new LineData(xVals, set1);
data.setValueTypeface(tf);
data.setValueTextSize(9f);
data.setDrawValues(false);
// set data
mChart.setData(data);
}
示例4: getReactionTimeInPercentageLineData
import com.github.mikephil.charting.data.LineData; //导入方法依赖的package包/类
/**
* Get combined line data to be displayed in the line chart
*
* @return combined line data to be displayed in the line chart
*/
@NonNull
private LineData getReactionTimeInPercentageLineData() {
// get selected user
String userId = Global.getSelectedUser();
UtilsRG.debug("selected user!: " + userId);
// get percentage medians by user
final Double[] reactionTimesInPercentage = getReactionGameMedians(userId);
// get predicted median in percentage
final Double[] reactionTimesForecastInPercentage = getNextForecastReactionMedianInPercentage();
// fill reaction times
List<Entry> entries = new ArrayList<>();
for (int i = 0; i < reactionTimesInPercentage.length; i++) {
entries.add(new Entry(i, reactionTimesInPercentage[i].intValue()));
}
// fill forecast
List<Entry> entriesForecast = new ArrayList<>();
entriesForecast.add(new Entry(reactionTimesInPercentage.length - 1, reactionTimesInPercentage[reactionTimesInPercentage.length - 1].intValue()));
for (int i = 0; i < reactionTimesForecastInPercentage.length; i++) {
entriesForecast.add(new Entry(reactionTimesInPercentage.length + i, reactionTimesForecastInPercentage[i].intValue()));
}
// curved line
LineDataSet.Mode lineMode = LineDataSet.Mode.HORIZONTAL_BEZIER;
// reaction time in percentage data set
LineDataSet dataSet = new LineDataSet(entries, Strings.getStringByRId(R.string.forecast_performance));
dataSet.setMode(lineMode);
dataSet = setLineDataStyling(dataSet, R.color.colorPrimary);
// reaction time forecast in percentage data set
LineDataSet dataSetForecast = new LineDataSet(entriesForecast, Strings.getStringByRId(R.string.forecast_performance));
dataSetForecast.setMode(lineMode);
dataSetForecast = setLineDataStyling(dataSetForecast, R.color.colorPrimaryLight);
dataSetForecast.enableDashedLine(10, 10, 1000);
// combine data sets
LineData lineData = new LineData(dataSet, dataSetForecast);
lineData.setValueFormatter(new BarChartPercentFormatter());
lineData.setValueTextSize(15f);
return lineData;
}