本文整理汇总了Java中lecho.lib.hellocharts.model.Line.setHasLabels方法的典型用法代码示例。如果您正苦于以下问题:Java Line.setHasLabels方法的具体用法?Java Line.setHasLabels怎么用?Java Line.setHasLabels使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lecho.lib.hellocharts.model.Line
的用法示例。
在下文中一共展示了Line.setHasLabels方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: generateLineData
import lecho.lib.hellocharts.model.Line; //导入方法依赖的package包/类
private LineChartData generateLineData() {
List<Line> lines = new ArrayList<Line>();
for (int i = 0; i < numberOfLines; ++i) {
List<PointValue> values = new ArrayList<PointValue>();
for (int j = 0; j < numberOfPoints; ++j) {
values.add(new PointValue(j, randomNumbersTab[i][j]));
}
Line line = new Line(values);
line.setColor(ChartUtils.COLORS[i]);
line.setCubic(isCubic);
line.setHasLabels(hasLabels);
line.setHasLines(hasLines);
line.setHasPoints(hasPoints);
lines.add(line);
}
LineChartData lineChartData = new LineChartData(lines);
return lineChartData;
}
示例2: getLines
import lecho.lib.hellocharts.model.Line; //导入方法依赖的package包/类
private List<Line> getLines() {
Line line = new Line(this.mPointValues);
line.setColor(this.resources.getColor(R.color.js));
line.setLabelColor(this.resources.getColor(R.color.js));
line.setFilled(true);
line.setCubic(false);
line.setHasLabels(true);
if (this.mWeightRecords == null || this.mWeightRecords.size() == 0 || this.mTypeMode > 0) {
line.setHasPoints(false);
} else {
line.setHasPoints(true);
}
line.setFormatter(new SimpleLineChartValueFormatter().setDecimalDigitsNumber(1));
List<Line> lines = new ArrayList();
Line target = getTargetLine();
if (target != null) {
lines.add(target);
}
lines.add(line);
return lines;
}
示例3: getTargetLine
import lecho.lib.hellocharts.model.Line; //导入方法依赖的package包/类
private Line getTargetLine() {
if (!needDrawTargetLine()) {
return null;
}
PointValue lastRecordPoint = (PointValue) this.mPointValues.get(this.mPointValues.size()
- 1);
PointValue targetPoint = new PointValue(((AxisValue) this.mAxisValues.get(this
.mAxisValues.size() - 1)).getValue(), this.mTargetWeight);
List<PointValue> points = new ArrayList();
points.add(lastRecordPoint);
points.add(targetPoint);
Line line = new Line(points);
line.setColor(this.resources.getColor(R.color.da));
line.setPathEffect(new DashPathEffect(new float[]{15.0f, 15.0f, 15.0f, 15.0f}, 0.0f));
line.setHasLabels(false);
if (this.mTypeMode > 0) {
line.setHasPoints(false);
return line;
}
line.setHasPoints(true);
return line;
}
示例4: getLines
import lecho.lib.hellocharts.model.Line; //导入方法依赖的package包/类
private List<Line> getLines() {
Line line = new Line(this.mPointValues);
line.setColor(this.resources.getColor(R.color.js));
line.setLabelColor(this.resources.getColor(R.color.js));
line.setFilled(true);
line.setCubic(false);
line.setHasLabels(true);
if (this.mWeightRecords == null || this.mWeightRecords.size() == 0 || this.mTypeMode > 0) {
line.setHasPoints(false);
} else {
line.setHasPoints(true);
}
line.setFormatter(new SimpleLineChartValueFormatter().setDecimalDigitsNumber(1));
List<Line> lines = new ArrayList();
lines.add(line);
return lines;
}
示例5: getCalibrationsLine
import lecho.lib.hellocharts.model.Line; //导入方法依赖的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;
}
示例6: generateData
import lecho.lib.hellocharts.model.Line; //导入方法依赖的package包/类
private void generateData() {
List<Line> lines = new ArrayList<Line>();
for (int i = 0; i < numberOfLines; ++i) {
List<PointValue> values = new ArrayList<PointValue>();
for (int j = 0; j < numberOfPoints; ++j) {
values.add(new PointValue(j, randomNumbersTab[i][j]));
}
Line line = new Line(values);
line.setColor(ChartUtils.COLORS[i]);
line.setShape(shape);
line.setCubic(isCubic);
line.setFilled(isFilled);
line.setHasLabels(hasLabels);
line.setHasLabelsOnlyForSelected(hasLabelForSelected);
line.setHasLines(hasLines);
line.setHasPoints(hasPoints);
line.setHasGradientToTransparent(hasGradientToTransparent);
if (pointsHaveDifferentColor){
line.setPointColor(ChartUtils.COLORS[(i + 1) % ChartUtils.COLORS.length]);
}
lines.add(line);
}
data = new LineChartData(lines);
if (hasAxes) {
Axis axisX = new Axis();
Axis axisY = new Axis().setHasLines(true);
if (hasAxesNames) {
axisX.setName("Axis X");
axisY.setName("Axis Y");
}
data.setAxisXBottom(axisX);
data.setAxisYLeft(axisY);
} else {
data.setAxisXBottom(null);
data.setAxisYLeft(null);
}
data.setBaseValue(Float.NEGATIVE_INFINITY);
chart.setLineChartData(data);
}
示例7: initLineChart
import lecho.lib.hellocharts.model.Line; //导入方法依赖的package包/类
private void initLineChart() {
Line line = new Line(mPointValues).setColor(Color.parseColor("#FFFAFA")); //折线的颜色(橙色)
List<Line> lines = new ArrayList<>();
line.setShape(ValueShape.CIRCLE);//折线图上每个数据点的形状 这里是圆形 (有三种 :ValueShape.SQUARE ValueShape.CIRCLE ValueShape.DIAMOND)
line.setCubic(false);//曲线是否平滑,即是曲线还是折线
line.setFilled(false);//是否填充曲线的面积
line.setHasLabels(true);//曲线的数据坐标是否加上备注
// line.setHasLabelsOnlyForSelected(true);//点击数据坐标提示数据(设置了这个line.setHasLabels(true);就无效)
line.setHasLines(true);//是否用线显示。如果为false 则没有曲线只有点显示
line.setHasPoints(true);//是否显示圆点 如果为false 则没有原点只有点显示(每个数据点都是个大的圆点)
lines.add(line);
LineChartData data = new LineChartData();
data.setLines(lines);
//坐标轴
Axis axisX = new Axis(); //X轴
axisX.setHasTiltedLabels(true); //X坐标轴字体是斜的显示还是直的,true是斜的显示
axisX.setTextColor(Color.WHITE); //设置字体颜色
//axisX.setName("date"); //表格名称
axisX.setTextSize(10);//设置字体大小
axisX.setMaxLabelChars(8); //最多几个X轴坐标,意思就是你的缩放让X轴上数据的个数7<=x<=mAxisXValues.length
axisX.setValues(mAxisXValues); //填充X轴的坐标名称
data.setAxisXBottom(axisX); //x 轴在底部
//data.setAxisXTop(axisX); //x 轴在顶部
axisX.setHasLines(true); //x 轴分割线
// Y轴是根据数据的大小自动设置Y轴上限(在下面我会给出固定Y轴数据个数的解决方案)
Axis axisY = new Axis();
axisY.setName("");//y轴标注
// axisY.setTextSize(10);//设置字体大小
axisY.setTextColor(Color.parseColor("#ffffff"));
data.setAxisYLeft(axisY); //Y轴设置在左边
//data.setAxisYRight(axisY); //y轴设置在右边
//设置行为属性,支持缩放、滑动以及平移
lineChart.setInteractive(true);
lineChart.setZoomType(ZoomType.HORIZONTAL);
lineChart.setMaxZoom((float) 2);//最大方法比例
lineChart.setContainerScrollEnabled(true, ContainerScrollType.HORIZONTAL);
lineChart.setLineChartData(data);
lineChart.setVisibility(View.VISIBLE);
/**注:下面的7,10只是代表一个数字去类比而已
* 当时是为了解决X轴固定数据个数。见(http://forum.xda-developers.com/tools/programming/library-hellocharts-charting-library-t2904456/page2);
*/
// Viewport v = new Viewport(lineChart.getMaximumViewport());
// v.left = 0;
// v.right= 7;
// lineChart.setCurrentViewport(v);
}
示例8: getCalibrationsLine
import lecho.lib.hellocharts.model.Line; //导入方法依赖的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;
}
示例9: generateData
import lecho.lib.hellocharts.model.Line; //导入方法依赖的package包/类
private void generateData() {
List<Line> lines = new ArrayList<Line>();
Entry e;
Entry[] entries = getEntries();
long firstTimestamp = entries[0].getTimestamp();
for (int i = 0; i < numberOfLines; ++i) {
List<PointValue> values = new ArrayList<PointValue>();
for (int j = 0; j < entries.length; ++j) {
e = entries[j];
values.add(new PointValue(e.getTimestamp() - firstTimestamp, e.getY()));
}
Line line = new Line(values);
line.setColor(ChartUtils.COLORS[i]);
line.setShape(shape);
line.setCubic(isCubic);
line.setFilled(isFilled);
line.setHasLabels(hasLabels);
line.setHasLabelsOnlyForSelected(hasLabelForSelected);
line.setHasLines(hasLines);
line.setHasPoints(hasPoints);
lines.add(line);
}
data = new LineChartData(lines);
if (hasAxes) {
//Axis axisX = new Axis();
//Axis axisY = new Axis().setHasLines(true);
/*if (hasAxesNames) {
axisX.setName("Axis X");
axisY.setName("Axis Y");
}*/
data.setAxisXBottom(getXAxis());
data.setAxisYLeft(getYAxis());
} else {
data.setAxisXBottom(null);
data.setAxisYLeft(null);
}
data.setBaseValue(Float.NEGATIVE_INFINITY);
chart.setLineChartData(data);
}
示例10: generateData
import lecho.lib.hellocharts.model.Line; //导入方法依赖的package包/类
private void generateData() {
List<Line> lines = new ArrayList<Line>();
for (int i = 0; i < 1; i++) {
// ����Դ
List<PointValue> values = new ArrayList<PointValue>();
for (int j = 0; j < listLevel.size(); j++) {
values.add(new PointValue(j, listLevel.get(j)));
}
// ������
Line line = new Line(values);
// �����е���ɫ
line.setColor(ChartUtils.COLORS[i]);
// ��״
line.setShape(shape);
// �Ƿ�������
line.setCubic(isCubic);
// ���
line.setFilled(isFilled);
// ��ǩ
line.setHasLabels(hasLabels);
// ������ѡ�е����ñ�ǩ
line.setHasLabelsOnlyForSelected(hasLabelsOnlyForSelected);
// ����
line.setHasLines(hasLines);
// ��
line.setHasPoints(hasPoints);
lines.add(line);
}
data = new LineChartData();
data.setLines(lines);
if (hasAxes) {
Axis axisX = new Axis();
Axis axisY = new Axis().setHasLines(true);
if (hasAxesNames) {
axisX.setName("ʱ��(s)");
axisY.setName("�ź�ǿ��");
}
data.setAxisXBottom(axisX);
data.setAxisYLeft(axisY);
} else {
data.setAxisXBottom(null);
data.setAxisYLeft(null);
}
data.setBaseValue(Float.NEGATIVE_INFINITY);
mChartView.setLineChartData(data);
}