use of org.xclcharts.renderer.plot.BorderRender in project XCL-Charts by xcltapestry.
the class XChart method setBackgroundColor.
/**
* 设置图的渐变背景色
* @param direction 渐变方向
* @param beginColor 起始颜色
* @param endColor 结束颜色
*/
public void setBackgroundColor(XEnum.Direction direction, int beginColor, int endColor) {
if (beginColor == endColor) {
getBackgroundPaint().setColor(beginColor);
} else {
LinearGradient linearGradient;
if (direction == XEnum.Direction.VERTICAL) {
linearGradient = new LinearGradient(0, 0, 0, getBottom() - getTop(), beginColor, endColor, Shader.TileMode.MIRROR);
} else {
linearGradient = new LinearGradient(getLeft(), getBottom(), getRight(), getTop(), beginColor, endColor, Shader.TileMode.CLAMP);
}
getBackgroundPaint().setShader(linearGradient);
}
if (null == mBorder)
mBorder = new BorderRender();
mBorder.getBackgroundPaint().setColor(endColor);
}
use of org.xclcharts.renderer.plot.BorderRender in project XCL-Charts by xcltapestry.
the class XChart method renderChartBackground.
/**
* 绘制图的背景
*/
protected void renderChartBackground(Canvas canvas) {
if (this.mBackgroundColorVisible) {
if (null == mBorder)
mBorder = new BorderRender();
if (mShowBorder) {
mBorder.renderBorder("CHART", canvas, mLeft, mTop, mRight, mBottom);
} else {
//要清掉 border的默认间距
int borderSpadding = mBorder.getBorderSpadding();
mBorder.renderBorder("CHART", canvas, mLeft - borderSpadding, mTop - borderSpadding, mRight + borderSpadding, mBottom + borderSpadding);
}
}
}
Aggregations