本文整理汇总了Java中lecho.lib.hellocharts.model.Column.getValues方法的典型用法代码示例。如果您正苦于以下问题:Java Column.getValues方法的具体用法?Java Column.getValues怎么用?Java Column.getValues使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lecho.lib.hellocharts.model.Column
的用法示例。
在下文中一共展示了Column.getValues方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: calculateMaxViewportForStacked
import lecho.lib.hellocharts.model.Column; //导入方法依赖的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: generateDefaultData
import lecho.lib.hellocharts.model.Column; //导入方法依赖的package包/类
private void generateDefaultData() {
int numSubcolumns = 1;
int numColumns = 50;
List<Column> columns = new ArrayList<Column>();
List<SubcolumnValue> values;
for (int i = 0; i < numColumns; ++i) {
values = new ArrayList<SubcolumnValue>();
for (int j = 0; j < numSubcolumns; ++j) {
values.add(new SubcolumnValue((float) Math.random() * 50f + 5, ChartUtils.pickColor()));
}
columns.add(new Column(values));
}
data = new ColumnChartData(columns);
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 ColumnChartData(data);
for (Column column : previewData.getColumns()) {
for (SubcolumnValue value : column.getValues()) {
value.setColor(ChartUtils.DEFAULT_DARKEN_COLOR);
}
}
}
示例3: calculateMaxViewportForStacked
import lecho.lib.hellocharts.model.Column; //导入方法依赖的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;
}
}
}
示例4: calculateMaxViewportForSubcolumns
import lecho.lib.hellocharts.model.Column; //导入方法依赖的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();
}
}
}
}
示例5: processColumnForStacked
import lecho.lib.hellocharts.model.Column; //导入方法依赖的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;
}
}
示例6: prepareDataAnimation
import lecho.lib.hellocharts.model.Column; //导入方法依赖的package包/类
/**
* To animate values you have to change targets values and then call {@link Chart#startDataAnimation()}
* method(don't confuse with View.animate()).
*/
private void prepareDataAnimation() {
for (Column column : data.getColumns()) {
for (SubcolumnValue value : column.getValues()) {
value.setTarget((float) Math.random() * 100);
}
}
}
示例7: calculateMaxViewportForSubcolumns
import lecho.lib.hellocharts.model.Column; //导入方法依赖的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();
}
}
}
}
示例8: processColumnForStacked
import lecho.lib.hellocharts.model.Column; //导入方法依赖的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++;
}
}
示例9: processColumnForSubcolumns
import lecho.lib.hellocharts.model.Column; //导入方法依赖的package包/类
private void processColumnForSubcolumns(Canvas canvas, Column column, float columnWidth, int columnIndex,
int mode) {
// For n subcolumns there will be n-1 spacing and there will be one
// subcolumn for every columnValue
float subcolumnWidth = (columnWidth - (subcolumnSpacing * (column.getValues().size() - 1)))
/ column.getValues().size();
if (subcolumnWidth < 1) {
subcolumnWidth = 1;
}
// Columns are indexes from 0 to n, column index is also column X value
final float rawX = computator.computeRawX(columnIndex);
final float halfColumnWidth = columnWidth / 2;
final float baseRawY = computator.computeRawY(baseValue);
// First subcolumn will starts at the left edge of current column,
// rawValueX is horizontal center of that column
float subcolumnRawX = rawX - halfColumnWidth;
int valueIndex = 0;
for (SubcolumnValue columnValue : column.getValues()) {
columnPaint.setColor(columnValue.getColor());
if (subcolumnRawX > rawX + halfColumnWidth) {
break;
}
final float rawY = computator.computeRawY(columnValue.getValue());
calculateRectToDraw(columnValue, subcolumnRawX, subcolumnRawX + subcolumnWidth, baseRawY, rawY);
switch (mode) {
case MODE_DRAW:
drawSubcolumn(canvas, column, columnValue, false);
break;
case MODE_HIGHLIGHT:
highlightSubcolumn(canvas, column, columnValue, valueIndex, false);
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);
}
subcolumnRawX += subcolumnWidth + subcolumnSpacing;
++valueIndex;
}
}
示例10: processColumnForSubcolumns
import lecho.lib.hellocharts.model.Column; //导入方法依赖的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;
}
}
}