本文整理汇总了Java中lecho.lib.hellocharts.model.Line.setHasLines方法的典型用法代码示例。如果您正苦于以下问题:Java Line.setHasLines方法的具体用法?Java Line.setHasLines怎么用?Java Line.setHasLines使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lecho.lib.hellocharts.model.Line
的用法示例。
在下文中一共展示了Line.setHasLines方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: extraLines
import lecho.lib.hellocharts.model.Line; //导入方法依赖的package包/类
public List<Line> extraLines()
{
final List<Line> lines = new ArrayList<>();
Line bloodtest = new Line(bloodTestValues);
bloodtest.setHasLines(false);
bloodtest.setPointRadius(pointSize * 5 / 3);//3 / 2
bloodtest.setHasPoints(true);
bloodtest.setColor(highColor);//ChartUtils.darkenColor(getCol(X.color_calibration_dot_background))
bloodtest.setShape(ValueShape.SQUARE);
lines.add(bloodtest);
Line bloodtesti = new Line(bloodTestValues);
bloodtesti.setHasLines(false);
bloodtesti.setPointRadius(pointSize * 5 / 4);//3 / 4
bloodtesti.setHasPoints(true);
bloodtesti.setColor(lowColor);//ChartUtils.darkenColor(getCol(X.color_calibration_dot_foreground))
bloodtesti.setShape(ValueShape.SQUARE);
lines.add(bloodtesti);
return lines;
}
示例3: 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;
}
示例4: cobFutureLine
import lecho.lib.hellocharts.model.Line; //导入方法依赖的package包/类
public Line cobFutureLine(){
List<PointValue> listValues = new ArrayList<>();
for (int c = 0; c < cobFutureValues.length(); c++) {
try {
if (cobFutureValues.getJSONObject(c).getDouble("display") > yCOBMax) {
listValues.add(new PointValue((float) (cobFutureValues.getJSONObject(c).getDouble("as_of")), (float) yCOBMax.floatValue())); //Do not go above Max COB
} else if (cobFutureValues.getJSONObject(c).getDouble("display") < yCOBMin) {
listValues.add(new PointValue((float) (cobFutureValues.getJSONObject(c).getDouble("as_of")), (float) yCOBMin.floatValue())); //Do not go below Min COB
} else {
listValues.add(new PointValue((float) (cobFutureValues.getJSONObject(c).getDouble("as_of")), (float) cobFutureValues.getJSONObject(c).getDouble("display")));
}
} catch (JSONException e) {
e.printStackTrace();
Crashlytics.logException(e);
}
}
Line cobValuesLine = new Line(listValues);
cobValuesLine.setColor(ChartUtils.COLOR_ORANGE);
cobValuesLine.setHasLines(false);
cobValuesLine.setHasPoints(true);
cobValuesLine.setFilled(false);
cobValuesLine.setCubic(false);
cobValuesLine.setPointRadius(2);
return cobValuesLine;
}
示例5: iobFutureLine
import lecho.lib.hellocharts.model.Line; //导入方法依赖的package包/类
public Line iobFutureLine() {
List<PointValue> listValues = new ArrayList<>();
for (int c = 0; c < iobFutureValues.length(); c++) {
try {
if (iobFutureValues.getJSONObject(c).getDouble("iob") > yIOBMax) {
listValues.add(new PointValue((float) (iobFutureValues.getJSONObject(c).getDouble("as_of")), (float) fitIOB2COBRange(yIOBMax))); //Do not go above Max IOB
} else if (iobFutureValues.getJSONObject(c).getDouble("iob") < yIOBMin) {
listValues.add(new PointValue((float) (iobFutureValues.getJSONObject(c).getDouble("as_of")), (float) fitIOB2COBRange(yIOBMin))); //Do not go below Min IOB
} else {
listValues.add(new PointValue((float) (iobFutureValues.getJSONObject(c).getDouble("as_of")), (float) fitIOB2COBRange(iobFutureValues.getJSONObject(c).getDouble("iob"))));
}
} catch (JSONException e) {
Crashlytics.logException(e);
e.printStackTrace();
}
}
Line cobValuesLine = new Line(listValues);
cobValuesLine.setColor(ChartUtils.COLOR_BLUE);
cobValuesLine.setHasLines(false);
cobValuesLine.setHasPoints(true);
cobValuesLine.setFilled(false);
cobValuesLine.setCubic(false);
cobValuesLine.setPointRadius(2);
return cobValuesLine;
}
示例6: rawInterpretedLine
import lecho.lib.hellocharts.model.Line; //导入方法依赖的package包/类
public Line rawInterpretedLine() {
Line line = new Line(rawInterpretedValues);
line.setHasLines(false);
line.setPointRadius(1);
line.setHasPoints(true);
return line;
}
示例7: filteredLines
import lecho.lib.hellocharts.model.Line; //导入方法依赖的package包/类
public ArrayList<Line> filteredLines() {
ArrayList<Line> line_array = new ArrayList<Line>();
float last_x_pos = -999999; // bogus mark value
final float jump_threshold = 15; // in minutes
List<PointValue> local_points = new ArrayList<PointValue>();
if (filteredValues.size() > 0) {
final float end_marker = filteredValues.get(filteredValues.size() - 1).getX();
for (PointValue current_point : filteredValues) {
// a jump too far for a line? make it a new one
if (((last_x_pos != -999999) && (Math.abs(current_point.getX() - last_x_pos) > jump_threshold))
|| current_point.getX() == end_marker) {
Line line = new Line(local_points);
line.setHasPoints(true);
line.setPointRadius(2);
line.setStrokeWidth(1);
line.setColor(Color.parseColor("#a0a0a0"));
line.setCubic(true);
line.setHasLines(true);
line_array.add(line);
local_points = new ArrayList<PointValue>();
}
last_x_pos = current_point.getX();
local_points.add(current_point); // grow current line list
}
}
return line_array;
}
示例8: filteredLines
import lecho.lib.hellocharts.model.Line; //导入方法依赖的package包/类
public ArrayList<Line> filteredLines() {
ArrayList<Line> linearray = new ArrayList<Line>();
float lastx = -999999; // bogus mark value
final float jumpthresh = 15; // in minutes
List<PointValue> thesepoints = new ArrayList<PointValue>();
if (filteredValues.size() > 0) {
final float endmarker = filteredValues.get(filteredValues.size() - 1).getX();
for (PointValue thispoint : filteredValues) {
// a jump too far for a line? make it a new one
if (((lastx != -999999) && (Math.abs(thispoint.getX() - lastx) > jumpthresh))
|| thispoint.getX() == endmarker) {
Line line = new Line(thesepoints);
line.setHasPoints(true);
line.setPointRadius(2);
line.setStrokeWidth(1);
line.setColor(getCol(X.color_filtered));
line.setCubic(true);
line.setHasLines(true);
linearray.add(line);
thesepoints = new ArrayList<PointValue>();
}
lastx = thispoint.getX();
thesepoints.add(thispoint); // grow current line list
}
} else {
UserError.Log.i(TAG, "Raw points size is zero");
}
//UserError.Log.i(TAG, "Returning linearray: " + Integer.toString(linearray.size()));
return linearray;
}
示例9: extraLines
import lecho.lib.hellocharts.model.Line; //导入方法依赖的package包/类
public List<Line> extraLines()
{
final List<Line> lines = new ArrayList<>();
Line line = new Line(pluginValues);
line.setHasLines(false);
line.setPointRadius(pluginSize);
line.setHasPoints(true);
line.setColor(getCol(X.color_secondary_glucose_value));
lines.add(line);
Line bloodtest = new Line(bloodTestValues);
bloodtest.setHasLines(false);
bloodtest.setPointRadius(pointSize * 3 / 2);
bloodtest.setHasPoints(true);
bloodtest.setColor(ChartUtils.darkenColor(getCol(X.color_calibration_dot_background)));
bloodtest.setShape(ValueShape.SQUARE);
lines.add(bloodtest);
Line bloodtesti = new Line(bloodTestValues);
bloodtesti.setHasLines(false);
bloodtesti.setPointRadius(pointSize * 3 / 4);
bloodtesti.setHasPoints(true);
bloodtesti.setColor(ChartUtils.darkenColor(getCol(X.color_calibration_dot_foreground)));
bloodtesti.setShape(ValueShape.SQUARE);
lines.add(bloodtesti);
return lines;
}
示例10: maxiobcobShowLine
import lecho.lib.hellocharts.model.Line; //导入方法依赖的package包/类
public Line maxiobcobShowLine() {
List<PointValue> maxShowValues = new ArrayList<PointValue>();
maxShowValues.add(new PointValue((float) start_time.getTime(), (float) 50));
maxShowValues.add(new PointValue((float) end_time, (float) 50));
Line maxShowLine = new Line(maxShowValues);
maxShowLine.setHasLines(false);
maxShowLine.setHasPoints(false);
return maxShowLine;
}
示例11: basalvsTempBasalLine
import lecho.lib.hellocharts.model.Line; //导入方法依赖的package包/类
public Line basalvsTempBasalLine(){
Line cobValuesLine = new Line(tempBasalValues);
cobValuesLine.setColor(ChartUtils.COLOR_BLUE);
cobValuesLine.setHasLines(true);
cobValuesLine.setHasPoints(false);
cobValuesLine.setFilled(true);
cobValuesLine.setCubic(false);
return cobValuesLine;
}
示例12: 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);
}
示例13: updateGraph
import lecho.lib.hellocharts.model.Line; //导入方法依赖的package包/类
private void updateGraph(List<MonthlyPvDatum> monthlyPvData,
List<MonthlyPvDatum> previousYearMonthlyPvData) {
LinearLayout graphLinearLayout = (LinearLayout) fragmentView.findViewById(graph);
graphLinearLayout.removeAllViews();
final Context context = getContext();
if (context != null) {
ComboLineColumnChartView comboLineColumnChartView = new ComboLineColumnChartView(context);
graphLinearLayout.addView(comboLineColumnChartView);
List<Column> columns = new ArrayList<>();
List<SubcolumnValue> subcolumnValues;
for (int i = 0; i < monthlyPvData.size(); i++) {
MonthlyPvDatum monthlyPvDatum = monthlyPvData.get(i);
subcolumnValues = new ArrayList<>();
subcolumnValues.add(new SubcolumnValue(
((float) monthlyPvDatum.getEnergyGenerated()) / 1000,
ChartUtils.COLORS[0]));
columns.add(new Column(subcolumnValues));
}
List<Line> lines = new ArrayList<>();
List<PointValue> lineValues = new ArrayList<>();
for (int i = 0; i < previousYearMonthlyPvData.size(); i++) {
MonthlyPvDatum previousYearMonthlyPvDatum = previousYearMonthlyPvData.get(i);
lineValues.add(new PointValue(i,
((float) previousYearMonthlyPvDatum.getEnergyGenerated()) / 1000));
}
Line line = new Line(lineValues);
line.setPointRadius(3);
line.setHasLines(false);
lines.add(line);
ComboLineColumnChartData comboLineColumnChartData = new ComboLineColumnChartData(
new ColumnChartData(columns), new LineChartData(lines));
RecordPvDatum recordPvDatum = pvDataOperations.loadRecord();
double yAxisMax = Math.max(recordPvDatum.getMonthlyEnergyGenerated() / 1000, 1.0);
AxisLabelValues axisLabelValues = FormatUtils.getAxisLabelValues(yAxisMax);
Axis yAxis = Axis
.generateAxisFromRange(0, axisLabelValues.getMax(), axisLabelValues.getStep())
.setMaxLabelChars(6)
.setTextColor(Color.GRAY)
.setHasLines(true);
yAxis.setName(getResources().getString(R.string.graph_legend_energy));
comboLineColumnChartData.setAxisYLeft(yAxis);
comboLineColumnChartView.setComboLineColumnChartData(comboLineColumnChartData);
comboLineColumnChartView.setViewportCalculationEnabled(false);
Viewport viewport = new Viewport(
-1, axisLabelValues.getView(), monthlyPvData.size() + 1, 0);
comboLineColumnChartView.setMaximumViewport(viewport);
comboLineColumnChartView.setCurrentViewport(viewport);
}
}
示例14: updateGraph
import lecho.lib.hellocharts.model.Line; //导入方法依赖的package包/类
private void updateGraph(List<DailyPvDatum> dailyPvData,
List<DailyPvDatum> previousYearDailyPvData) {
LinearLayout graphLinearLayout = (LinearLayout) fragmentView.findViewById(graph);
graphLinearLayout.removeAllViews();
final Context context = getContext();
if (context != null) {
ComboLineColumnChartView comboLineColumnChartView = new ComboLineColumnChartView(context);
graphLinearLayout.addView(comboLineColumnChartView);
List<Column> columns = new ArrayList<>();
List<SubcolumnValue> subcolumnValues;
for (int i = 0; i < dailyPvData.size(); i++) {
DailyPvDatum dailyPvDatum = dailyPvData.get(i);
subcolumnValues = new ArrayList<>();
subcolumnValues.add(new SubcolumnValue(
((float) dailyPvDatum.getEnergyGenerated()) / 1000,
ChartUtils.COLORS[0]));
columns.add(new Column(subcolumnValues));
}
List<Line> lines = new ArrayList<>();
List<PointValue> lineValues = new ArrayList<>();
for (int i = 0; i < previousYearDailyPvData.size(); i++) {
DailyPvDatum previousYearDailyPvDatum = previousYearDailyPvData.get(i);
lineValues.add(new PointValue(i,
((float) previousYearDailyPvDatum.getEnergyGenerated()) / 1000));
}
Line line = new Line(lineValues);
line.setPointRadius(3);
line.setHasLines(false);
lines.add(line);
ComboLineColumnChartData comboLineColumnChartData = new ComboLineColumnChartData(
new ColumnChartData(columns), new LineChartData(lines));
RecordPvDatum recordPvDatum = pvDataOperations.loadRecord();
double yAxisMax = Math.max(recordPvDatum.getDailyEnergyGenerated() / 1000, 1.0);
AxisLabelValues axisLabelValues = FormatUtils.getAxisLabelValues(yAxisMax);
Axis yAxis = Axis
.generateAxisFromRange(0, axisLabelValues.getMax(), axisLabelValues.getStep())
.setMaxLabelChars(6)
.setTextColor(Color.GRAY)
.setHasLines(true);
yAxis.setName(getResources().getString(R.string.graph_legend_energy));
comboLineColumnChartData.setAxisYLeft(yAxis);
comboLineColumnChartView.setComboLineColumnChartData(comboLineColumnChartData);
comboLineColumnChartView.setViewportCalculationEnabled(false);
Viewport viewport = new Viewport(
-1, axisLabelValues.getView(), dailyPvData.size() + 1, 0);
comboLineColumnChartView.setMaximumViewport(viewport);
comboLineColumnChartView.setCurrentViewport(viewport);
}
}
示例15: 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);
}