本文整理汇总了Java中com.github.mikephil.charting.utils.ViewPortHandler类的典型用法代码示例。如果您正苦于以下问题:Java ViewPortHandler类的具体用法?Java ViewPortHandler怎么用?Java ViewPortHandler使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ViewPortHandler类属于com.github.mikephil.charting.utils包,在下文中一共展示了ViewPortHandler类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getFormattedValue
import com.github.mikephil.charting.utils.ViewPortHandler; //导入依赖的package包/类
@Override
public String getFormattedValue(float value, Entry entry, int dataSetIndex, ViewPortHandler viewPortHandler) {
if (!mDrawWholeStack && entry instanceof BarEntry) {
BarEntry barEntry = (BarEntry) entry;
float[] vals = barEntry.getYVals();
if (vals != null) {
// find out if we are on top of the stack
if (vals[vals.length - 1] == value) {
// return the "sum" across all stack values
return mFormat.format(barEntry.getY()) + mAppendix;
} else {
return ""; // return empty
}
}
}
// return the "proposed" value
return mFormat.format(value) + mAppendix;
}
示例2: getTrans
import com.github.mikephil.charting.utils.ViewPortHandler; //导入依赖的package包/类
/**
* Returns a recyclable MPPointF instance.
* returns the correct translation depending on the provided x and y touch
* points
*
* @param x
* @param y
* @return
*/
public MPPointF getTrans(float x, float y) {
ViewPortHandler vph = mChart.getViewPortHandler();
float xTrans = x - vph.offsetLeft();
float yTrans = 0f;
// check if axis is inverted
if (inverted()) {
yTrans = -(y - vph.offsetTop());
} else {
yTrans = -(mChart.getMeasuredHeight() - y - vph.offsetBottom());
}
return MPPointF.getInstance(xTrans, yTrans);
}
示例3: renderShape
import com.github.mikephil.charting.utils.ViewPortHandler; //导入依赖的package包/类
@Override
public void renderShape(Canvas c, IScatterDataSet dataSet, ViewPortHandler viewPortHandler,
float posX, float posY, Paint renderPaint) {
final float shapeHalf = dataSet.getScatterShapeSize() / 2f;
renderPaint.setStyle(Paint.Style.STROKE);
renderPaint.setStrokeWidth(Utils.convertDpToPixel(1f));
c.drawLine(
posX - shapeHalf,
posY - shapeHalf,
posX + shapeHalf,
posY + shapeHalf,
renderPaint);
c.drawLine(
posX + shapeHalf,
posY - shapeHalf,
posX - shapeHalf,
posY + shapeHalf,
renderPaint);
}
示例4: renderShape
import com.github.mikephil.charting.utils.ViewPortHandler; //导入依赖的package包/类
@Override
public void renderShape(Canvas c, IScatterDataSet dataSet, ViewPortHandler viewPortHandler,
float posX, float posY, Paint renderPaint) {
final float shapeHalf = dataSet.getScatterShapeSize() / 2f;
renderPaint.setStyle(Paint.Style.STROKE);
renderPaint.setStrokeWidth(Utils.convertDpToPixel(1f));
c.drawLine(
posX - shapeHalf,
posY,
posX + shapeHalf,
posY,
renderPaint);
c.drawLine(
posX,
posY - shapeHalf,
posX,
posY + shapeHalf,
renderPaint);
}
示例5: renderShape
import com.github.mikephil.charting.utils.ViewPortHandler; //导入依赖的package包/类
@Override
public void renderShape(Canvas c, IScatterDataSet dataSet, ViewPortHandler viewPortHandler,
float posX, float posY, Paint renderPaint) {
final float shapeHalf = dataSet.getScatterShapeSize() / 2f;
renderPaint.setStyle(Paint.Style.STROKE);
renderPaint.setStrokeWidth(Utils.convertDpToPixel(1f));
c.drawLine(
posX,
posY - (2 * shapeHalf),
posX + (2 * shapeHalf),
posY,
renderPaint);
c.drawLine(
posX,
posY - (2 * shapeHalf),
posX - (2 * shapeHalf),
posY,
renderPaint);
}
示例6: renderShape
import com.github.mikephil.charting.utils.ViewPortHandler; //导入依赖的package包/类
@Override
public void renderShape(Canvas c, IScatterDataSet dataSet, ViewPortHandler viewPortHandler,
float posX, float posY, Paint renderPaint) {
final float shapeHalf = dataSet.getScatterShapeSize() / 2f;
renderPaint.setStyle(Paint.Style.STROKE);
renderPaint.setStrokeWidth(Utils.convertDpToPixel(1f));
c.drawLine(
posX,
posY + (2 * shapeHalf),
posX + (2 * shapeHalf),
posY,
renderPaint);
c.drawLine(
posX,
posY + (2 * shapeHalf),
posX - (2 * shapeHalf),
posY,
renderPaint);
}
示例7: DataRenderer
import com.github.mikephil.charting.utils.ViewPortHandler; //导入依赖的package包/类
public DataRenderer(ChartAnimator animator, ViewPortHandler viewPortHandler) {
super(viewPortHandler);
this.mAnimator = animator;
mRenderPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mRenderPaint.setStyle(Style.FILL);
mDrawPaint = new Paint(Paint.DITHER_FLAG);
mValuePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mValuePaint.setColor(Color.rgb(63, 63, 63));
mValuePaint.setTextAlign(Align.CENTER);
mValuePaint.setTextSize(Utils.convertDpToPixel(9f));
mHighlightPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mHighlightPaint.setStyle(Paint.Style.STROKE);
mHighlightPaint.setStrokeWidth(2f);
mHighlightPaint.setColor(Color.rgb(255, 187, 115));
}
示例8: BarChartRenderer
import com.github.mikephil.charting.utils.ViewPortHandler; //导入依赖的package包/类
public BarChartRenderer(BarDataProvider chart, ChartAnimator animator,
ViewPortHandler viewPortHandler) {
super(animator, viewPortHandler);
this.mChart = chart;
mHighlightPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mHighlightPaint.setStyle(Paint.Style.FILL);
mHighlightPaint.setColor(Color.rgb(0, 0, 0));
// set alpha after color
mHighlightPaint.setAlpha(120);
mShadowPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mShadowPaint.setStyle(Paint.Style.FILL);
mBarBorderPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mBarBorderPaint.setStyle(Paint.Style.STROKE);
}
示例9: AxisRenderer
import com.github.mikephil.charting.utils.ViewPortHandler; //导入依赖的package包/类
public AxisRenderer(ViewPortHandler viewPortHandler, Transformer trans, AxisBase axis) {
super(viewPortHandler);
this.mTrans = trans;
this.mAxis = axis;
if(mViewPortHandler != null) {
mAxisLabelPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mGridPaint = new Paint();
mGridPaint.setColor(Color.GRAY);
mGridPaint.setStrokeWidth(1f);
mGridPaint.setStyle(Style.STROKE);
mGridPaint.setAlpha(90);
mAxisLinePaint = new Paint();
mAxisLinePaint.setColor(Color.BLACK);
mAxisLinePaint.setStrokeWidth(1f);
mAxisLinePaint.setStyle(Style.STROKE);
mLimitLinePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mLimitLinePaint.setStyle(Paint.Style.STROKE);
}
}
示例10: YAxisRenderer
import com.github.mikephil.charting.utils.ViewPortHandler; //导入依赖的package包/类
public YAxisRenderer(ViewPortHandler viewPortHandler, YAxis yAxis, Transformer trans) {
super(viewPortHandler, trans, yAxis);
this.mYAxis = yAxis;
if(mViewPortHandler != null) {
mAxisLabelPaint.setColor(Color.BLACK);
mAxisLabelPaint.setTextSize(Utils.convertDpToPixel(10f));
mZeroLinePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mZeroLinePaint.setColor(Color.GRAY);
mZeroLinePaint.setStrokeWidth(1f);
mZeroLinePaint.setStyle(Paint.Style.STROKE);
}
}
示例11: getTrans
import com.github.mikephil.charting.utils.ViewPortHandler; //导入依赖的package包/类
/**
* returns the correct translation depending on the provided x and y touch
* points
*
* @param x
* @param y
* @return
*/
public PointF getTrans(float x, float y) {
ViewPortHandler vph = mChart.getViewPortHandler();
float xTrans = x - vph.offsetLeft();
float yTrans = 0f;
// check if axis is inverted
if (mChart.isAnyAxisInverted() && mClosestDataSetToTouch != null
&& mChart.isInverted(mClosestDataSetToTouch.getAxisDependency())) {
yTrans = -(y - vph.offsetTop());
} else {
yTrans = -(mChart.getMeasuredHeight() - y - vph.offsetBottom());
}
return new PointF(xTrans, yTrans);
}
示例12: getFormattedValue
import com.github.mikephil.charting.utils.ViewPortHandler; //导入依赖的package包/类
@Override
public String getFormattedValue(float value, Entry entry, int dataSetIndex, ViewPortHandler viewPortHandler) {
if (!mDrawWholeStack && entry instanceof BarEntry) {
BarEntry barEntry = (BarEntry) entry;
float[] vals = barEntry.getVals();
if (vals != null) {
// find out if we are on top of the stack
if (vals[vals.length - 1] == value) {
// return the "sum" across all stack values
return mFormat.format(barEntry.getVal()) + mAppendix;
} else {
return ""; // return empty
}
}
}
// return the "proposed" value
return mFormat.format(value) + mAppendix;
}
示例13: AxisRenderer
import com.github.mikephil.charting.utils.ViewPortHandler; //导入依赖的package包/类
public AxisRenderer(ViewPortHandler viewPortHandler, Transformer trans) {
super(viewPortHandler);
this.mTrans = trans;
mAxisLabelPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mGridPaint = new Paint();
mGridPaint.setColor(Color.GRAY);
mGridPaint.setStrokeWidth(1f);
mGridPaint.setStyle(Style.STROKE);
mGridPaint.setAlpha(90);
mAxisLinePaint = new Paint();
mAxisLinePaint.setColor(Color.BLACK);
mAxisLinePaint.setStrokeWidth(1f);
mAxisLinePaint.setStyle(Style.STROKE);
mLimitLinePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mLimitLinePaint.setStyle(Paint.Style.STROKE);
}
示例14: PieChartRenderer
import com.github.mikephil.charting.utils.ViewPortHandler; //导入依赖的package包/类
public PieChartRenderer(PieChart chart, ChartAnimator animator,
ViewPortHandler viewPortHandler) {
super(animator, viewPortHandler);
mChart = chart;
mHolePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mHolePaint.setColor(Color.WHITE);
mHolePaint.setStyle(Style.FILL);
mTransparentCirclePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mTransparentCirclePaint.setColor(Color.WHITE);
mTransparentCirclePaint.setStyle(Style.FILL);
mTransparentCirclePaint.setAlpha(100);
mCenterTextPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG);
mCenterTextPaint.setColor(Color.BLACK);
mCenterTextPaint.setTextSize(Utils.convertDpToPixel(12f));
mCenterTextPaint.setTextAlign(Align.CENTER);
mValuePaint.setTextSize(Utils.convertDpToPixel(13f));
mValuePaint.setColor(Color.WHITE);
mValuePaint.setTextAlign(Align.CENTER);
}
示例15: BarChartRenderer
import com.github.mikephil.charting.utils.ViewPortHandler; //导入依赖的package包/类
public BarChartRenderer(BarDataProvider chart, ChartAnimator animator,
ViewPortHandler viewPortHandler) {
super(animator, viewPortHandler);
this.mChart = chart;
mHighlightPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mHighlightPaint.setStyle(Paint.Style.FILL);
mHighlightPaint.setColor(Color.rgb(0, 0, 0));
// set alpha after color
mHighlightPaint.setAlpha(120);
mShadowPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mShadowPaint.setStyle(Paint.Style.FILL);
mBarBorderPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mBarBorderPaint.setStyle(Paint.Style.STROKE);
}