本文整理汇总了Java中lecho.lib.hellocharts.model.Column类的典型用法代码示例。如果您正苦于以下问题:Java Column类的具体用法?Java Column怎么用?Java Column使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Column类属于lecho.lib.hellocharts.model包,在下文中一共展示了Column类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: generateColumnChartData
import lecho.lib.hellocharts.model.Column; //导入依赖的package包/类
private ColumnChartData generateColumnChartData() {
int numSubcolumns = 1;
int numColumns = 12;
// Column can have many subcolumns, here by default I use 1 subcolumn in each of 8 columns.
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));
}
ColumnChartData data = new ColumnChartData(columns);
data.setAxisXBottom(new Axis().setName("Axis X"));
data.setAxisYLeft(new Axis().setName("Axis Y").setHasLines(true));
return data;
}
示例4: generateColumnData
import lecho.lib.hellocharts.model.Column; //导入依赖的package包/类
private ColumnChartData generateColumnData() {
int numSubcolumns = 1;
int numColumns = 12;
// Column can have many subcolumns, here by default I use 1 subcolumn in each of 8 columns.
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() * 50 + 5, ChartUtils.COLOR_GREEN));
}
columns.add(new Column(values));
}
ColumnChartData columnChartData = new ColumnChartData(columns);
return columnChartData;
}
示例5: 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;
}
}
}
示例6: getColumnsData
import lecho.lib.hellocharts.model.Column; //导入依赖的package包/类
private List<Column> getColumnsData(List<DietRecord> records) {
if (records == null || records.size() == 0) {
return null;
}
this.mRecordValues.clear();
List<Column> columnList = new ArrayList();
for (int i = 0; i < records.size(); i++) {
List<SubcolumnValue> values = new ArrayList();
values.add(new SubcolumnValue(((DietRecord) records.get(i)).eating_calory, this
.resources.getColor(R.color.cq)));
values.add(new SubcolumnValue(((DietRecord) records.get(i)).activity_calory, this
.resources.getColor(R.color.i0)));
this.mRecordValues.add(Float.valueOf(((DietRecord) records.get(i)).eating_calory));
this.mRecordValues.add(Float.valueOf(((DietRecord) records.get(i)).activity_calory));
Column column = new Column(values);
column.setHasLabels(true);
columnList.add(column);
}
return columnList;
}
示例7: getColumnsData
import lecho.lib.hellocharts.model.Column; //导入依赖的package包/类
private List<Column> getColumnsData(List<StepModel> steps) {
if (steps == null || steps.size() == 0) {
return null;
}
List<Column> columns = new ArrayList();
for (int i = 0; i < steps.size(); i++) {
StepModel step = (StepModel) steps.get(i);
List<SubcolumnValue> values = new ArrayList();
values.add(new SubcolumnValue((float) step.step, ContextCompat.getColor(this.context,
R.color.jv)));
Column column = new Column(values);
column.setHasLabels(true);
columns.add(column);
}
return columns;
}
示例8: addSerieToBarChart
import lecho.lib.hellocharts.model.Column; //导入依赖的package包/类
private void addSerieToBarChart(List<Column> values, List<AxisValue> axisValues, String category,
double percent, double ects, int color) {
if (percent > 0) {
axisValues.add(new AxisValue(axisValues.size()).setLabel(category));
ArrayList<SubcolumnValue> subColumns = new ArrayList<>();
SubcolumnValue subColumn = new SubcolumnValue((float) percent, color);
subColumn.setLabel(AppUtils.format(getContext(), "%.2f ECTS", ects));
subColumns.add(subColumn);
Column column = new Column(subColumns);
column.setHasLabels(false);
column.setHasLabelsOnlyForSelected(true);
values.add(column);
}
}
示例9: setupChart
import lecho.lib.hellocharts.model.Column; //导入依赖的package包/类
private static void setupChart(Context context, ColumnChartView chart, List<AxisValue> xAxisValues, String yAxisLabel, List<Column> columns) {
Axis xAxis = new Axis(xAxisValues);
ChartUtils.setupXAxis(context, xAxis);
Axis yAxis = new Axis();
ChartUtils.setupYAxis(context, yAxisLabel, yAxis);
ColumnChartData data = new ColumnChartData();
data.setAxisXBottom(xAxis);
data.setAxisYLeft(yAxis);
data.setColumns(columns);
data.setStacked(true);
chart.setInteractive(true);
chart.setColumnChartData(data);
chart.setValueSelectionEnabled(true);
chart.setZoomEnabled(true);
chart.setZoomType(ZoomType.HORIZONTAL);
WindowManager windowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
DisplayMetrics displayMetrics = new DisplayMetrics();
windowManager.getDefaultDisplay().getMetrics(displayMetrics);
float numberVisibleColumns = displayMetrics.widthPixels / context.getResources().getDimension(R.dimen.column_chart_column_width);
float zoomLevel = columns.size() / numberVisibleColumns;
if (zoomLevel > 0) {
chart.setZoomLevel(chart.getMaximumViewport().right - 1, 0.0f, zoomLevel);
}
}
示例10: 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();
}
}
}
}
示例11: drawColumnsForSubcolumns
import lecho.lib.hellocharts.model.Column; //导入依赖的package包/类
private void drawColumnsForSubcolumns(Canvas canvas) {
final ColumnChartData data = dataProvider.getColumnChartData();
final float columnWidth = calculateColumnWidth();
int columnIndex = 0;
for (Column column : data.getColumns()) {
processColumnForSubcolumns(canvas, column, columnWidth, columnIndex, MODE_DRAW);
++columnIndex;
}
}
示例12: checkTouchForSubcolumns
import lecho.lib.hellocharts.model.Column; //导入依赖的package包/类
private void checkTouchForSubcolumns(float touchX, float touchY) {
// Using member variable to hold touch point to avoid too much parameters in methods.
touchedPoint.x = touchX;
touchedPoint.y = touchY;
final ColumnChartData data = dataProvider.getColumnChartData();
final float columnWidth = calculateColumnWidth();
int columnIndex = 0;
for (Column column : data.getColumns()) {
// canvas is not needed for checking touch
processColumnForSubcolumns(null, column, columnWidth, columnIndex, MODE_CHECK_TOUCH);
++columnIndex;
}
}
示例13: drawColumnForStacked
import lecho.lib.hellocharts.model.Column; //导入依赖的package包/类
private void drawColumnForStacked(Canvas canvas) {
final ColumnChartData data = dataProvider.getColumnChartData();
final float columnWidth = calculateColumnWidth();
// Columns are indexes from 0 to n, column index is also column X value
int columnIndex = 0;
for (Column column : data.getColumns()) {
processColumnForStacked(canvas, column, columnWidth, columnIndex, MODE_DRAW);
++columnIndex;
}
}
示例14: highlightColumnForStacked
import lecho.lib.hellocharts.model.Column; //导入依赖的package包/类
private void highlightColumnForStacked(Canvas canvas) {
final ColumnChartData data = dataProvider.getColumnChartData();
final float columnWidth = calculateColumnWidth();
// Columns are indexes from 0 to n, column index is also column X value
Column column = data.getColumns().get(selectedValue.getFirstIndex());
processColumnForStacked(canvas, column, columnWidth, selectedValue.getFirstIndex(), MODE_HIGHLIGHT);
}
示例15: checkTouchForStacked
import lecho.lib.hellocharts.model.Column; //导入依赖的package包/类
private void checkTouchForStacked(float touchX, float touchY) {
touchedPoint.x = touchX;
touchedPoint.y = touchY;
final ColumnChartData data = dataProvider.getColumnChartData();
final float columnWidth = calculateColumnWidth();
int columnIndex = 0;
for (Column column : data.getColumns()) {
// canvas is not needed for checking touch
processColumnForStacked(null, column, columnWidth, columnIndex, MODE_CHECK_TOUCH);
++columnIndex;
}
}