本文整理汇总了Java中lecho.lib.hellocharts.model.AxisValue.setLabel方法的典型用法代码示例。如果您正苦于以下问题:Java AxisValue.setLabel方法的具体用法?Java AxisValue.setLabel怎么用?Java AxisValue.setLabel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lecho.lib.hellocharts.model.AxisValue
的用法示例。
在下文中一共展示了AxisValue.setLabel方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
示例2: 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;
}
示例3: 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;
}
示例4: getXAxisValues
import lecho.lib.hellocharts.model.AxisValue; //导入方法依赖的package包/类
@Override
protected List<AxisValue> getXAxisValues() {
List<AxisValue> values = new ArrayList<>();
for (int i = 0; i < COLUMN_COUNT; i++) {
AxisValue value = new AxisValue(i);
if (i % 4 == 0) {
value.setLabel(i + ":00");
values.add(value);
}
}
return values;
}
示例5: getXAxisValues
import lecho.lib.hellocharts.model.AxisValue; //导入方法依赖的package包/类
@Override
protected List<AxisValue> getXAxisValues() {
List<AxisValue> values = new ArrayList<>();
for (int i = 1; i <= columnCount; i++) {
AxisValue value = new AxisValue(i);
if (i % 5 == 0) {
value.setLabel(Integer.toString(i) + "");
values.add(value);
}
}
return values;
}
示例6: generateLineChartData
import lecho.lib.hellocharts.model.AxisValue; //导入方法依赖的package包/类
private LineChartData generateLineChartData(@NonNull List<FillUp> fillUps) {
List<PointValue> values = new ArrayList<>();
List<AxisValue> axisValues = new ArrayList<>();
long oldestFillUpTime = 0;
long latestFillUpTime = 0;
for (int x = 0; x < fillUps.size(); ++x) {
FillUp dataItem = fillUps.get(x);
BigDecimal consumption = dataItem.getFuelConsumption();
if (consumption != null) {
latestFillUpTime = dataItem.getDate().getTime();
String formattedRecordedAt = DateUtil.getDateLocalized(dataItem.getDate());
if (oldestFillUpTime == 0) {
oldestFillUpTime = latestFillUpTime;
}
values.add(new PointValue(latestFillUpTime - oldestFillUpTime, consumption.floatValue()));
AxisValue axisValue = new AxisValue(latestFillUpTime - oldestFillUpTime);
axisValue.setLabel(formattedRecordedAt);
axisValues.add(axisValue);
}
}
Line line = new Line(values)
.setColor(getContext().getResources().getColor(R.color.colorLightGrey))
.setPointColor(getContext().getResources().getColor(R.color.colorPrimary));
List<Line> lines = new ArrayList<>(2);
lines.add(line);
BigDecimal averageConsumption = new StatisticsService(getContext(), vehicleId).getAverageConsumption();
if (averageConsumption != null) {
List<PointValue> averageLineValues = new ArrayList<>(2);
averageLineValues.add(new PointValue(0, averageConsumption.floatValue()));
averageLineValues.add(new PointValue(latestFillUpTime - oldestFillUpTime, averageConsumption.floatValue()));
Line averageLine = new Line(averageLineValues);
averageLine.setColor(getContext().getResources().getColor(R.color.colorAccent));
averageLine.setHasPoints(false).setHasLabels(true);
lines.add(averageLine);
}
LineChartData data = new LineChartData(lines);
data.setAxisXBottom(new Axis(axisValues)
.setMaxLabelChars(10).setHasTiltedLabels(true));
data.setAxisYLeft(new Axis()
.setName(getContext().getString(R.string.statistics_fuel_consumption))
.setHasLines(true));
return data;
}
示例7: generateLineChartData
import lecho.lib.hellocharts.model.AxisValue; //导入方法依赖的package包/类
private LineChartData generateLineChartData(@NonNull List<FillUp> fillUps) {
List<PointValue> values = new ArrayList<>();
List<AxisValue> axisValues = new ArrayList<>();
long oldestFillUpTime = 0;
long latestFillUpTime = 0;
for (int x = 0; x < fillUps.size(); ++x) {
FillUp dataItem = fillUps.get(x);
latestFillUpTime = dataItem.getDate().getTime();
String formattedRecordedAt = DateUtil.getDateLocalized(dataItem.getDate());
if (oldestFillUpTime == 0) {
oldestFillUpTime = latestFillUpTime;
}
values.add(new PointValue(latestFillUpTime - oldestFillUpTime, dataItem.getFuelPricePerLitre().floatValue()));
AxisValue axisValue = new AxisValue(latestFillUpTime - oldestFillUpTime);
axisValue.setLabel(formattedRecordedAt);
axisValues.add(axisValue);
}
Line line = new Line(values)
.setColor(getContext().getResources().getColor(R.color.colorLightGrey))
.setPointColor(getContext().getResources().getColor(R.color.colorPrimary));
List<Line> lines = new ArrayList<>(2);
lines.add(line);
BigDecimal averagePrice = new StatisticsService(getContext(), vehicleId).getFuelUnitPriceAverage();
List<PointValue> averageLineValues = new ArrayList<>(2);
averageLineValues.add(new PointValue(0, averagePrice.floatValue()));
averageLineValues.add(new PointValue(latestFillUpTime - oldestFillUpTime, averagePrice.floatValue()));
Line averageLine = new Line(averageLineValues);
averageLine.setColor(getContext().getResources().getColor(R.color.colorAccent));
averageLine.setHasPoints(false).setHasLabels(true);
lines.add(averageLine);
LineChartData data = new LineChartData(lines);
data.setAxisXBottom(new Axis(axisValues)
.setMaxLabelChars(10).setHasTiltedLabels(true));
data.setAxisYLeft(new Axis()
.setName(getContext().getString(R.string.statistics_fuel_price))
.setHasLines(true));
return data;
}
示例8: updateChart
import lecho.lib.hellocharts.model.AxisValue; //导入方法依赖的package包/类
private void updateChart(Cursor data) {
List<AxisValue> axisValuesX = new ArrayList<>();
List<PointValue> pointValues = new ArrayList<>();
int counter = -1;
do {
counter++;
String date = data.getString(data.getColumnIndex(
QuoteHistoricalDataColumns.DATE));
String bidPrice = data.getString(data.getColumnIndex(
QuoteHistoricalDataColumns.BIDPRICE));
// We have to show chart in right order.
int x = data.getCount() - 1 - counter;
// Point for line chart (date, price).
PointValue pointValue = new PointValue(x, Float.valueOf(bidPrice));
pointValue.setLabel(date);
pointValues.add(pointValue);
// Set labels for x-axis (we have to reduce its number to avoid overlapping text).
if (counter != 0 && counter % (data.getCount() / 3) == 0) {
AxisValue axisValueX = new AxisValue(x);
axisValueX.setLabel(date);
axisValuesX.add(axisValueX);
}
} while (data.moveToNext());
// Prepare data for chart
Line line = new Line(pointValues).setColor(Color.WHITE).setCubic(false);
List<Line> lines = new ArrayList<>();
lines.add(line);
LineChartData lineChartData = new LineChartData();
lineChartData.setLines(lines);
// Init x-axis
Axis axisX = new Axis(axisValuesX);
axisX.setHasLines(true);
axisX.setMaxLabelChars(4);
lineChartData.setAxisXBottom(axisX);
// Init y-axis
Axis axisY = new Axis();
axisY.setAutoGenerated(true);
axisY.setHasLines(true);
axisY.setMaxLabelChars(4);
lineChartData.setAxisYLeft(axisY);
// Update chart with new data.
mChart.setInteractive(false);
mChart.setLineChartData(lineChartData);
// Show chart
mChart.setVisibility(View.VISIBLE);
mTabContent.setVisibility(View.VISIBLE);
}
示例9: iobcobFutureChart
import lecho.lib.hellocharts.model.AxisValue; //导入方法依赖的package包/类
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
}
}
示例10: getMeetingDurationXAxisValue
import lecho.lib.hellocharts.model.AxisValue; //导入方法依赖的package包/类
private static AxisValue getMeetingDurationXAxisValue(Context context, Meeting meeting) {
AxisValue xAxisValue = new AxisValue(meeting.getStartDate());
String dateString = TextUtils.formatDate(context, meeting.getStartDate());
xAxisValue.setLabel(dateString);
return xAxisValue;
}
示例11: populateMeeting
import lecho.lib.hellocharts.model.AxisValue; //导入方法依赖的package包/类
public static void populateMeeting(Context context, ColumnChartView chart, @NonNull Cursor cursor) {
List<AxisValue> xAxisValues = new ArrayList<>();
List<Column> columns = new ArrayList<>();
MeetingMemberCursorWrapper cursorWrapper = new MeetingMemberCursorWrapper(cursor);
int maxLabelLength = 0;
while (cursorWrapper.moveToNext()) {
List<SubcolumnValue> subcolumnValues = new ArrayList<>();
Column column = new Column(subcolumnValues);
Long memberId = cursorWrapper.getMemberId();
String memberName = cursorWrapper.getMemberName();
float durationInMinutes = (float) cursorWrapper.getDuration() / 60;
String durationLabel = DateUtils.formatElapsedTime(cursorWrapper.getDuration());
SubcolumnValue subcolumnValue = new SubcolumnValue();
subcolumnValue.setValue(durationInMinutes);
subcolumnValue.setLabel(durationLabel);
int color = ChartUtils.getMemberColor(context, memberId);
subcolumnValue.setColor(color);
subcolumnValues.add(subcolumnValue);
column.setHasLabels(true);
column.setValues(subcolumnValues);
columns.add(column);
AxisValue xAxisValue = new AxisValue(xAxisValues.size());
xAxisValue.setLabel(memberName);
xAxisValues.add(xAxisValue);
if (memberName.length() > maxLabelLength) maxLabelLength = memberName.length();
}
cursor.moveToPosition(-1);
Axis xAxis = new Axis(xAxisValues);
xAxis.setAutoGenerated(false);
//xAxis.setMaxLabelChars(maxLabelLength);
xAxis.setTextColor(ResourcesCompat.getColor(context.getResources(), R.color.chart_text, null));
xAxis.setHasTiltedLabels(true);
ColumnChartData data = new ColumnChartData();
data.setAxisXBottom(xAxis);
data.setColumns(columns);
chart.setInteractive(true);
chart.setColumnChartData(data);
chart.setZoomEnabled(true);
chart.setZoomType(ZoomType.HORIZONTAL);
}