本文整理汇总了Java中org.achartengine.renderer.SimpleSeriesRenderer.getDisplayChartValuesDistance方法的典型用法代码示例。如果您正苦于以下问题:Java SimpleSeriesRenderer.getDisplayChartValuesDistance方法的具体用法?Java SimpleSeriesRenderer.getDisplayChartValuesDistance怎么用?Java SimpleSeriesRenderer.getDisplayChartValuesDistance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.achartengine.renderer.SimpleSeriesRenderer
的用法示例。
在下文中一共展示了SimpleSeriesRenderer.getDisplayChartValuesDistance方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: drawChartValuesText
import org.achartengine.renderer.SimpleSeriesRenderer; //导入方法依赖的package包/类
protected void drawChartValuesText(Canvas canvas, XYSeries xyseries, SimpleSeriesRenderer simpleseriesrenderer, Paint paint, List list, int i, int j)
{
if (list.size() > 1)
{
float f1 = ((Float)list.get(0)).floatValue();
float f2 = ((Float)list.get(1)).floatValue();
int l = 0;
while (l < list.size())
{
if (l == 2)
{
if (Math.abs(((Float)list.get(2)).floatValue() - ((Float)list.get(0)).floatValue()) > (float)simpleseriesrenderer.getDisplayChartValuesDistance() || Math.abs(((Float)list.get(3)).floatValue() - ((Float)list.get(1)).floatValue()) > (float)simpleseriesrenderer.getDisplayChartValuesDistance())
{
drawText(canvas, getLabel(simpleseriesrenderer.getChartValuesFormat(), xyseries.getY(j)), ((Float)list.get(0)).floatValue(), ((Float)list.get(1)).floatValue() - simpleseriesrenderer.getChartValuesSpacing(), paint, 0.0F);
drawText(canvas, getLabel(simpleseriesrenderer.getChartValuesFormat(), xyseries.getY(j + 1)), ((Float)list.get(2)).floatValue(), ((Float)list.get(3)).floatValue() - simpleseriesrenderer.getChartValuesSpacing(), paint, 0.0F);
f1 = ((Float)list.get(2)).floatValue();
f2 = ((Float)list.get(3)).floatValue();
}
} else
if (l > 2 && (Math.abs(((Float)list.get(l)).floatValue() - f1) > (float)simpleseriesrenderer.getDisplayChartValuesDistance() || Math.abs(((Float)list.get(l + 1)).floatValue() - f2) > (float)simpleseriesrenderer.getDisplayChartValuesDistance()))
{
drawText(canvas, getLabel(simpleseriesrenderer.getChartValuesFormat(), xyseries.getY(j + l / 2)), ((Float)list.get(l)).floatValue(), ((Float)list.get(l + 1)).floatValue() - simpleseriesrenderer.getChartValuesSpacing(), paint, 0.0F);
f1 = ((Float)list.get(l)).floatValue();
f2 = ((Float)list.get(l + 1)).floatValue();
}
l += 2;
}
} else
{
for (int k = 0; k < list.size(); k += 2)
{
drawText(canvas, getLabel(simpleseriesrenderer.getChartValuesFormat(), xyseries.getY(j + k / 2)), ((Float)list.get(k)).floatValue(), ((Float)list.get(k + 1)).floatValue() - simpleseriesrenderer.getChartValuesSpacing(), paint, 0.0F);
}
}
}
示例2: drawChartValuesText
import org.achartengine.renderer.SimpleSeriesRenderer; //导入方法依赖的package包/类
/**
* The graphical representation of the series values as text.
*
* @param canvas the canvas to paint to
* @param series the series to be painted
* @param renderer the series renderer
* @param paint the paint to be used for drawing
* @param points the array of points to be used for drawing the series
* @param seriesIndex the index of the series currently being drawn
* @param startIndex the start index of the rendering points
*/
protected void drawChartValuesText(Canvas canvas, XYSeries series, SimpleSeriesRenderer renderer,
Paint paint, List<Float> points, int seriesIndex, int startIndex) {
if (points.size() > 1) { // there are more than one point
// record the first point's position
float previousPointX = points.get(0);
float previousPointY = points.get(1);
for (int k = 0; k < points.size(); k += 2) {
if (k == 2) { // decide whether to display first two points' values or
// not
if (Math.abs(points.get(2) - points.get(0)) > renderer.getDisplayChartValuesDistance()
|| Math.abs(points.get(3) - points.get(1)) > renderer.getDisplayChartValuesDistance()) {
// first point
drawText(canvas, getLabel(renderer.getChartValuesFormat(), series.getY(startIndex)),
points.get(0), points.get(1) - renderer.getChartValuesSpacing(), paint, 0);
// second point
drawText(canvas,
getLabel(renderer.getChartValuesFormat(), series.getY(startIndex + 1)),
points.get(2), points.get(3) - renderer.getChartValuesSpacing(), paint, 0);
previousPointX = points.get(2);
previousPointY = points.get(3);
}
} else if (k > 2) {
// compare current point's position with the previous point's, if they
// are not too close, display
if (Math.abs(points.get(k) - previousPointX) > renderer.getDisplayChartValuesDistance()
|| Math.abs(points.get(k + 1) - previousPointY) > renderer
.getDisplayChartValuesDistance()) {
drawText(canvas,
getLabel(renderer.getChartValuesFormat(), series.getY(startIndex + k / 2)),
points.get(k), points.get(k + 1) - renderer.getChartValuesSpacing(), paint, 0);
previousPointX = points.get(k);
previousPointY = points.get(k + 1);
}
}
}
} else { // if only one point, display it
for (int k = 0; k < points.size(); k += 2) {
drawText(canvas,
getLabel(renderer.getChartValuesFormat(), series.getY(startIndex + k / 2)),
points.get(k), points.get(k + 1) - renderer.getChartValuesSpacing(), paint, 0);
}
}
}