本文整理汇总了Java中lecho.lib.hellocharts.model.Line.setColor方法的典型用法代码示例。如果您正苦于以下问题:Java Line.setColor方法的具体用法?Java Line.setColor怎么用?Java Line.setColor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lecho.lib.hellocharts.model.Line
的用法示例。
在下文中一共展示了Line.setColor方法的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: generateLineChartData
import lecho.lib.hellocharts.model.Line; //导入方法依赖的package包/类
private LineChartData generateLineChartData() {
int numValues = 20;
List<PointValue> values = new ArrayList<PointValue>();
for (int i = 0; i < numValues; ++i) {
values.add(new PointValue(i, (float) Math.random() * 100f));
}
Line line = new Line(values);
line.setColor(ChartUtils.COLOR_GREEN);
List<Line> lines = new ArrayList<Line>();
lines.add(line);
LineChartData data = new LineChartData(lines);
data.setAxisXBottom(new Axis().setName("Axis X"));
data.setAxisYLeft(new Axis().setName("Axis Y").setHasLines(true));
return data;
}
示例3: generatePreviewLineChartData
import lecho.lib.hellocharts.model.Line; //导入方法依赖的package包/类
private LineChartData generatePreviewLineChartData() {
int numValues = 50;
List<PointValue> values = new ArrayList<PointValue>();
for (int i = 0; i < numValues; ++i) {
values.add(new PointValue(i, (float) Math.random() * 100f));
}
Line line = new Line(values);
line.setColor(ChartUtils.DEFAULT_DARKEN_COLOR);
line.setHasPoints(false);// too many values so don't draw points.
List<Line> lines = new ArrayList<Line>();
lines.add(line);
LineChartData data = new LineChartData(lines);
data.setAxisXBottom(new Axis());
data.setAxisYLeft(new Axis().setHasLines(true));
return data;
}
示例4: generateDefaultData
import lecho.lib.hellocharts.model.Line; //导入方法依赖的package包/类
private void generateDefaultData() {
int numValues = 50;
List<PointValue> values = new ArrayList<PointValue>();
for (int i = 0; i < numValues; ++i) {
values.add(new PointValue(i, (float) Math.random() * 100f));
}
Line line = new Line(values);
line.setColor(ChartUtils.COLOR_GREEN);
line.setHasPoints(false);// too many values so don't draw points.
List<Line> lines = new ArrayList<Line>();
lines.add(line);
data = new LineChartData(lines);
data.setAxisXBottom(new Axis());
data.setAxisYLeft(new Axis().setHasLines(true));
// prepare preview data, is better to use separate deep copy for preview chart.
// Set color to grey to make preview area more visible.
previewData = new LineChartData(data);
previewData.getLines().get(0).setColor(ChartUtils.DEFAULT_DARKEN_COLOR);
}
示例5: 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;
}
示例6: 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;
}
示例7: 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;
}
示例8: 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;
}
示例9: tempValuesLine
import lecho.lib.hellocharts.model.Line; //导入方法依赖的package包/类
public Line tempValuesLine(TempWatchData twd, float offset, double factor, boolean isHighlightLine, int strokeWidth) {
List<PointValue> lineValues = new ArrayList<PointValue>();
long begin = (long) Math.max(start_time, twd.startTime);
lineValues.add(new PointValue(fuzz(begin), offset + (float) (factor * twd.startBasal)));
lineValues.add(new PointValue(fuzz(begin), offset + (float) (factor * twd.amount)));
lineValues.add(new PointValue(fuzz(twd.endTime), offset + (float) (factor * twd.amount)));
lineValues.add(new PointValue(fuzz(twd.endTime), offset + (float) (factor * twd.endBasal)));
Line valueLine = new Line(lineValues);
valueLine.setHasPoints(false);
if (isHighlightLine){
valueLine.setColor(basalCenterColor);
valueLine.setStrokeWidth(1);
}else {
valueLine.setColor(basalBackgroundColor);
valueLine.setStrokeWidth(strokeWidth);
}
return valueLine;
}
示例10: 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;
}
示例11: 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;
}
示例12: 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;
}
示例13: populateMeetingDurationChart
import lecho.lib.hellocharts.model.Line; //导入方法依赖的package包/类
public static void populateMeetingDurationChart(Context context, LineChartView chart, @NonNull Cursor cursor) {
List<PointValue> points = new ArrayList<>();
List<AxisValue> xAxisValues = new ArrayList<>();
MeetingCursorWrapper cursorWrapper = new MeetingCursorWrapper(cursor);
while (cursorWrapper.moveToNext()) {
Meeting meeting = Meeting.read(context, cursorWrapper);
points.add(getMeetingDurationPointValue(meeting));
xAxisValues.add(getMeetingDurationXAxisValue(context, meeting));
}
cursor.moveToPosition(-1);
int lineColor = ResourcesCompat.getColor(context.getResources(), R.color.scrum_chatter_primary_color, null);
Line line = new Line(points);
line.setColor(lineColor);
List<Line> lines = new ArrayList<>();
lines.add(line);
LineChartData lineChartData = new LineChartData();
lineChartData.setLines(lines);
setupChart(context,
chart,
xAxisValues,
context.getString(R.string.chart_duration),
lines);
}
示例14: generateLineData
import lecho.lib.hellocharts.model.Line; //导入方法依赖的package包/类
private void generateLineData(int color, float range) {
// Cancel last animation if not finished.
chartTop.cancelDataAnimation();
// Modify data targets
Line line = lineData.getLines().get(0);// For this example there is always only one line.
line.setColor(color);
for (PointValue value : line.getValues()) {
// Change target only for Y value.
value.setTarget(value.getX(), (float) Math.random() * range);
}
// Start new data animation with 300ms duration;
chartTop.startDataAnimation(300);
}
示例15: setLineDatas
import lecho.lib.hellocharts.model.Line; //导入方法依赖的package包/类
private void setLineDatas(int color, float range) {
//如果上一个动画未完成 先结束动画
mLineView.cancelDataAnimation();
// 设置第几条线变化 默认为第一条线
Line line = mLineData.getLines().get(0);
line.setColor(color);
for (PointValue value : line.getValues()) {
//这里只是随机值 可以添加相对应的数据
value.setTarget(value.getX(), (float) Math.random() * range);
}
mLineView.startDataAnimation();
}