本文整理汇总了Java中lecho.lib.hellocharts.model.SubcolumnValue.getValue方法的典型用法代码示例。如果您正苦于以下问题:Java SubcolumnValue.getValue方法的具体用法?Java SubcolumnValue.getValue怎么用?Java SubcolumnValue.getValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lecho.lib.hellocharts.model.SubcolumnValue
的用法示例。
在下文中一共展示了SubcolumnValue.getValue方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: calculateMaxViewportForStacked
import lecho.lib.hellocharts.model.SubcolumnValue; //导入方法依赖的package包/类
private void calculateMaxViewportForStacked(ColumnChartData data) {
for (Column column : data.getColumns()) {
float sumPositive = baseValue;
float sumNegative = baseValue;
for (SubcolumnValue columnValue : column.getValues()) {
if (columnValue.getValue() >= baseValue) {
sumPositive += columnValue.getValue();
} else {
sumNegative += columnValue.getValue();
}
}
if (sumPositive > tempMaximumViewport.top) {
tempMaximumViewport.top = sumPositive;
}
if (sumNegative < tempMaximumViewport.bottom) {
tempMaximumViewport.bottom = sumNegative;
}
}
}
示例2: calculateMaxViewportForStacked
import lecho.lib.hellocharts.model.SubcolumnValue; //导入方法依赖的package包/类
private void calculateMaxViewportForStacked(ColumnChartData data) {
for (Column column : data.getColumns()) {
float sumPositive = this.baseValue;
float sumNegative = this.baseValue;
for (SubcolumnValue columnValue : column.getValues()) {
if (columnValue.getValue() >= this.baseValue) {
sumPositive += columnValue.getValue();
} else {
sumNegative += columnValue.getValue();
}
}
if (sumPositive > this.tempMaximumViewport.top) {
this.tempMaximumViewport.top = sumPositive;
}
if (sumNegative < this.tempMaximumViewport.bottom) {
this.tempMaximumViewport.bottom = sumNegative;
}
}
}
示例3: calculateMaxViewportForSubcolumns
import lecho.lib.hellocharts.model.SubcolumnValue; //导入方法依赖的package包/类
private void calculateMaxViewportForSubcolumns(ColumnChartData data) {
for (Column column : data.getColumns()) {
for (SubcolumnValue columnValue : column.getValues()) {
if (columnValue.getValue() >= baseValue && columnValue.getValue() > tempMaximumViewport.top) {
tempMaximumViewport.top = columnValue.getValue();
}
if (columnValue.getValue() < baseValue && columnValue.getValue() < tempMaximumViewport.bottom) {
tempMaximumViewport.bottom = columnValue.getValue();
}
}
}
}
示例4: processColumnForStacked
import lecho.lib.hellocharts.model.SubcolumnValue; //导入方法依赖的package包/类
private void processColumnForStacked(Canvas canvas, Column column, float columnWidth, int columnIndex, int mode) {
final float rawX = computator.computeRawX(columnIndex);
final float halfColumnWidth = columnWidth / 2;
float mostPositiveValue = baseValue;
float mostNegativeValue = baseValue;
float subcolumnBaseValue = baseValue;
int valueIndex = 0;
for (SubcolumnValue columnValue : column.getValues()) {
columnPaint.setColor(columnValue.getColor());
if (columnValue.getValue() >= baseValue) {
// Using values instead of raw pixels make code easier to
// understand(for me)
subcolumnBaseValue = mostPositiveValue;
mostPositiveValue += columnValue.getValue();
} else {
subcolumnBaseValue = mostNegativeValue;
mostNegativeValue += columnValue.getValue();
}
final float rawBaseY = computator.computeRawY(subcolumnBaseValue);
final float rawY = computator.computeRawY(subcolumnBaseValue + columnValue.getValue());
calculateRectToDraw(columnValue, rawX - halfColumnWidth, rawX + halfColumnWidth, rawBaseY, rawY);
switch (mode) {
case MODE_DRAW:
drawSubcolumn(canvas, column, columnValue, true);
break;
case MODE_HIGHLIGHT:
highlightSubcolumn(canvas, column, columnValue, valueIndex, true);
break;
case MODE_CHECK_TOUCH:
checkRectToDraw(columnIndex, valueIndex);
break;
default:
// There no else, every case should be handled or exception will
// be thrown
throw new IllegalStateException("Cannot process column in mode: " + mode);
}
++valueIndex;
}
}
示例5: calculateRectToDraw
import lecho.lib.hellocharts.model.SubcolumnValue; //导入方法依赖的package包/类
private void calculateRectToDraw(SubcolumnValue columnValue, float left, float right, float rawBaseY, float rawY) {
// Calculate rect that will be drawn as column, subcolumn or label background.
drawRect.left = left;
drawRect.right = right;
if (columnValue.getValue() >= baseValue) {
drawRect.top = rawY;
drawRect.bottom = rawBaseY - subcolumnSpacing;
} else {
drawRect.bottom = rawY;
drawRect.top = rawBaseY + subcolumnSpacing;
}
}
示例6: calculateMaxViewportForSubcolumns
import lecho.lib.hellocharts.model.SubcolumnValue; //导入方法依赖的package包/类
private void calculateMaxViewportForSubcolumns(ColumnChartData data) {
for (Column column : data.getColumns()) {
for (SubcolumnValue columnValue : column.getValues()) {
if (columnValue.getValue() >= this.baseValue && columnValue.getValue() > this.tempMaximumViewport.top) {
this.tempMaximumViewport.top = columnValue.getValue();
}
if (columnValue.getValue() < this.baseValue && columnValue.getValue() < this.tempMaximumViewport.bottom) {
this.tempMaximumViewport.bottom = columnValue.getValue();
}
}
}
}
示例7: processColumnForStacked
import lecho.lib.hellocharts.model.SubcolumnValue; //导入方法依赖的package包/类
private void processColumnForStacked(Canvas canvas, Column column, float columnWidth, int columnIndex, int mode) {
float rawX = this.computator.computeRawX((float) columnIndex);
float halfColumnWidth = columnWidth / 2.0f;
float mostPositiveValue = this.baseValue;
float mostNegativeValue = this.baseValue;
float subcolumnBaseValue = this.baseValue;
int valueIndex = 0;
for (SubcolumnValue columnValue : column.getValues()) {
if (this.isHigllightAboveTarget) {
this.columnPaint.setColor(this.aboveTargetLineColor);
} else {
this.columnPaint.setColor(columnValue.getColor());
}
if (columnValue.getValue() >= this.baseValue) {
subcolumnBaseValue = mostPositiveValue;
mostPositiveValue += columnValue.getValue();
} else {
subcolumnBaseValue = mostNegativeValue;
mostNegativeValue += columnValue.getValue();
}
calculateRectToDraw(columnValue, rawX - halfColumnWidth, rawX + halfColumnWidth, this.computator.computeRawY(subcolumnBaseValue), this.computator.computeRawY(columnValue.getValue() + subcolumnBaseValue));
switch (mode) {
case 0:
drawSubcolumn(canvas, column, columnValue, true);
break;
case 1:
checkRectToDraw(columnIndex, valueIndex);
break;
case 2:
highlightSubcolumn(canvas, column, columnValue, valueIndex, true);
break;
default:
throw new IllegalStateException("Cannot process column in mode: " + mode);
}
valueIndex++;
}
}
示例8: calculateRectToDraw
import lecho.lib.hellocharts.model.SubcolumnValue; //导入方法依赖的package包/类
private void calculateRectToDraw(SubcolumnValue columnValue, float left, float right, float rawBaseY, float rawY) {
this.drawRect.left = left;
this.drawRect.right = right;
if (columnValue.getValue() >= this.baseValue) {
this.drawRect.top = rawY;
this.drawRect.bottom = rawBaseY - ((float) this.subcolumnSpacing);
return;
}
this.drawRect.bottom = rawY;
this.drawRect.top = ((float) this.subcolumnSpacing) + rawBaseY;
}
示例9: getColumnValue
import lecho.lib.hellocharts.model.SubcolumnValue; //导入方法依赖的package包/类
private float getColumnValue(SubcolumnValue columnValue) {
if (this.maxCaloryLimit > 0.0f) {
return columnValue.getValue() > this.maxCaloryLimit ? this.maxCaloryLimit : columnValue.getValue();
} else {
return columnValue.getValue();
}
}
示例10: drawLabel
import lecho.lib.hellocharts.model.SubcolumnValue; //导入方法依赖的package包/类
private void drawLabel(Canvas canvas, Column column, SubcolumnValue columnValue, boolean isStacked, float offset) {
final int numChars = column.getFormatter().formatChartValue(labelBuffer, columnValue);
if (numChars == 0) {
// No need to draw empty label
return;
}
final float labelWidth = labelPaint.measureText(labelBuffer, labelBuffer.length - numChars, numChars);
final int labelHeight = Math.abs(fontMetrics.ascent);
float left = drawRect.centerX() - labelWidth / 2 - labelMargin;
float right = drawRect.centerX() + labelWidth / 2 + labelMargin;
float top;
float bottom;
if (isStacked && labelHeight < drawRect.height() - (2 * labelMargin)) {
// For stacked columns draw label only if label height is less than subcolumn height - (2 * labelMargin).
if (columnValue.getValue() >= baseValue) {
top = drawRect.top;
bottom = drawRect.top + labelHeight + labelMargin * 2;
} else {
top = drawRect.bottom - labelHeight - labelMargin * 2;
bottom = drawRect.bottom;
}
} else if (!isStacked) {
// For not stacked draw label at the top for positive and at the bottom for negative values
if (columnValue.getValue() >= baseValue) {
top = drawRect.top - offset - labelHeight - labelMargin * 2;
if (top < computator.getContentRectMinusAllMargins().top) {
top = drawRect.top + offset;
bottom = drawRect.top + offset + labelHeight + labelMargin * 2;
} else {
bottom = drawRect.top - offset;
}
} else {
bottom = drawRect.bottom + offset + labelHeight + labelMargin * 2;
if (bottom > computator.getContentRectMinusAllMargins().bottom) {
top = drawRect.bottom - offset - labelHeight - labelMargin * 2;
bottom = drawRect.bottom - offset;
} else {
top = drawRect.bottom + offset;
}
}
} else {
// Draw nothing.
return;
}
labelBackgroundRect.set(left, top, right, bottom);
drawLabelTextAndBackground(canvas, labelBuffer, labelBuffer.length - numChars, numChars,
columnValue.getDarkenColor());
}
示例11: processColumnForSubcolumns
import lecho.lib.hellocharts.model.SubcolumnValue; //导入方法依赖的package包/类
private void processColumnForSubcolumns(Canvas canvas, Column column, float columnWidth, int columnIndex, int mode) {
float subcolumnWidth = (columnWidth - ((float) (this.subcolumnSpacing * (column.getValues().size() - 1)))) / ((float) column.getValues().size());
if (subcolumnWidth < 1.0f) {
subcolumnWidth = 1.0f;
}
float rawX = this.computator.computeRawX((float) columnIndex);
float halfColumnWidth = columnWidth / 2.0f;
float baseRawY = this.computator.computeRawY(this.baseValue);
float subcolumnRawX = rawX - halfColumnWidth;
int valueIndex = 0;
if (column.getValues().size() > 1 && ((SubcolumnValue) column.getValues().get(column.getValues().size() - 1)).getValue() == 0.0f) {
subcolumnRawX += subcolumnWidth / 2.0f;
}
List<SubcolumnValue> subcolumnValueList = column.getValues();
for (int i = 0; i < subcolumnValueList.size(); i++) {
SubcolumnValue columnValue = (SubcolumnValue) subcolumnValueList.get(i);
if (columnValue.getValue() != 0.0f) {
if (!this.isHigllightAboveTarget || columnValue.getValue() <= ((float) this.targetCalory)) {
this.columnPaint.setColor(columnValue.getColor());
} else {
this.columnPaint.setColor(this.aboveTargetLineColor);
}
if (subcolumnRawX <= rawX + halfColumnWidth) {
calculateRectToDraw(columnValue, subcolumnRawX, subcolumnRawX + subcolumnWidth, baseRawY, this.computator.computeRawY(getColumnValue(columnValue)));
switch (mode) {
case 0:
drawSubcolumn(canvas, column, columnValue, false);
break;
case 1:
checkRectToDraw(columnIndex, valueIndex);
break;
case 2:
highlightSubcolumn(canvas, column, columnValue, valueIndex, false);
break;
default:
throw new IllegalStateException("Cannot process column in mode: " + mode);
}
subcolumnRawX += ((float) this.subcolumnSpacing) + subcolumnWidth;
valueIndex++;
} else {
return;
}
} else if (i == 0) {
subcolumnRawX += subcolumnWidth / 2.0f;
}
}
}
示例12: drawLabel
import lecho.lib.hellocharts.model.SubcolumnValue; //导入方法依赖的package包/类
private void drawLabel(Canvas canvas, Column column, SubcolumnValue columnValue, boolean isStacked, float offset) {
int numChars = column.getFormatter().formatChartValue(this.labelBuffer, columnValue);
if (numChars != 0) {
float top;
float bottom;
float labelWidth = this.labelPaint.measureText(this.labelBuffer, this.labelBuffer.length - numChars, numChars);
int labelHeight = Math.abs(this.fontMetrics.ascent);
float left = (this.drawRect.centerX() - (labelWidth / 2.0f)) - ((float) this.labelMargin);
float right = (this.drawRect.centerX() + (labelWidth / 2.0f)) + ((float) this.labelMargin);
if (!isStacked || ((float) labelHeight) >= this.drawRect.height() - ((float) (this.labelMargin * 2))) {
if (!isStacked) {
if (columnValue.getValue() >= this.baseValue) {
top = ((this.drawRect.top - offset) - ((float) labelHeight)) - ((float) (this.labelMargin * 2));
if (top < ((float) this.computator.getContentRectMinusAllMargins().top)) {
top = this.drawRect.top + offset;
bottom = ((this.drawRect.top + offset) + ((float) labelHeight)) + ((float) (this.labelMargin * 2));
} else {
bottom = this.drawRect.top - offset;
}
} else {
bottom = ((this.drawRect.bottom + offset) + ((float) labelHeight)) + ((float) (this.labelMargin * 2));
if (bottom > ((float) this.computator.getContentRectMinusAllMargins().bottom)) {
top = ((this.drawRect.bottom - offset) - ((float) labelHeight)) - ((float) (this.labelMargin * 2));
bottom = this.drawRect.bottom - offset;
} else {
top = this.drawRect.bottom + offset;
}
}
} else {
return;
}
} else if (columnValue.getValue() >= this.baseValue) {
top = this.drawRect.top;
bottom = (this.drawRect.top + ((float) labelHeight)) + ((float) (this.labelMargin * 2));
} else {
top = (this.drawRect.bottom - ((float) labelHeight)) - ((float) (this.labelMargin * 2));
bottom = this.drawRect.bottom;
}
this.labelBackgroundRect.set(left, top, right, bottom);
drawLabelTextAndBackground(canvas, this.labelBuffer, this.labelBuffer.length - numChars, numChars, columnValue.getDarkenColor());
}
}