本文整理汇总了Java中lecho.lib.hellocharts.model.PointValue.setLabel方法的典型用法代码示例。如果您正苦于以下问题:Java PointValue.setLabel方法的具体用法?Java PointValue.setLabel怎么用?Java PointValue.setLabel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lecho.lib.hellocharts.model.PointValue
的用法示例。
在下文中一共展示了PointValue.setLabel方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getCalibrationsLine
import lecho.lib.hellocharts.model.PointValue; //导入方法依赖的package包/类
@NonNull
public Line getCalibrationsLine(List<Calibration> calibrations, int color) {
List<PointValue> values = new ArrayList<PointValue>();
for (Calibration calibration : calibrations) {
PointValue point = new PointValue((float)calibration.estimate_raw_at_time_of_calibration, (float)calibration.bg);
String time = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT).format(new Date((long)calibration.raw_timestamp));
point.setLabel(time.toCharArray());
values.add(point);
}
Line line = new Line(values);
line.setColor(color);
line.setHasLines(false);
line.setPointRadius(4);
line.setHasPoints(true);
line.setHasLabels(true);
return line;
}
示例2: getMeetingDurationPointValue
import lecho.lib.hellocharts.model.PointValue; //导入方法依赖的package包/类
private static PointValue getMeetingDurationPointValue(Meeting meeting) {
String duration = DateUtils.formatElapsedTime(meeting.getDuration());
PointValue point = new PointValue();
point.set(meeting.getStartDate(), (float) meeting.getDuration() / (60));
point.setLabel(duration);
return point;
}
示例3: getCalibrationsLine
import lecho.lib.hellocharts.model.PointValue; //导入方法依赖的package包/类
@NonNull
public List<Line> getCalibrationsLine(List<Calibration> calibrations, int color) {
if (calibrations == null) return new ArrayList<>();
List<PointValue> values = new ArrayList<PointValue>();
List<PointValue> valuesb = new ArrayList<PointValue>();
List<PointValue> valuesc = new ArrayList<PointValue>();
for (Calibration calibration : calibrations) {
if (calibration.estimate_raw_at_time_of_calibration > end_x) {
end_x = calibration.estimate_raw_at_time_of_calibration;
}
PointValue point = new PointValue((float) calibration.estimate_raw_at_time_of_calibration,
doMgdl ? (float) calibration.bg : ((float) calibration.bg) * (float) Constants.MGDL_TO_MMOLL);
PointValue pointb = new PointValue((float) calibration.raw_value,
doMgdl ? (float) calibration.bg : ((float) calibration.bg) * (float) Constants.MGDL_TO_MMOLL);
PointValue pointc = new PointValue((float) calibration.adjusted_raw_value,
doMgdl ? (float) calibration.bg : ((float) calibration.bg) * (float) Constants.MGDL_TO_MMOLL);
String time;
if (show_days_since) {
final int days_ago = daysAgo(calibration.raw_timestamp);
time = (days_ago > 0) ? Integer.toString(days_ago) + "d " : "";
time = time + (JoH.hourMinuteString(calibration.raw_timestamp));
} else {
time = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT).format(new Date((long) calibration.raw_timestamp));
}
point.setLabel(time);
values.add(point);
// extra points showing real raw and age_adjusted raw for each calbration point
valuesb.add(pointb);
valuesc.add(pointc);
}
Line line = new Line(values);
line.setColor(color);
line.setHasLines(false);
line.setPointRadius(4);
line.setHasPoints(true);
line.setHasLabels(true);
List<Line> lines = new ArrayList<>();
lines.add(line);
if (Pref.getBooleanDefaultFalse("engineering_mode")) {
// actual raw
Line lineb = new Line(valuesb);
lineb.setColor(Color.RED);
lineb.setHasLines(false);
lineb.setPointRadius(1);
lineb.setHasPoints(true);
lineb.setHasLabels(false);
// age adjusted raw
Line linec = new Line(valuesc);
linec.setColor(Color.YELLOW);
linec.setHasLines(false);
linec.setPointRadius(1);
linec.setHasPoints(true);
linec.setHasLabels(false);
lines.add(lineb);
lines.add(linec);
}
return lines;
}
示例4: updateChart
import lecho.lib.hellocharts.model.PointValue; //导入方法依赖的package包/类
private void updateChart(Cursor data) {
List<AxisValue> axisValuesX = new ArrayList<>();
List<PointValue> pointValues = new ArrayList<>();
int counter = -1;
do {
counter++;
String date = data.getString(data.getColumnIndex(
QuoteHistoricalDataColumns.DATE));
String bidPrice = data.getString(data.getColumnIndex(
QuoteHistoricalDataColumns.BIDPRICE));
// We have to show chart in right order.
int x = data.getCount() - 1 - counter;
// Point for line chart (date, price).
PointValue pointValue = new PointValue(x, Float.valueOf(bidPrice));
pointValue.setLabel(date);
pointValues.add(pointValue);
// Set labels for x-axis (we have to reduce its number to avoid overlapping text).
if (counter != 0 && counter % (data.getCount() / 3) == 0) {
AxisValue axisValueX = new AxisValue(x);
axisValueX.setLabel(date);
axisValuesX.add(axisValueX);
}
} while (data.moveToNext());
// Prepare data for chart
Line line = new Line(pointValues).setColor(Color.WHITE).setCubic(false);
List<Line> lines = new ArrayList<>();
lines.add(line);
LineChartData lineChartData = new LineChartData();
lineChartData.setLines(lines);
// Init x-axis
Axis axisX = new Axis(axisValuesX);
axisX.setHasLines(true);
axisX.setMaxLabelChars(4);
lineChartData.setAxisXBottom(axisX);
// Init y-axis
Axis axisY = new Axis();
axisY.setAutoGenerated(true);
axisY.setHasLines(true);
axisY.setMaxLabelChars(4);
lineChartData.setAxisYLeft(axisY);
// Update chart with new data.
mChart.setInteractive(false);
mChart.setLineChartData(lineChartData);
// Show chart
mChart.setVisibility(View.VISIBLE);
mTabContent.setVisibility(View.VISIBLE);
}