本文整理汇总了Java中lecho.lib.hellocharts.model.AxisValue类的典型用法代码示例。如果您正苦于以下问题:Java AxisValue类的具体用法?Java AxisValue怎么用?Java AxisValue使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AxisValue类属于lecho.lib.hellocharts.model包,在下文中一共展示了AxisValue类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getTargetLine
import lecho.lib.hellocharts.model.AxisValue; //导入依赖的package包/类
private Line getTargetLine() {
if (!needDrawTargetLine()) {
return null;
}
PointValue lastRecordPoint = (PointValue) this.mPointValues.get(this.mPointValues.size()
- 1);
PointValue targetPoint = new PointValue(((AxisValue) this.mAxisValues.get(this
.mAxisValues.size() - 1)).getValue(), this.mTargetWeight);
List<PointValue> points = new ArrayList();
points.add(lastRecordPoint);
points.add(targetPoint);
Line line = new Line(points);
line.setColor(this.resources.getColor(R.color.da));
line.setPathEffect(new DashPathEffect(new float[]{15.0f, 15.0f, 15.0f, 15.0f}, 0.0f));
line.setHasLabels(false);
if (this.mTypeMode > 0) {
line.setHasPoints(false);
return line;
}
line.setHasPoints(true);
return line;
}
示例2: getXals
import lecho.lib.hellocharts.model.AxisValue; //导入依赖的package包/类
private List<AxisValue> getXals() {
List<AxisValue> axisValues = new ArrayList();
String endDate = this.mEndDate;
if (needDrawTargetLine()) {
endDate = this.mTargetDate;
}
ArrayList<String> xVals = DateFormatUtils.getEveryMonthDay(this.mBeginDate, endDate);
if (xVals == null) {
return null;
}
int size = xVals.size();
int i = 0;
while (i < size) {
if (this.mHasLabelMaps == null || !this.mHasLabelMaps.containsKey(Integer.valueOf(i))) {
axisValues.add(new AxisValue((float) i, ((String) xVals.get(i)).toCharArray()));
} else {
axisValues.add(new AxisValue((float) i, ((String) xVals.get(i)).toCharArray(),
this.mHasLabelMaps.get(Integer.valueOf(i))));
}
i++;
}
this.mHasLabelMaps.clear();
return axisValues;
}
示例3: xAxis
import lecho.lib.hellocharts.model.AxisValue; //导入依赖的package包/类
@NonNull
private Axis xAxis() {
List<AxisValue> axisValues = new ArrayList<AxisValue>();
final java.text.DateFormat timeFormat = hourFormat();
timeFormat.setTimeZone(TimeZone.getDefault());
GregorianCalendar calendar = new GregorianCalendar();
calendar.setTimeInMillis(start_time);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.SECOND, 0);
calendar.set(Calendar.MILLISECOND, 0);
if (calendar.getTimeInMillis()<start_time){
calendar.add(Calendar.HOUR, 1);
}
while (calendar.getTimeInMillis()<end_time){
axisValues.add(new AxisValue((calendar.getTimeInMillis() / FUZZER), (timeFormat.format(calendar.getTimeInMillis())).toCharArray()));
calendar.add(Calendar.HOUR, 1);
}
Axis axis = new Axis();
axis.setValues(axisValues);
axis.setHasLines(true);
return axis;
}
示例4: initLineChart
import lecho.lib.hellocharts.model.AxisValue; //导入依赖的package包/类
private void initLineChart() {
//横坐标
Axis axis_X = new Axis();
axis_X.setTextColor(Color.BLUE);
axis_X.setMaxLabelChars(2);
List<AxisValue> axisValues = new ArrayList<>();
for (int i = 0; i < 10; ++i) {
axisValues.add(new AxisValue(i).setLabel("" + i));
}
axis_X.setValues(axisValues);
lineChartData.setAxisXBottom(axis_X);
//纵坐标
Axis axis_Y = new Axis();
axis_Y.setTextColor(Color.BLUE);
axis_Y.setMaxLabelChars(4);
// List<AxisValue> axisValues_Y = new ArrayList<>();
// for (int i = 0; i < 15; ++i) {
// axisValues_Y.add(new AxisValue(i * 10).setLabel("" + (i * 10)));
// }
// axis_Y.setValues(axisValues_Y);
lineChartData.setAxisYLeft(axis_Y);
}
示例5: setUpChartLine
import lecho.lib.hellocharts.model.AxisValue; //导入依赖的package包/类
private void setUpChartLine() {
List<PointValue> chartPoints = getChartPoints();
List<AxisValue> chartAxisPoints = getChartAxisPoints();
Line chartLine = new Line(chartPoints)
.setColor(getResources().getColor(R.color.background_primary_dark))
.setCubic(true)
.setHasPoints(false);
LineChartData chartData = new LineChartData()
.setLines(Collections.singletonList(chartLine));
chartData.setAxisXBottom(new Axis()
.setValues(chartAxisPoints));
chartData.setAxisYLeft(new Axis()
.setHasLines(true));
chart.setLineChartData(chartData);
}
示例6: getChartAxisPoints
import lecho.lib.hellocharts.model.AxisValue; //导入依赖的package包/类
private List<AxisValue> getChartAxisPoints() {
List<AxisValue> chartAxisPoints = new ArrayList<>();
for (int metricDataPoint = 0; metricDataPoint < metricBucket.size();
metricDataPoint += Defaults.AXIS_INTERVAL) {
float chartAxisPointHorizontal = metricDataPoint;
String chartAxisPointLabel;
switch (timeMenu) {
case R.id.menu_time_hour:
case R.id.menu_time_day:
chartAxisPointLabel = Formatter.formatTime(metricBucket.get(metricDataPoint).getStart());
break;
case R.id.menu_time_week:
case R.id.menu_time_month:
case R.id.menu_time_year:
default:
chartAxisPointLabel = Formatter.formatDate(metricBucket.get(metricDataPoint).getEnd());
}
chartAxisPoints.add(new AxisValue(chartAxisPointHorizontal)
.setLabel(chartAxisPointLabel));
}
return chartAxisPoints;
}
示例7: setUpChartLine
import lecho.lib.hellocharts.model.AxisValue; //导入依赖的package包/类
private void setUpChartLine() {
List<PointValue> chartPoints = getChartPoints();
List<AxisValue> chartAxisPoints = getChartAxisPoints();
Line chartLine = new Line(chartPoints)
.setColor(getResources().getColor(R.color.background_primary_dark))
.setCubic(true)
.setHasPoints(false);
LineChartData chartData = new LineChartData()
.setLines(Collections.singletonList(chartLine));
chartData.setAxisXBottom(new Axis()
.setValues(chartAxisPoints));
chartData.setAxisYLeft(new Axis()
.setHasLines(true));
chart.setLineChartData(chartData);
}
示例8: basalVsTempBasalyAxis
import lecho.lib.hellocharts.model.AxisValue; //导入依赖的package包/类
public Axis basalVsTempBasalyAxis() {
Axis yAxis = new Axis();
yAxis.setAutoGenerated(false);
List<AxisValue> axisValues = new ArrayList<>();
for(double j = -maxBasal.intValue(); j <= maxBasal.intValue(); j += 1) {
//axisValues.add(new AxisValue((float)fitIOB2COBRange(j)));
AxisValue value = new AxisValue((float)j);
if (j==0){
value.setLabel("Basal");
} else if (j>0){
value.setLabel("+" + String.valueOf(j) + "u");
} else {
value.setLabel(String.valueOf(j) + "u");
}
axisValues.add(value);
}
yAxis.setValues(axisValues);
yAxis.setHasLines(true);
yAxis.setMaxLabelChars(5);
yAxis.setInside(true);
return yAxis;
}
示例9: iobPastyAxis
import lecho.lib.hellocharts.model.AxisValue; //导入依赖的package包/类
public Axis iobPastyAxis() {
Axis yAxis = new Axis();
yAxis.setAutoGenerated(false);
List<AxisValue> axisValues = new ArrayList<AxisValue>();
for(int j = 1; j <= 8; j += 1) {
//axisValues.add(new AxisValue((float)fitIOB2COBRange(j)));
AxisValue value = new AxisValue(j*10);
value.setLabel(String.valueOf(j*2) + "u");
axisValues.add(value);
}
yAxis.setTextColor(ChartUtils.COLOR_BLUE);
yAxis.setValues(axisValues);
yAxis.setHasLines(true);
yAxis.setMaxLabelChars(5);
yAxis.setInside(true);
return yAxis;
}
示例10: cobPastyAxis
import lecho.lib.hellocharts.model.AxisValue; //导入依赖的package包/类
public Axis cobPastyAxis() {
Axis yAxis = new Axis();
yAxis.setAutoGenerated(false);
List<AxisValue> axisValues = new ArrayList<AxisValue>();
for(int j = 1; j <= 8; j += 1) {
AxisValue value = new AxisValue(j*10);
value.setLabel(String.valueOf(j*10) + "g");
axisValues.add(value);
}
yAxis.setTextColor(ChartUtils.COLOR_ORANGE);
yAxis.setValues(axisValues);
yAxis.setHasLines(true);
yAxis.setMaxLabelChars(5);
yAxis.setInside(true);
return yAxis;
}
示例11: addSerieToBarChart
import lecho.lib.hellocharts.model.AxisValue; //导入依赖的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);
}
}
示例12: setupChart
import lecho.lib.hellocharts.model.AxisValue; //导入依赖的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);
}
}
示例13: populateMeetingDurationChart
import lecho.lib.hellocharts.model.AxisValue; //导入依赖的package包/类
public static void populateMeetingDurationChart(Context context, LineChartView chart, @NonNull Cursor cursor) {
List<PointValue> points = new ArrayList<>();
List<AxisValue> xAxisValues = new ArrayList<>();
MeetingCursorWrapper cursorWrapper = new MeetingCursorWrapper(cursor);
while (cursorWrapper.moveToNext()) {
Meeting meeting = Meeting.read(context, cursorWrapper);
points.add(getMeetingDurationPointValue(meeting));
xAxisValues.add(getMeetingDurationXAxisValue(context, meeting));
}
cursor.moveToPosition(-1);
int lineColor = ResourcesCompat.getColor(context.getResources(), R.color.scrum_chatter_primary_color, null);
Line line = new Line(points);
line.setColor(lineColor);
List<Line> lines = new ArrayList<>();
lines.add(line);
LineChartData lineChartData = new LineChartData();
lineChartData.setLines(lines);
setupChart(context,
chart,
xAxisValues,
context.getString(R.string.chart_duration),
lines);
}
示例14: generateInitialLineData
import lecho.lib.hellocharts.model.AxisValue; //导入依赖的package包/类
/**
* Generates initial data for line chart. At the begining all Y values are equals 0. That will change when user
* will select value on column chart.
*/
private void generateInitialLineData() {
int numValues = 7;
List<AxisValue> axisValues = new ArrayList<AxisValue>();
List<PointValue> values = new ArrayList<PointValue>();
for (int i = 0; i < numValues; ++i) {
values.add(new PointValue(i, 0));
axisValues.add(new AxisValue(i).setLabel(days[i]));
}
Line line = new Line(values);
line.setColor(ChartUtils.COLOR_GREEN).setCubic(true);
List<Line> lines = new ArrayList<Line>();
lines.add(line);
lineData = new LineChartData(lines);
lineData.setAxisXBottom(new Axis(axisValues).setHasLines(true));
lineData.setAxisYLeft(new Axis().setHasLines(true).setMaxLabelChars(3));
chartTop.setLineChartData(lineData);
// For build-up animation you have to disable viewport recalculation.
chartTop.setViewportCalculationEnabled(false);
// And set initial max viewport and current viewport- remember to set viewports after data.
Viewport v = new Viewport(0, 110, 6, 0);
chartTop.setMaximumViewport(v);
chartTop.setCurrentViewport(v);
chartTop.setZoomType(ZoomType.HORIZONTAL);
}
示例15: getXals
import lecho.lib.hellocharts.model.AxisValue; //导入依赖的package包/类
private List<AxisValue> getXals() {
List<AxisValue> axisValues = new ArrayList();
ArrayList<String> xVals = DateFormatUtils.getEveryMonthDay(this.mBeginDate, this.mEndDate);
if (xVals == null) {
return null;
}
int size = xVals.size();
for (int i = 0; i < size; i++) {
axisValues.add(new AxisValue((float) i, ((String) xVals.get(i)).toCharArray()));
}
return axisValues;
}