本文整理汇总了Java中lecho.lib.hellocharts.model.ValueShape类的典型用法代码示例。如果您正苦于以下问题:Java ValueShape类的具体用法?Java ValueShape怎么用?Java ValueShape使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ValueShape类属于lecho.lib.hellocharts.model包,在下文中一共展示了ValueShape类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: drawBubbleShapeAndLabel
import lecho.lib.hellocharts.model.ValueShape; //导入依赖的package包/类
private void drawBubbleShapeAndLabel(Canvas canvas, BubbleValue bubbleValue, float rawRadius, int mode) {
if (ValueShape.SQUARE.equals(bubbleValue.getShape())) {
canvas.drawRect(bubbleRect, bubblePaint);
} else if (ValueShape.CIRCLE.equals(bubbleValue.getShape())) {
canvas.drawCircle(bubbleCenter.x, bubbleCenter.y, rawRadius, bubblePaint);
} else {
throw new IllegalArgumentException("Invalid bubble shape: " + bubbleValue.getShape());
}
if (MODE_HIGHLIGHT == mode) {
if (hasLabels || hasLabelsOnlyForSelected) {
drawLabel(canvas, bubbleValue, bubbleCenter.x, bubbleCenter.y);
}
} else if (MODE_DRAW == mode) {
if (hasLabels) {
drawLabel(canvas, bubbleValue, bubbleCenter.x, bubbleCenter.y);
}
} else {
throw new IllegalStateException("Cannot process bubble in mode: " + mode);
}
}
示例2: processBubble
import lecho.lib.hellocharts.model.ValueShape; //导入依赖的package包/类
/**
* Calculate bubble radius and center x and y coordinates. Center x and x will be stored in point parameter, radius
* will be returned as float value.
*/
private float processBubble(BubbleValue bubbleValue, PointF point) {
final float rawX = computator.computeRawX(bubbleValue.getX());
final float rawY = computator.computeRawY(bubbleValue.getY());
float radius = (float) Math.sqrt(Math.abs(bubbleValue.getZ()) / Math.PI);
float rawRadius;
if (isBubbleScaledByX) {
radius *= bubbleScaleX;
rawRadius = computator.computeRawDistanceX(radius);
} else {
radius *= bubbleScaleY;
rawRadius = computator.computeRawDistanceY(radius);
}
if (rawRadius < minRawRadius + touchAdditional) {
rawRadius = minRawRadius + touchAdditional;
}
bubbleCenter.set(rawX, rawY);
if (ValueShape.SQUARE.equals(bubbleValue.getShape())) {
bubbleRect.set(rawX - rawRadius, rawY - rawRadius, rawX + rawRadius, rawY + rawRadius);
}
return rawRadius;
}
示例3: drawPoint
import lecho.lib.hellocharts.model.ValueShape; //导入依赖的package包/类
private void drawPoint(Canvas canvas, Line line, PointValue pointValue, float rawX, float rawY,
float pointRadius) {
if (ValueShape.SQUARE.equals(line.getShape())) {
canvas.drawRect(rawX - pointRadius, rawY - pointRadius, rawX + pointRadius, rawY + pointRadius,
pointPaint);
} else if (ValueShape.CIRCLE.equals(line.getShape())) {
canvas.drawCircle(rawX, rawY, pointRadius, pointPaint);
} else if (ValueShape.DIAMOND.equals(line.getShape())) {
canvas.save();
canvas.rotate(45, rawX, rawY);
canvas.drawRect(rawX - pointRadius, rawY - pointRadius, rawX + pointRadius, rawY + pointRadius,
pointPaint);
canvas.restore();
} else {
throw new IllegalArgumentException("Invalid point shape: " + line.getShape());
}
}
示例4: reset
import lecho.lib.hellocharts.model.ValueShape; //导入依赖的package包/类
private void reset() {
numberOfLines = 1;
hasAxes = true;
hasAxesNames = true;
hasLines = true;
hasPoints = true;
shape = ValueShape.CIRCLE;
isFilled = false;
hasLabels = false;
isCubic = false;
hasLabelForSelected = false;
pointsHaveDifferentColor = false;
chart.setValueSelectionEnabled(hasLabelForSelected);
resetViewport();
}
示例5: checkTouch
import lecho.lib.hellocharts.model.ValueShape; //导入依赖的package包/类
public boolean checkTouch(float touchX, float touchY) {
this.selectedValue.clear();
int valueIndex = 0;
for (BubbleValue bubbleValue : this.dataProvider.getBubbleChartData().getValues()) {
float rawRadius = processBubble(bubbleValue, this.bubbleCenter);
if (ValueShape.SQUARE.equals(bubbleValue.getShape())) {
if (this.bubbleRect.contains(touchX, touchY)) {
this.selectedValue.set(valueIndex, valueIndex, SelectedValueType.NONE);
}
} else if (ValueShape.CIRCLE.equals(bubbleValue.getShape())) {
float diffX = touchX - this.bubbleCenter.x;
float diffY = touchY - this.bubbleCenter.y;
if (((float) Math.sqrt((double) ((diffX * diffX) + (diffY * diffY)))) <= rawRadius) {
this.selectedValue.set(valueIndex, valueIndex, SelectedValueType.NONE);
}
} else {
throw new IllegalArgumentException("Invalid bubble shape: " + bubbleValue.getShape());
}
valueIndex++;
}
return isTouched();
}
示例6: drawBubbleShapeAndLabel
import lecho.lib.hellocharts.model.ValueShape; //导入依赖的package包/类
private void drawBubbleShapeAndLabel(Canvas canvas, BubbleValue bubbleValue, float rawRadius, int mode) {
if (ValueShape.SQUARE.equals(bubbleValue.getShape())) {
canvas.drawRect(this.bubbleRect, this.bubblePaint);
} else if (ValueShape.CIRCLE.equals(bubbleValue.getShape())) {
canvas.drawCircle(this.bubbleCenter.x, this.bubbleCenter.y, rawRadius, this.bubblePaint);
} else {
throw new IllegalArgumentException("Invalid bubble shape: " + bubbleValue.getShape());
}
if (1 == mode) {
if (this.hasLabels || this.hasLabelsOnlyForSelected) {
drawLabel(canvas, bubbleValue, this.bubbleCenter.x, this.bubbleCenter.y);
}
} else if (mode != 0) {
throw new IllegalStateException("Cannot process bubble in mode: " + mode);
} else if (this.hasLabels) {
drawLabel(canvas, bubbleValue, this.bubbleCenter.x, this.bubbleCenter.y);
}
}
示例7: processBubble
import lecho.lib.hellocharts.model.ValueShape; //导入依赖的package包/类
private float processBubble(BubbleValue bubbleValue, PointF point) {
float rawRadius;
float rawX = this.computator.computeRawX(bubbleValue.getX());
float rawY = this.computator.computeRawY(bubbleValue.getY());
float radius = (float) Math.sqrt(((double) Math.abs(bubbleValue.getZ())) / 3.141592653589793d);
if (this.isBubbleScaledByX) {
rawRadius = this.computator.computeRawDistanceX(radius * this.bubbleScaleX);
} else {
rawRadius = this.computator.computeRawDistanceY(radius * this.bubbleScaleY);
}
if (rawRadius < this.minRawRadius + ((float) this.touchAdditional)) {
rawRadius = this.minRawRadius + ((float) this.touchAdditional);
}
this.bubbleCenter.set(rawX, rawY);
if (ValueShape.SQUARE.equals(bubbleValue.getShape())) {
this.bubbleRect.set(rawX - rawRadius, rawY - rawRadius, rawX + rawRadius, rawY + rawRadius);
}
return rawRadius;
}
示例8: extraLines
import lecho.lib.hellocharts.model.ValueShape; //导入依赖的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: reset
import lecho.lib.hellocharts.model.ValueShape; //导入依赖的package包/类
private void reset() {
numberOfLines = 1;
hasAxes = true;
hasAxesNames = true;
hasLines = true;
hasPoints = true;
shape = ValueShape.CIRCLE;
isFilled = false;
hasLabels = false;
isCubic = false;
hasLabelForSelected = false;
chart.setValueSelectionEnabled(hasLabelForSelected);
resetViewport();
}
示例10: checkTouch
import lecho.lib.hellocharts.model.ValueShape; //导入依赖的package包/类
@Override
public boolean checkTouch(float touchX, float touchY) {
selectedValue.clear();
final BubbleChartData data = dataProvider.getBubbleChartData();
int valueIndex = 0;
for (BubbleValue bubbleValue : data.getValues()) {
float rawRadius = processBubble(bubbleValue, bubbleCenter);
if (ValueShape.SQUARE.equals(bubbleValue.getShape())) {
if (bubbleRect.contains(touchX, touchY)) {
selectedValue.set(valueIndex, valueIndex, SelectedValueType.NONE);
}
} else if (ValueShape.CIRCLE.equals(bubbleValue.getShape())) {
final float diffX = touchX - bubbleCenter.x;
final float diffY = touchY - bubbleCenter.y;
final float touchDistance = (float) Math.sqrt((diffX * diffX) + (diffY * diffY));
if (touchDistance <= rawRadius) {
selectedValue.set(valueIndex, valueIndex, SelectedValueType.NONE);
}
} else {
throw new IllegalArgumentException("Invalid bubble shape: " + bubbleValue.getShape());
}
++valueIndex;
}
return isTouched();
}
示例11: reset
import lecho.lib.hellocharts.model.ValueShape; //导入依赖的package包/类
private void reset() {
hasAxes = true;
hasAxesNames = true;
shape = ValueShape.CIRCLE;
hasLabels = false;
hasLabelForSelected = false;
chart.setValueSelectionEnabled(hasLabelForSelected);
}
示例12: drawPoint
import lecho.lib.hellocharts.model.ValueShape; //导入依赖的package包/类
private void drawPoint(Canvas canvas, Line line, PointValue pointValue, float rawX, float rawY, float pointRadius) {
if (ValueShape.SQUARE.equals(line.getShape())) {
canvas.drawRect(rawX - pointRadius, rawY - pointRadius, rawX + pointRadius, rawY + pointRadius, this.pointPaint);
} else if (ValueShape.CIRCLE.equals(line.getShape())) {
canvas.drawCircle(rawX, rawY, pointRadius, this.pointPaint);
} else if (ValueShape.DIAMOND.equals(line.getShape())) {
canvas.save();
canvas.rotate(45.0f, rawX, rawY);
canvas.drawRect(rawX - pointRadius, rawY - pointRadius, rawX + pointRadius, rawY + pointRadius, this.pointPaint);
canvas.restore();
} else {
throw new IllegalArgumentException("Invalid point shape: " + line.getShape());
}
}
示例13: treatmentValuesLine
import lecho.lib.hellocharts.model.ValueShape; //导入依赖的package包/类
public Line[] treatmentValuesLine() {
Line[] lines = new Line[2];
try {
lines[0] = new Line(treatmentValues);
lines[0].setColor(highColor);//getCol(X.color_treatment_dot_background) 0xFFFFFF
lines[0].setHasLines(false);
lines[0].setPointRadius(pointSize * 5 / 3);//pointSize * 5 / 2
lines[0].setHasPoints(true);
lines[0].setShape(ValueShape.DIAMOND);//KS
lines[1] = new Line(treatmentValues);
lines[1].setColor(Color.GREEN);//getCol(X.color_treatment_dot_foreground)//0x77aa00 //lowColor
lines[1].setHasLines(false);
lines[1].setPointRadius(pointSize * 5 / 4);//pointSize * 5 / 4
lines[1].setHasPoints(true);
lines[1].setShape(ValueShape.DIAMOND);
//lines[1].setHasLabels(true);
LineChartValueFormatter formatter = new SimpleLineChartValueFormatter(1);
lines[1].setFormatter(formatter);
} catch (Exception e) {
if (d) UserError.Log.i(TAG, "Exception making treatment lines: " + e.toString());
}
return lines;
}
示例14: extraLines
import lecho.lib.hellocharts.model.ValueShape; //导入依赖的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;
}
示例15: setCircles
import lecho.lib.hellocharts.model.ValueShape; //导入依赖的package包/类
private void setCircles() {
shape = ValueShape.CIRCLE;
generateData();
}