Java Code Examples for lecho.lib.hellocharts.model.ColumnChartData#setAxisYLeft()
The following examples show how to use
lecho.lib.hellocharts.model.ColumnChartData#setAxisYLeft() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: StatisticViewModel.java From OmniList with GNU Affero General Public License v3.0 | 6 votes |
public ColumnChartData getDefaultModelsData() { ColumnChartData data = new ColumnChartData(Arrays.asList( getColumn(DEFAULT_TOTAL_VALUE, PalmApp.getColorCompact(R.color.md_lime_600)), getColumn(DEFAULT_TOTAL_VALUE, PalmApp.getColorCompact(R.color.md_light_blue_500)), getColumn(DEFAULT_TOTAL_VALUE, PalmApp.getColorCompact(R.color.md_green_600)), getColumn(DEFAULT_TOTAL_VALUE, PalmApp.getColorCompact(R.color.md_pink_500)), getColumn(DEFAULT_TOTAL_VALUE, PalmApp.getColorCompact(R.color.md_red_500)))); Axis axisX = Axis.generateAxisFromCollection(Arrays.asList(0.0f, 1.0f, 2.0f, 3.0f, 4.0f), Arrays.asList(PalmApp.getStringCompact(R.string.model_name_category), PalmApp.getStringCompact(R.string.model_name_assignment), PalmApp.getStringCompact(R.string.model_name_sub_assignment), PalmApp.getStringCompact(R.string.model_name_attachment), PalmApp.getStringCompact(R.string.model_name_location))); data.setAxisXBottom(axisX); data.setAxisYLeft(null); return data; }
Example 2
Source File: StatisticViewModel.java From OmniList with GNU Affero General Public License v3.0 | 6 votes |
public ColumnChartData getDefaultAttachmentData() { ColumnChartData data = new ColumnChartData(Arrays.asList( getColumn(DEFAULT_TOTAL_VALUE, PalmApp.getColorCompact(R.color.md_lime_600)), getColumn(DEFAULT_TOTAL_VALUE, PalmApp.getColorCompact(R.color.md_light_blue_500)), getColumn(DEFAULT_TOTAL_VALUE, PalmApp.getColorCompact(R.color.md_pink_500)), getColumn(DEFAULT_TOTAL_VALUE, PalmApp.getColorCompact(R.color.md_green_600)), getColumn(DEFAULT_TOTAL_VALUE, PalmApp.getColorCompact(R.color.md_red_500)))); Axis axisX = Axis.generateAxisFromCollection(Arrays.asList(0.0f, 1.0f, 2.0f, 3.0f, 4.0f), Arrays.asList(PalmApp.getStringCompact(R.string.attachment_type_files), PalmApp.getStringCompact(R.string.attachment_type_images), PalmApp.getStringCompact(R.string.attachment_type_sketches), PalmApp.getStringCompact(R.string.attachment_type_videos), PalmApp.getStringCompact(R.string.attachment_type_recordings))); data.setAxisXBottom(axisX); data.setAxisYLeft(null); return data; }
Example 3
Source File: ViewPagerChartsActivity.java From hellocharts-android with Apache License 2.0 | 6 votes |
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; }
Example 4
Source File: DataChartActivity.java From Memory-capsule with Apache License 2.0 | 5 votes |
private void initColumnChart(){//创建柱状图 columnChartView=new ColumnChartView(this); int columnWidth=(int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,400, getResources().getDisplayMetrics()); int columnHeigth=(int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,400, getResources().getDisplayMetrics()); RelativeLayout.LayoutParams columnChartParams=new RelativeLayout.LayoutParams(columnWidth,columnHeigth); columnChartParams.addRule(RelativeLayout.CENTER_HORIZONTAL); columnChartParams.addRule(RelativeLayout.CENTER_VERTICAL); List<Column>columnList=new ArrayList<>(); List<SubcolumnValue> values; for (int i=0;i<5;++i){ values=new ArrayList<SubcolumnValue>(); values.add(new SubcolumnValue((float)typesNum.get(i),colorData[i])); Column column=new Column(values); column.setHasLabels(false); column.setHasLabelsOnlyForSelected(true); columnList.add(column); } ColumnChartData columnChartData=new ColumnChartData(columnList); Axis axis=new Axis(); Axis axiy=new Axis().setHasLines(true); List<AxisValue>axisValues=new ArrayList<>(); for (int j=0;j<5;++j){ axisValues.add(new AxisValue(j).setLabel(stateChar[j])); } axis.setValues(axisValues); axis.setName("类别"); axiy.setName("数量"); columnChartData.setAxisXBottom(axis); columnChartData.setAxisYLeft(axiy); columnChartView.setColumnChartData(columnChartData); relativeLayout.addView(columnChartView,columnChartParams); }
Example 5
Source File: MetricAvailabilityFragment.java From hawkular-android-client with Apache License 2.0 | 5 votes |
private void setUpChartColumns() { List<Column> chartColumns = getChartColumns(); List<AxisValue> chartAxisPoints = getChartAxisPoints(); List<AxisValue> chartAxisValues = getChartAxisValues(); ColumnChartData chartData = new ColumnChartData() .setColumns(chartColumns); chartData.setAxisXBottom(new Axis() .setValues(chartAxisPoints)); chartData.setAxisYLeft(new Axis() .setValues(chartAxisValues)); chart.setColumnChartData(chartData); }
Example 6
Source File: PreviewColumnChartActivity.java From hellocharts-android with Apache License 2.0 | 5 votes |
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); } } }
Example 7
Source File: ColumnChartActivity.java From hellocharts-android with Apache License 2.0 | 5 votes |
private void generateDefaultData() { int numSubcolumns = 1; int numColumns = 8; // 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())); } Column column = new Column(values); column.setHasLabels(hasLabels); column.setHasLabelsOnlyForSelected(hasLabelForSelected); columns.add(column); } data = new ColumnChartData(columns); if (hasAxes) { Axis axisX = new Axis(); Axis axisY = new Axis().setHasLines(true); if (hasAxesNames) { axisX.setName("Axis X"); axisY.setName("Axis Y"); } data.setAxisXBottom(axisX); data.setAxisYLeft(axisY); } else { data.setAxisXBottom(null); data.setAxisYLeft(null); } chart.setColumnChartData(data); }
Example 8
Source File: ColumnChartActivity.java From hellocharts-android with Apache License 2.0 | 5 votes |
/** * Generates columns with subcolumns, columns have larger separation than subcolumns. */ private void generateSubcolumnsData() { int numSubcolumns = 4; int numColumns = 4; // Column can have many subcolumns, here I use 4 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())); } Column column = new Column(values); column.setHasLabels(hasLabels); column.setHasLabelsOnlyForSelected(hasLabelForSelected); columns.add(column); } data = new ColumnChartData(columns); if (hasAxes) { Axis axisX = new Axis(); Axis axisY = new Axis().setHasLines(true); if (hasAxesNames) { axisX.setName("Axis X"); axisY.setName("Axis Y"); } data.setAxisXBottom(axisX); data.setAxisYLeft(axisY); } else { data.setAxisXBottom(null); data.setAxisYLeft(null); } chart.setColumnChartData(data); }
Example 9
Source File: ColumnChartActivity.java From hellocharts-android with Apache License 2.0 | 5 votes |
private void generateNegativeSubcolumnsData() { int numSubcolumns = 4; int numColumns = 4; 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) { int sign = getSign(); values.add(new SubcolumnValue((float) Math.random() * 50f * sign + 5 * sign, ChartUtils.pickColor ())); } Column column = new Column(values); column.setHasLabels(hasLabels); column.setHasLabelsOnlyForSelected(hasLabelForSelected); columns.add(column); } data = new ColumnChartData(columns); if (hasAxes) { Axis axisX = new Axis(); Axis axisY = new Axis().setHasLines(true); if (hasAxesNames) { axisX.setName("Axis X"); axisY.setName("Axis Y"); } data.setAxisXBottom(axisX); data.setAxisYLeft(axisY); } else { data.setAxisXBottom(null); data.setAxisYLeft(null); } chart.setColumnChartData(data); }
Example 10
Source File: IOBCOBBarGraph.java From HAPP with GNU General Public License v3.0 | 4 votes |
public ColumnChartData iobcobFutureChart() { Log.d(TAG, "iobcobFutureChart: START"); if (!statList.isEmpty()) { List<Column> columnsData = new ArrayList<>(); List<SubcolumnValue> values; List<AxisValue> xAxisValues = new ArrayList<AxisValue>(); try { for (int v = 0; v < statList.size(); v++) { values = new ArrayList<>(); //IOB if (statList.get(v).getIob() > yIOBMax) { values.add(new SubcolumnValue((float) (fitIOB2COBRange(yIOBMax.floatValue())), ChartUtils.COLOR_BLUE)); } else if (statList.get(v).getIob() < yIOBMin) { values.add(new SubcolumnValue((float) (fitIOB2COBRange(yIOBMin.floatValue())), ChartUtils.COLOR_BLUE)); } else { values.add(new SubcolumnValue((float) (fitIOB2COBRange(statList.get(v).getIob())), ChartUtils.COLOR_BLUE)); } //COB if (statList.get(v).getCob() > yCOBMax) { values.add(new SubcolumnValue((float) (yCOBMax.floatValue()), ChartUtils.COLOR_ORANGE)); } else { values.add(new SubcolumnValue((float) (statList.get(v).getCob()), ChartUtils.COLOR_ORANGE)); } Column column = new Column(values); column.setHasLabels(false); columnsData.add(column); AxisValue axisValue = new AxisValue(v); axisValue.setLabel(statList.get(v).when); xAxisValues.add(axisValue); //xAxisValues. add(new AxisValue((long)0, iobcobValues.getJSONObject(v).getString("when"))); } } catch (Exception e) { Crashlytics.logException(e); } columnData = new ColumnChartData(columnsData); Axis axisX = new Axis(xAxisValues).setHasLines(true); //columnData.setAxisYLeft(ycobiobAxis()); columnData.setAxisYLeft(iobPastyAxis()); columnData.setAxisYRight(cobPastyAxis()); columnData.setAxisXBottom(axisX); Log.d(TAG, "iobcobFutureChart: FINISH"); return columnData; } else{ Log.d(TAG, "iobcobFutureChart: FINISH EMPTY REPLY"); return new ColumnChartData(); //empty } }
Example 11
Source File: ColumnChartActivity.java From hellocharts-android with Apache License 2.0 | 4 votes |
/** * Generates columns with stacked subcolumns. */ private void generateStackedData() { int numSubcolumns = 4; int numColumns = 8; // Column can have many stacked subcolumns, here I use 4 stacke subcolumn in each of 4 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() * 20f + 5, ChartUtils.pickColor())); } Column column = new Column(values); column.setHasLabels(hasLabels); column.setHasLabelsOnlyForSelected(hasLabelForSelected); columns.add(column); } data = new ColumnChartData(columns); // Set stacked flag. data.setStacked(true); if (hasAxes) { Axis axisX = new Axis(); Axis axisY = new Axis().setHasLines(true); if (hasAxesNames) { axisX.setName("Axis X"); axisY.setName("Axis Y"); } data.setAxisXBottom(axisX); data.setAxisYLeft(axisY); } else { data.setAxisXBottom(null); data.setAxisYLeft(null); } chart.setColumnChartData(data); }
Example 12
Source File: ColumnChartActivity.java From hellocharts-android with Apache License 2.0 | 4 votes |
private void generateNegativeStackedData() { int numSubcolumns = 4; int numColumns = 8; // Column can have many stacked subcolumns, here I use 4 stacke subcolumn in each of 4 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) { int sign = getSign(); values.add(new SubcolumnValue((float) Math.random() * 20f * sign + 5 * sign, ChartUtils.pickColor())); } Column column = new Column(values); column.setHasLabels(hasLabels); column.setHasLabelsOnlyForSelected(hasLabelForSelected); columns.add(column); } data = new ColumnChartData(columns); // Set stacked flag. data.setStacked(true); if (hasAxes) { Axis axisX = new Axis(); Axis axisY = new Axis().setHasLines(true); if (hasAxesNames) { axisX.setName("Axis X"); axisY.setName("Axis Y"); } data.setAxisXBottom(axisX); data.setAxisYLeft(axisY); } else { data.setAxisXBottom(null); data.setAxisYLeft(null); } chart.setColumnChartData(data); }
Example 13
Source File: LineColumnDependencyActivity.java From hellocharts-android with Apache License 2.0 | 4 votes |
private void generateColumnData() { int numSubcolumns = 1; int numColumns = months.length; List<AxisValue> axisValues = new ArrayList<AxisValue>(); 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())); } axisValues.add(new AxisValue(i).setLabel(months[i])); columns.add(new Column(values).setHasLabelsOnlyForSelected(true)); } columnData = new ColumnChartData(columns); columnData.setAxisXBottom(new Axis(axisValues).setHasLines(true)); columnData.setAxisYLeft(new Axis().setHasLines(true).setMaxLabelChars(2)); chartBottom.setColumnChartData(columnData); // Set value touch listener that will trigger changes for chartTop. chartBottom.setOnValueTouchListener(new ValueTouchListener()); // Set selection mode to keep selected month column highlighted. chartBottom.setValueSelectionEnabled(true); chartBottom.setZoomType(ZoomType.HORIZONTAL); // chartBottom.setOnClickListener(new View.OnClickListener() { // // @Override // public void onClick(View v) { // SelectedValue sv = chartBottom.getSelectedValue(); // if (!sv.isSet()) { // generateInitialLineData(); // } // // } // }); }