当前位置: 首页>>代码示例>>Java>>正文


Java GraphViewSeriesStyle.getValueDependentColor方法代码示例

本文整理汇总了Java中com.jjoe64.graphview.GraphViewSeries.GraphViewSeriesStyle.getValueDependentColor方法的典型用法代码示例。如果您正苦于以下问题:Java GraphViewSeriesStyle.getValueDependentColor方法的具体用法?Java GraphViewSeriesStyle.getValueDependentColor怎么用?Java GraphViewSeriesStyle.getValueDependentColor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.jjoe64.graphview.GraphViewSeries.GraphViewSeriesStyle的用法示例。


在下文中一共展示了GraphViewSeriesStyle.getValueDependentColor方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
	}
}
 
开发者ID:ldsddn,项目名称:wordpress_app_android,代码行数:24,代码来源:BarGraphView.java

示例2: 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);
}
 
开发者ID:ldsddn,项目名称:wordpress_app_android,代码行数:67,代码来源:StatsBarGraph.java

示例3: 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);
		}
	}
}
 
开发者ID:myHealthAssistant-tudarmstadt,项目名称:myHealthHub,代码行数:42,代码来源:BarGraphView.java


注:本文中的com.jjoe64.graphview.GraphViewSeries.GraphViewSeriesStyle.getValueDependentColor方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。