本文整理汇总了Java中lecho.lib.hellocharts.model.Axis类的典型用法代码示例。如果您正苦于以下问题:Java Axis类的具体用法?Java Axis怎么用?Java Axis使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Axis类属于lecho.lib.hellocharts.model包,在下文中一共展示了Axis类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initAxisPaints
import lecho.lib.hellocharts.model.Axis; //导入依赖的package包/类
private void initAxisPaints(Axis axis, int position) {
Typeface typeface = axis.getTypeface();
if (null != typeface) {
labelPaintTab[position].setTypeface(typeface);
namePaintTab[position].setTypeface(typeface);
}
labelPaintTab[position].setColor(axis.getTextColor());
labelPaintTab[position].setTextSize(ChartUtils.sp2px(scaledDensity, axis.getTextSize()));
labelPaintTab[position].getFontMetricsInt(fontMetricsTab[position]);
namePaintTab[position].setColor(axis.getTextColor());
namePaintTab[position].setTextSize(ChartUtils.sp2px(scaledDensity, axis.getTextSize()));
linePaintTab[position].setColor(axis.getLineColor());
labelTextAscentTab[position] = Math.abs(fontMetricsTab[position].ascent);
labelTextDescentTab[position] = Math.abs(fontMetricsTab[position].descent);
labelWidthTab[position] = (int) labelPaintTab[position].measureText(labelWidthChars, 0,
axis.getMaxLabelChars());
}
示例2: initAxisTextAlignment
import lecho.lib.hellocharts.model.Axis; //导入依赖的package包/类
private void initAxisTextAlignment(Axis axis, int position) {
namePaintTab[position].setTextAlign(Align.CENTER);
if (TOP == position || BOTTOM == position) {
labelPaintTab[position].setTextAlign(Align.CENTER);
} else if (LEFT == position) {
if (axis.isInside()) {
labelPaintTab[position].setTextAlign(Align.LEFT);
} else {
labelPaintTab[position].setTextAlign(Align.RIGHT);
}
} else if (RIGHT == position) {
if (axis.isInside()) {
labelPaintTab[position].setTextAlign(Align.RIGHT);
} else {
labelPaintTab[position].setTextAlign(Align.LEFT);
}
}
}
示例3: drawInBackground
import lecho.lib.hellocharts.model.Axis; //导入依赖的package包/类
/**
* Prepare axes coordinates and draw axes lines(if enabled) in the background.
*
* @param canvas
*/
public void drawInBackground(Canvas canvas) {
Axis axis = chart.getChartData().getAxisYLeft();
if (null != axis) {
prepareAxisToDraw(axis, LEFT);
drawAxisLines(canvas, axis, LEFT);
}
axis = chart.getChartData().getAxisYRight();
if (null != axis) {
prepareAxisToDraw(axis, RIGHT);
drawAxisLines(canvas, axis, RIGHT);
}
axis = chart.getChartData().getAxisXBottom();
if (null != axis) {
prepareAxisToDraw(axis, BOTTOM);
drawAxisLines(canvas, axis, BOTTOM);
}
axis = chart.getChartData().getAxisXTop();
if (null != axis) {
prepareAxisToDraw(axis, TOP);
drawAxisLines(canvas, axis, TOP);
}
}
示例4: drawInForeground
import lecho.lib.hellocharts.model.Axis; //导入依赖的package包/类
/**
* Draw axes labels and names in the foreground.
*
* @param canvas
*/
public void drawInForeground(Canvas canvas) {
Axis axis = chart.getChartData().getAxisYLeft();
if (null != axis) {
drawAxisLabelsAndName(canvas, axis, LEFT);
}
axis = chart.getChartData().getAxisYRight();
if (null != axis) {
drawAxisLabelsAndName(canvas, axis, RIGHT);
}
axis = chart.getChartData().getAxisXBottom();
if (null != axis) {
drawAxisLabelsAndName(canvas, axis, BOTTOM);
}
axis = chart.getChartData().getAxisXTop();
if (null != axis) {
drawAxisLabelsAndName(canvas, axis, TOP);
}
}
示例5: generateDefaultData
import lecho.lib.hellocharts.model.Axis; //导入依赖的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);
}
}
}
示例6: generateLineChartData
import lecho.lib.hellocharts.model.Axis; //导入依赖的package包/类
private LineChartData generateLineChartData() {
int numValues = 20;
List<PointValue> values = new ArrayList<PointValue>();
for (int i = 0; i < numValues; ++i) {
values.add(new PointValue(i, (float) Math.random() * 100f));
}
Line line = new Line(values);
line.setColor(ChartUtils.COLOR_GREEN);
List<Line> lines = new ArrayList<Line>();
lines.add(line);
LineChartData data = new LineChartData(lines);
data.setAxisXBottom(new Axis().setName("Axis X"));
data.setAxisYLeft(new Axis().setName("Axis Y").setHasLines(true));
return data;
}
示例7: generateColumnChartData
import lecho.lib.hellocharts.model.Axis; //导入依赖的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;
}
示例8: generateBubbleChartData
import lecho.lib.hellocharts.model.Axis; //导入依赖的package包/类
private BubbleChartData generateBubbleChartData() {
int numBubbles = 10;
List<BubbleValue> values = new ArrayList<BubbleValue>();
for (int i = 0; i < numBubbles; ++i) {
BubbleValue value = new BubbleValue(i, (float) Math.random() * 100, (float) Math.random() * 1000);
value.setColor(ChartUtils.pickColor());
values.add(value);
}
BubbleChartData data = new BubbleChartData(values);
data.setAxisXBottom(new Axis().setName("Axis X"));
data.setAxisYLeft(new Axis().setName("Axis Y").setHasLines(true));
return data;
}
示例9: generatePreviewLineChartData
import lecho.lib.hellocharts.model.Axis; //导入依赖的package包/类
private LineChartData generatePreviewLineChartData() {
int numValues = 50;
List<PointValue> values = new ArrayList<PointValue>();
for (int i = 0; i < numValues; ++i) {
values.add(new PointValue(i, (float) Math.random() * 100f));
}
Line line = new Line(values);
line.setColor(ChartUtils.DEFAULT_DARKEN_COLOR);
line.setHasPoints(false);// too many values so don't draw points.
List<Line> lines = new ArrayList<Line>();
lines.add(line);
LineChartData data = new LineChartData(lines);
data.setAxisXBottom(new Axis());
data.setAxisYLeft(new Axis().setHasLines(true));
return data;
}
示例10: generateData
import lecho.lib.hellocharts.model.Axis; //导入依赖的package包/类
private void generateData() {
// Chart looks the best when line data and column data have similar maximum viewports.
data = new ComboLineColumnChartData(generateColumnData(), generateLineData());
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.setComboLineColumnChartData(data);
}
示例11: generateDefaultData
import lecho.lib.hellocharts.model.Axis; //导入依赖的package包/类
private void generateDefaultData() {
int numValues = 50;
List<PointValue> values = new ArrayList<PointValue>();
for (int i = 0; i < numValues; ++i) {
values.add(new PointValue(i, (float) Math.random() * 100f));
}
Line line = new Line(values);
line.setColor(ChartUtils.COLOR_GREEN);
line.setHasPoints(false);// too many values so don't draw points.
List<Line> lines = new ArrayList<Line>();
lines.add(line);
data = new LineChartData(lines);
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 LineChartData(data);
previewData.getLines().get(0).setColor(ChartUtils.DEFAULT_DARKEN_COLOR);
}
示例12: initAxisPaints
import lecho.lib.hellocharts.model.Axis; //导入依赖的package包/类
private void initAxisPaints(Axis axis, int position) {
Typeface typeface = axis.getTypeface();
if (typeface != null) {
this.labelPaintTab[position].setTypeface(typeface);
this.namePaintTab[position].setTypeface(typeface);
}
this.labelPaintTab[position].setColor(axis.getTextColor());
this.labelPaintTab[position].setTextSize((float) ChartUtils.sp2px(this.scaledDensity, axis.getTextSize()));
this.labelPaintTab[position].getFontMetricsInt(this.fontMetricsTab[position]);
this.namePaintTab[position].setColor(axis.getTextColor());
this.namePaintTab[position].setTextSize((float) ChartUtils.sp2px(this.scaledDensity, axis.getTextSize()));
this.linePaintTab[position].setColor(axis.getLineColor());
this.labelTextAscentTab[position] = Math.abs(this.fontMetricsTab[position].ascent);
this.labelTextDescentTab[position] = Math.abs(this.fontMetricsTab[position].descent);
this.labelWidthTab[position] = (int) this.labelPaintTab[position].measureText(labelWidthChars, 0, axis.getMaxLabelChars());
}
示例13: initAxisTextAlignment
import lecho.lib.hellocharts.model.Axis; //导入依赖的package包/类
private void initAxisTextAlignment(Axis axis, int position) {
this.namePaintTab[position].setTextAlign(Align.CENTER);
if (position == 0 || 3 == position) {
this.labelPaintTab[position].setTextAlign(Align.CENTER);
} else if (1 == position) {
if (axis.isInside()) {
this.labelPaintTab[position].setTextAlign(Align.LEFT);
} else {
this.labelPaintTab[position].setTextAlign(Align.RIGHT);
}
} else if (2 != position) {
} else {
if (axis.isInside()) {
this.labelPaintTab[position].setTextAlign(Align.RIGHT);
} else {
this.labelPaintTab[position].setTextAlign(Align.LEFT);
}
}
}
示例14: drawInBackground
import lecho.lib.hellocharts.model.Axis; //导入依赖的package包/类
public void drawInBackground(Canvas canvas) {
Axis axis = this.chart.getChartData().getAxisYLeft();
if (axis != null) {
prepareAxisToDraw(axis, 1);
drawAxisLines(canvas, axis, 1);
}
axis = this.chart.getChartData().getAxisYRight();
if (axis != null) {
prepareAxisToDraw(axis, 2);
drawAxisLines(canvas, axis, 2);
}
axis = this.chart.getChartData().getAxisXBottom();
if (axis != null) {
prepareAxisToDraw(axis, 3);
drawAxisLines(canvas, axis, 3);
}
axis = this.chart.getChartData().getAxisXTop();
if (axis != null) {
prepareAxisToDraw(axis, 0);
drawAxisLines(canvas, axis, 0);
}
}
示例15: drawInForeground
import lecho.lib.hellocharts.model.Axis; //导入依赖的package包/类
public void drawInForeground(Canvas canvas) {
Axis axis = this.chart.getChartData().getAxisYLeft();
if (axis != null) {
drawAxisLabelsAndName(canvas, axis, 1);
}
axis = this.chart.getChartData().getAxisYRight();
if (axis != null) {
drawAxisLabelsAndName(canvas, axis, 2);
}
axis = this.chart.getChartData().getAxisXBottom();
if (axis != null) {
drawAxisLabelsAndName(canvas, axis, 3);
}
axis = this.chart.getChartData().getAxisXTop();
if (axis != null) {
drawAxisLabelsAndName(canvas, axis, 0);
}
}