本文整理汇总了Java中lecho.lib.hellocharts.model.Axis.setValues方法的典型用法代码示例。如果您正苦于以下问题:Java Axis.setValues方法的具体用法?Java Axis.setValues怎么用?Java Axis.setValues使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lecho.lib.hellocharts.model.Axis
的用法示例。
在下文中一共展示了Axis.setValues方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: xAxis
import lecho.lib.hellocharts.model.Axis; //导入方法依赖的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;
}
示例2: initLineChart
import lecho.lib.hellocharts.model.Axis; //导入方法依赖的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);
}
示例3: basalVsTempBasalyAxis
import lecho.lib.hellocharts.model.Axis; //导入方法依赖的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;
}
示例4: iobPastyAxis
import lecho.lib.hellocharts.model.Axis; //导入方法依赖的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;
}
示例5: cobPastyAxis
import lecho.lib.hellocharts.model.Axis; //导入方法依赖的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;
}
示例6: setAxis
import lecho.lib.hellocharts.model.Axis; //导入方法依赖的package包/类
/**
* Sets the properties of the X and Y axis of the chart.
*/
private void setAxis(ColumnChartView mChart, HRVParameterEnum hrvValue) {
ColumnChartData data = new ColumnChartData(new ArrayList<>(Arrays.asList(columns)));
Axis axisX = new Axis();
Axis axisY = new Axis().setHasLines(true);
axisX.setName(getXAxisLabel());
axisX.setValues(getXAxisValues());
axisY.setName(getUnit(hrvValue));
data.setAxisXBottom(axisX);
data.setAxisYLeft(axisY);
mChart.setZoomEnabled(false);
mChart.setColumnChartData(data);
}
示例7: previewXAxis
import lecho.lib.hellocharts.model.Axis; //导入方法依赖的package包/类
public Axis previewXAxis(){
List<AxisValue> previewXaxisValues = new ArrayList<AxisValue>();
final java.text.DateFormat timeFormat = hourFormat();
timeFormat.setTimeZone(TimeZone.getDefault());
for(int l=0; l<=24; l+=hoursPreviewStep) {
double timestamp = (endHour - (60000 * 60 * l));
previewXaxisValues.add(new AxisValue((long)(timestamp/fuzz), (timeFormat.format(timestamp)).toCharArray()));
}
Axis previewXaxis = new Axis();
previewXaxis.setValues(previewXaxisValues);
previewXaxis.setHasLines(true);
previewXaxis.setTextSize(previewAxisTextSize);
return previewXaxis;
}
示例8: previewXAxis
import lecho.lib.hellocharts.model.Axis; //导入方法依赖的package包/类
public Axis previewXAxis() {
List<AxisValue> previewXaxisValues = new ArrayList<AxisValue>();
//final java.text.DateFormat timeFormat = hourFormat();
//timeFormat.setTimeZone(TimeZone.getDefault());
for (int l = 0; l <= 26; l += hoursPreviewStep) { //Added 2 hours for future readings
double timestamp = (endHour - (60000 * 60 * l));
previewXaxisValues.add(new AxisValue((long) (timestamp), (sdfHour.format(timestamp)).toCharArray()));
}
Axis previewXaxis = new Axis();
previewXaxis.setValues(previewXaxisValues);
previewXaxis.setHasLines(true);
previewXaxis.setTextSize(previewAxisTextSize);
return previewXaxis;
}
示例9: initLineChart
import lecho.lib.hellocharts.model.Axis; //导入方法依赖的package包/类
private void initLineChart() {
Line line = new Line(mPointValues).setColor(Color.parseColor("#FFFAFA")); //折线的颜色(橙色)
List<Line> lines = new ArrayList<>();
line.setShape(ValueShape.CIRCLE);//折线图上每个数据点的形状 这里是圆形 (有三种 :ValueShape.SQUARE ValueShape.CIRCLE ValueShape.DIAMOND)
line.setCubic(false);//曲线是否平滑,即是曲线还是折线
line.setFilled(false);//是否填充曲线的面积
line.setHasLabels(true);//曲线的数据坐标是否加上备注
// line.setHasLabelsOnlyForSelected(true);//点击数据坐标提示数据(设置了这个line.setHasLabels(true);就无效)
line.setHasLines(true);//是否用线显示。如果为false 则没有曲线只有点显示
line.setHasPoints(true);//是否显示圆点 如果为false 则没有原点只有点显示(每个数据点都是个大的圆点)
lines.add(line);
LineChartData data = new LineChartData();
data.setLines(lines);
//坐标轴
Axis axisX = new Axis(); //X轴
axisX.setHasTiltedLabels(true); //X坐标轴字体是斜的显示还是直的,true是斜的显示
axisX.setTextColor(Color.WHITE); //设置字体颜色
//axisX.setName("date"); //表格名称
axisX.setTextSize(10);//设置字体大小
axisX.setMaxLabelChars(8); //最多几个X轴坐标,意思就是你的缩放让X轴上数据的个数7<=x<=mAxisXValues.length
axisX.setValues(mAxisXValues); //填充X轴的坐标名称
data.setAxisXBottom(axisX); //x 轴在底部
//data.setAxisXTop(axisX); //x 轴在顶部
axisX.setHasLines(true); //x 轴分割线
// Y轴是根据数据的大小自动设置Y轴上限(在下面我会给出固定Y轴数据个数的解决方案)
Axis axisY = new Axis();
axisY.setName("");//y轴标注
// axisY.setTextSize(10);//设置字体大小
axisY.setTextColor(Color.parseColor("#ffffff"));
data.setAxisYLeft(axisY); //Y轴设置在左边
//data.setAxisYRight(axisY); //y轴设置在右边
//设置行为属性,支持缩放、滑动以及平移
lineChart.setInteractive(true);
lineChart.setZoomType(ZoomType.HORIZONTAL);
lineChart.setMaxZoom((float) 2);//最大方法比例
lineChart.setContainerScrollEnabled(true, ContainerScrollType.HORIZONTAL);
lineChart.setLineChartData(data);
lineChart.setVisibility(View.VISIBLE);
/**注:下面的7,10只是代表一个数字去类比而已
* 当时是为了解决X轴固定数据个数。见(http://forum.xda-developers.com/tools/programming/library-hellocharts-charting-library-t2904456/page2);
*/
// Viewport v = new Viewport(lineChart.getMaximumViewport());
// v.left = 0;
// v.right= 7;
// lineChart.setCurrentViewport(v);
}
示例10: generateDefaultData
import lecho.lib.hellocharts.model.Axis; //导入方法依赖的package包/类
private void generateDefaultData() {
List<Column> columns = new ArrayList<Column>();
List<SubcolumnValue> values;
values = new ArrayList<SubcolumnValue>();
values.add(new SubcolumnValue(all, ChartUtils.pickColor()));
Column column = new Column(values);
column.setHasLabels(hasLabels);
column.setHasLabelsOnlyForSelected(hasLabelForSelected);
columns.add(column);
values = new ArrayList<SubcolumnValue>();
values.add(new SubcolumnValue(yes, ChartUtils.pickColor()));
Column column2 = new Column(values);
column2.setHasLabels(hasLabels);
column2.setHasLabelsOnlyForSelected(hasLabelForSelected);
columns.add(column2);
values = new ArrayList<SubcolumnValue>();
values.add(new SubcolumnValue(no, ChartUtils.pickColor()));
Column column3 = new Column(values);
column3.setHasLabels(hasLabels);
column3.setHasLabelsOnlyForSelected(hasLabelForSelected);
columns.add(column3);
data = new ColumnChartData(columns);
// 坐标
if (hasAxes) {
Axis axisX = new Axis();
Axis axisY = new Axis().setHasLines(true);
if (hasAxesNames) {
axisY.setName("人数");
ArrayList<AxisValue> axisValuesX = new ArrayList<AxisValue>();
axisValuesX.add(new AxisValue(0).setValue(0).setLabel("总数"));
axisValuesX.add(new AxisValue(1).setValue(1).setLabel("已报到"));
axisValuesX.add(new AxisValue(2).setValue(2).setLabel("未报到"));
axisX.setValues(axisValuesX);//为X轴显示的刻度值设置数据集合
}
data.setAxisXBottom(axisX);
data.setAxisYLeft(axisY);
} else {
data.setAxisXBottom(null);
data.setAxisYLeft(null);
}
chart.setColumnChartData(data);
}
示例11: generateDefaultData
import lecho.lib.hellocharts.model.Axis; //导入方法依赖的package包/类
private void generateDefaultData() {
List<Column> columns = new ArrayList<Column>();
List<SubcolumnValue> values;
values = new ArrayList<SubcolumnValue>();
values.add(new SubcolumnValue(all, ChartUtils.pickColor()));
Column column1 = new Column(values);
column1.setHasLabels(hasLabels);
column1.setHasLabelsOnlyForSelected(hasLabelForSelected);
columns.add(column1);
values = new ArrayList<SubcolumnValue>();
values.add(new SubcolumnValue(yes, ChartUtils.pickColor()));
Column column2 = new Column(values);
column2.setHasLabels(hasLabels);
column2.setHasLabelsOnlyForSelected(hasLabelForSelected);
columns.add(column2);
values = new ArrayList<SubcolumnValue>();
values.add(new SubcolumnValue(no, ChartUtils.pickColor()));
Column column3 = new Column(values);
column3.setHasLabels(hasLabels);
column3.setHasLabelsOnlyForSelected(hasLabelForSelected);
columns.add(column3);
data = new ColumnChartData(columns);
// 坐标
if (hasAxes) {
Axis axisX = new Axis();
Axis axisY = new Axis().setHasLines(true);
if (hasAxesNames) {
axisY.setName("人数");
ArrayList<AxisValue> axisValuesX = new ArrayList<AxisValue>();
axisValuesX.add(new AxisValue(0).setValue(0).setLabel("总人数"));
axisValuesX.add(new AxisValue(1).setValue(1).setLabel("已报到"));
axisValuesX.add(new AxisValue(2).setValue(2).setLabel("未报到"));
axisX.setValues(axisValuesX);
}
data.setAxisXBottom(axisX);
data.setAxisYLeft(axisY);
} else {
data.setAxisXBottom(null);
data.setAxisYLeft(null);
}
chart.setColumnChartData(data);
}
示例12: generateData
import lecho.lib.hellocharts.model.Axis; //导入方法依赖的package包/类
private void generateData() {
List<Column> columns = new ArrayList<Column>();
List<SubcolumnValue> values;
for (int i = 0; i < divisionarry.size(); ++i) {
values = new ArrayList<SubcolumnValue>();
// 全部
//values.add(new SubcolumnValue((float) (reportarry.get(i)+noReportarry.get(i)), ChartUtils.pickColor()));
// 未报到
values.add(new SubcolumnValue((float) noReportarry.get(i), Color.parseColor("#FF4445")));
// 已报到
values.add(new SubcolumnValue((float) reportarry.get(i), Color.parseColor("#9BCC02")));
Column column = new Column(values);
column.setHasLabels(hasLabels);
column.setHasLabelsOnlyForSelected(hasLabelForSelected);
columns.add(column);
}
data = new ColumnChartData(columns);
data.setStacked(true);
// 坐标
if (hasAxes) {
Axis axisX = new Axis();
Axis axisY = new Axis().setHasLines(true);
if (hasAxesNames) {
axisY.setName("人数");
//axisY.setTextColor(Color.parseColor("#3E3E3E"));
ArrayList<AxisValue> axisValuesX = new ArrayList<AxisValue>();
for (int i=0; i<divisionarry.size(); i++) {
if (divisionarry.get(i).equals("国际文化交流学部")) {
axisValuesX.add(new AxisValue(i).setValue(i).setLabel("国交学部"));
} else {
axisValuesX.add(new AxisValue(i).setValue(i).setLabel(divisionarry.get(i)));
}
}
axisX.setTextSize(10);
//axisX.setTextColor(Color.parseColor("#3E3E3E"));
axisX.setValues(axisValuesX);//为X轴显示的刻度值设置数据集合
}
data.setAxisXBottom(axisX);
data.setAxisYLeft(axisY);
} else {
data.setAxisXBottom(null);
data.setAxisYLeft(null);
}
chart.setColumnChartData(data);
}
示例13: generateDefaultData
import lecho.lib.hellocharts.model.Axis; //导入方法依赖的package包/类
private void generateDefaultData() {
List<Column> columns = new ArrayList<>();
List<SubcolumnValue> values;
values = new ArrayList<SubcolumnValue>();
values.add(new SubcolumnValue(all, ChartUtils.pickColor()));
Column column = new Column(values);
column.setHasLabels(hasLabels);
column.setHasLabelsOnlyForSelected(hasLabelForSelected);
columns.add(column);
values = new ArrayList<SubcolumnValue>();
values.add(new SubcolumnValue(yes, ChartUtils.pickColor()));
Column column2 = new Column(values);
column2.setHasLabels(hasLabels);
column2.setHasLabelsOnlyForSelected(hasLabelForSelected);
columns.add(column2);
values = new ArrayList<SubcolumnValue>();
values.add(new SubcolumnValue(no, ChartUtils.pickColor()));
Column column3 = new Column(values);
column3.setHasLabels(hasLabels);
column3.setHasLabelsOnlyForSelected(hasLabelForSelected);
columns.add(column3);
data = new ColumnChartData(columns);
// 坐标
if (hasAxes) {
Axis axisX = new Axis();
Axis axisY = new Axis().setHasLines(true);
if (hasAxesNames) {
axisY.setName("人数");
ArrayList<AxisValue> axisValuesX = new ArrayList<AxisValue>();
axisValuesX.add(new AxisValue(0).setValue(0).setLabel("全部"));
axisValuesX.add(new AxisValue(1).setValue(1).setLabel("已报到"));
axisValuesX.add(new AxisValue(2).setValue(2).setLabel("未报到"));
axisX.setValues(axisValuesX);//为X轴显示的刻度值设置数据集合
}
data.setAxisXBottom(axisX);
data.setAxisYLeft(axisY);
} else {
data.setAxisXBottom(null);
data.setAxisYLeft(null);
}
chart.setColumnChartData(data);
}
示例14: generateDefaultData
import lecho.lib.hellocharts.model.Axis; //导入方法依赖的package包/类
private void generateDefaultData() {
List<Column> columns = new ArrayList<Column>();
List<SubcolumnValue> values;
values = new ArrayList<SubcolumnValue>();
values.add(new SubcolumnValue(all, ChartUtils.pickColor()));
Column column = new Column(values);
column.setHasLabels(hasLabels);
column.setHasLabelsOnlyForSelected(hasLabelForSelected);
columns.add(column);
values = new ArrayList<SubcolumnValue>();
values.add(new SubcolumnValue(yes, ChartUtils.pickColor()));
Column column2 = new Column(values);
column2.setHasLabels(hasLabels);
column2.setHasLabelsOnlyForSelected(hasLabelForSelected);
columns.add(column2);
values = new ArrayList<SubcolumnValue>();
values.add(new SubcolumnValue(no, ChartUtils.pickColor()));
Column column3 = new Column(values);
column3.setHasLabels(hasLabels);
column3.setHasLabelsOnlyForSelected(hasLabelForSelected);
columns.add(column3);
values = new ArrayList<SubcolumnValue>();
values.add(new SubcolumnValue(loan, ChartUtils.pickColor()));
Column column4 = new Column(values);
column4.setHasLabels(hasLabels);
column4.setHasLabelsOnlyForSelected(hasLabelForSelected);
columns.add(column4);
values = new ArrayList<SubcolumnValue>();
values.add(new SubcolumnValue(late, ChartUtils.pickColor()));
Column column5 = new Column(values);
column5.setHasLabels(hasLabels);
column5.setHasLabelsOnlyForSelected(hasLabelForSelected);
columns.add(column5);
data = new ColumnChartData(columns);
// 坐标
if (hasAxes) {
Axis axisX = new Axis();
Axis axisY = new Axis().setHasLines(true);
if (hasAxesNames) {
axisY.setName("人数");
ArrayList<AxisValue> axisValuesX = new ArrayList<AxisValue>();
axisValuesX.add(new AxisValue(0).setValue(0).setLabel("总数"));
axisValuesX.add(new AxisValue(1).setValue(1).setLabel(this.pay));
axisValuesX.add(new AxisValue(2).setValue(2).setLabel(this.notPay));
axisValuesX.add(new AxisValue(3).setValue(3).setLabel(this.loadPay));
axisValuesX.add(new AxisValue(4).setValue(4).setLabel(this.latePay));
axisX.setValues(axisValuesX);//为X轴显示的刻度值设置数据集合
}
data.setAxisXBottom(axisX);
data.setAxisYLeft(axisY);
} else {
data.setAxisXBottom(null);
data.setAxisYLeft(null);
}
chart.setColumnChartData(data);
}