本文整理汇总了Java中com.github.mikephil.charting.data.Entry.getIcon方法的典型用法代码示例。如果您正苦于以下问题:Java Entry.getIcon方法的具体用法?Java Entry.getIcon怎么用?Java Entry.getIcon使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.github.mikephil.charting.data.Entry
的用法示例。
在下文中一共展示了Entry.getIcon方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: drawValues
import com.github.mikephil.charting.data.Entry; //导入方法依赖的package包/类
@Override
public void drawValues(Canvas c) {
// if values are drawn
if (isDrawingValuesAllowed(mChart)) {
List<IScatterDataSet> dataSets = mChart.getScatterData().getDataSets();
for (int i = 0; i < mChart.getScatterData().getDataSetCount(); i++) {
IScatterDataSet dataSet = dataSets.get(i);
if (!shouldDrawValues(dataSet))
continue;
// apply the text-styling defined by the DataSet
applyValueTextStyle(dataSet);
mXBounds.set(mChart, dataSet);
float[] positions = mChart.getTransformer(dataSet.getAxisDependency())
.generateTransformedValuesScatter(dataSet,
mAnimator.getPhaseX(), mAnimator.getPhaseY(), mXBounds.min, mXBounds.max);
float shapeSize = Utils.convertDpToPixel(dataSet.getScatterShapeSize());
MPPointF iconsOffset = MPPointF.getInstance(dataSet.getIconsOffset());
iconsOffset.x = Utils.convertDpToPixel(iconsOffset.x);
iconsOffset.y = Utils.convertDpToPixel(iconsOffset.y);
for (int j = 0; j < positions.length; j += 2) {
if (!mViewPortHandler.isInBoundsRight(positions[j]))
break;
// make sure the lines don't do shitty things outside bounds
if ((!mViewPortHandler.isInBoundsLeft(positions[j])
|| !mViewPortHandler.isInBoundsY(positions[j + 1])))
continue;
Entry entry = dataSet.getEntryForIndex(j / 2 + mXBounds.min);
if (dataSet.isDrawValuesEnabled()) {
drawValue(c,
dataSet.getValueFormatter(),
entry.getY(),
entry,
i,
positions[j],
positions[j + 1] - shapeSize,
dataSet.getValueTextColor(j / 2 + mXBounds.min));
}
if (entry.getIcon() != null && dataSet.isDrawIconsEnabled()) {
Drawable icon = entry.getIcon();
Utils.drawImage(
c,
icon,
(int)(positions[j] + iconsOffset.x),
(int)(positions[j + 1] + iconsOffset.y),
icon.getIntrinsicWidth(),
icon.getIntrinsicHeight());
}
}
MPPointF.recycleInstance(iconsOffset);
}
}
}