本文整理汇总了Java中com.jjoe64.graphview.GraphViewSeries.GraphViewSeriesStyle类的典型用法代码示例。如果您正苦于以下问题:Java GraphViewSeriesStyle类的具体用法?Java GraphViewSeriesStyle怎么用?Java GraphViewSeriesStyle使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
GraphViewSeriesStyle类属于com.jjoe64.graphview.GraphViewSeries包,在下文中一共展示了GraphViewSeriesStyle类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: drawSeries
import com.jjoe64.graphview.GraphViewSeries.GraphViewSeriesStyle; //导入依赖的package包/类
@Override
public void drawSeries(Canvas canvas, GraphViewDataInterface[] values, float graphwidth, float graphheight,
float border, double minX, double minY, double diffX, double diffY,
float horstart, GraphViewSeriesStyle style) {
float colwidth = (graphwidth - (2 * border)) / values.length;
paint.setStrokeWidth(style.thickness);
paint.setColor(style.color);
// draw data
for (int i = 0; i < values.length; i++) {
float valY = (float) (values[i].getY() - minY);
float ratY = (float) (valY / diffY);
float y = graphheight * ratY;
// hook for value dependent color
if (style.getValueDependentColor() != null) {
paint.setColor(style.getValueDependentColor().get(values[i]));
}
canvas.drawRect((i * colwidth) + horstart, (border - y) + graphheight, ((i * colwidth) + horstart) + (colwidth - 1), graphheight + border - 1, paint);
}
}
示例2: addSeries
import com.jjoe64.graphview.GraphViewSeries.GraphViewSeriesStyle; //导入依赖的package包/类
/**
* Add a Serie (set of values) to be represented in the graph.
* It also add a description, an specific color and thickness
* @param nameSerie Is the name given to the serie
* @param data Is an array with the values to be represented
* @param description Is a brief description about the data
* @param color Is the serie's color
* @param thickness Is the thickness of the line/bar drawn in the graph
*/
public boolean addSeries(String nameSerie, ArrayList<Float> data, String description,
int color, int thickness) {
if (hashSeries.get(nameSerie) == null) {
GraphViewData[] viewData = new GraphViewData[data.size()];
for (int i = 0; i < data.size(); i++) {
viewData[i] = new GraphViewData(i, data.get(i));
}
Integer c = data.size();
hashCont.put(nameSerie, c);
GraphViewSeries serie = new GraphViewSeries(description, new GraphViewSeriesStyle(color, thickness), viewData);
myGraphView.addSeries(serie);
hashSeries.put(nameSerie, serie);
return true;
} else
return false;
}
示例3: GraphData
import com.jjoe64.graphview.GraphViewSeries.GraphViewSeriesStyle; //导入依赖的package包/类
public GraphData(String label, GraphViewSeriesStyle style, int days, List<GraphPoint> points) {
super();
this.days = days;
this.points = points;
this.label = label;
this.style = style;
}
示例4: drawSeries
import com.jjoe64.graphview.GraphViewSeries.GraphViewSeriesStyle; //导入依赖的package包/类
@Override
public void drawSeries(Canvas canvas, GraphViewDataInterface[] values,
float graphwidth, float graphheight, float border, double minX,
double minY, double diffX, double diffY, float horstart,
GraphViewSeriesStyle style) {
float colwidth = graphwidth / values.length;
int maxColumnSize = getGraphViewStyle().getMaxColumnWidth();
if (maxColumnSize > 0 && colwidth > maxColumnSize) {
colwidth = maxColumnSize;
}
paint.setStrokeWidth(style.thickness);
paint.setColor(style.color);
// Bar chart position of this series on the canvas
List<BarChartRect> barChartRects = new LinkedList<>();
// draw data
for (int i = 0; i < values.length; i++) {
float valY = (float) (values[i].getY() - minY);
float ratY = (float) (valY / diffY);
float y = graphheight * ratY;
// hook for value dependent color
if (style.getValueDependentColor() != null) {
paint.setColor(style.getValueDependentColor().get(values[i]));
}
float pad = style.padding;
float left = (i * colwidth) + horstart;
float top = (border - y) + graphheight;
float right = left + colwidth;
float bottom = graphheight + border - 1;
// Draw the orange selection behind the selected bar
if (mBarPositionToHighlight == i && style.outerhighlightColor != 0x00ffffff) {
paint.setColor(style.outerhighlightColor);
canvas.drawRect(left, 10f, right, bottom, paint);
}
if ((top - bottom) == 1) {
// draw a placeholder
if (mBarPositionToHighlight != i) {
paint.setColor(style.color);
paint.setAlpha(25);
Shader shader = new LinearGradient(left + pad, bottom - 50, left + pad, bottom, Color.WHITE, Color.BLACK, Shader.TileMode.CLAMP);
paint.setShader(shader);
canvas.drawRect(left + pad, bottom - 50, right - pad, bottom, paint);
paint.setShader(null);
}
} else {
// draw a real bar
paint.setAlpha(255);
if (mBarPositionToHighlight == i) {
paint.setColor(style.highlightColor);
} else {
paint.setColor(style.color);
}
canvas.drawRect(left + pad, top, right - pad, bottom, paint);
}
barChartRects.add(new BarChartRect(left + pad, top, right - pad, bottom));
}
mSeriesRectsDrawedOnScreen.add(barChartRects);
}
示例5: generateSeries
import com.jjoe64.graphview.GraphViewSeries.GraphViewSeriesStyle; //导入依赖的package包/类
public static GraphViewSeries generateSeries(Context context, String label, List<GraphPoint> points, int days,
int color) {
GraphViewSeriesStyle style = new GraphViewSeriesStyle(color, ViewHelper.dpToPixels(context, 2));
GraphData data = new GraphData(label, style, days, points);
return data.getSeries();
}
示例6: drawSeries
import com.jjoe64.graphview.GraphViewSeries.GraphViewSeriesStyle; //导入依赖的package包/类
@Override
public void drawSeries(Canvas canvas, GraphViewDataInterface[] values,
float graphwidth, float graphheight, float border, double minX,
double minY, double diffX, double diffY, float horstart,
GraphViewSeriesStyle style) {
float colwidth = graphwidth / (values.length);
paint.setStrokeWidth(style.thickness);
float offset = 0;
// draw data
for (int i = 0; i < values.length; i++) {
float valY = (float) (values[i].getY() - minY);
float ratY = (float) (valY / diffY);
float y = graphheight * ratY;
// hook for value dependent color
if (style.getValueDependentColor() != null) {
paint.setColor(style.getValueDependentColor().get(values[i]));
} else {
paint.setColor(style.color);
}
float left = (i * colwidth) + horstart - offset;
float top = (border - y) + graphheight;
float right = ((i * colwidth) + horstart) + (colwidth - 1) - offset;
canvas.drawRect(left, top, right, graphheight + border - 1, paint);
// -----Set values on top of graph---------
if (drawValuesOnTop) {
top -= 4;
if (top <= border)
top += border + 4;
paint.setTextAlign(Align.CENTER);
paint.setColor(valuesOnTopColor);
canvas.drawText(String.valueOf(values[i].getY()),
(left + right) / 2, top, paint);
}
}
}
示例7: drawSeries
import com.jjoe64.graphview.GraphViewSeries.GraphViewSeriesStyle; //导入依赖的package包/类
abstract protected void drawSeries(Canvas canvas,
GraphViewDataInterface[] values, float graphwidth,
float graphheight, float border, double minX, double minY,
double diffX, double diffY, float horstart,
GraphViewSeriesStyle style);
示例8: drawSeries
import com.jjoe64.graphview.GraphViewSeries.GraphViewSeriesStyle; //导入依赖的package包/类
abstract protected void drawSeries(Canvas canvas, GraphViewDataInterface[] values, float graphwidth, float graphheight, float border, double minX, double minY, double diffX, double diffY, float horstart, GraphViewSeriesStyle style);