本文整理了Java中com.github.mikephil.charting.utils.Utils.calcTextHeight()
方法的一些代码示例,展示了Utils.calcTextHeight()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Utils.calcTextHeight()
方法的具体详情如下:
包路径:com.github.mikephil.charting.utils.Utils
类名称:Utils
方法名:calcTextHeight
[英]calculates the approximate height of a text, depending on a demo text avoid repeated calls (e.g. inside drawing methods)
[中]根据演示文本计算文本的大致高度,避免重复调用(例如内部绘图方法)
代码示例来源:origin: PhilJay/MPAndroidChart
/**
* returns the maximum height in pixels across all legend labels
*
* @param p the paint object used for rendering the text
* @return
*/
public float getMaximumEntryHeight(Paint p) {
float max = 0f;
for (LegendEntry entry : mEntries) {
String label = entry.label;
if (label == null) continue;
float length = (float) Utils.calcTextHeight(p, label);
if (length > max)
max = length;
}
return max;
}
代码示例来源:origin: PhilJay/MPAndroidChart
/**
* This is for HorizontalBarChart vertical spacing.
*
* @param p
* @return
*/
public float getRequiredHeightSpace(Paint p) {
p.setTextSize(mTextSize);
String label = getLongestLabel();
return (float) Utils.calcTextHeight(p, label) + getYOffset() * 2f;
}
代码示例来源:origin: PhilJay/MPAndroidChart
protected void computeSize() {
String longest = mXAxis.getLongestLabel();
mAxisLabelPaint.setTypeface(mXAxis.getTypeface());
mAxisLabelPaint.setTextSize(mXAxis.getTextSize());
final FSize labelSize = Utils.calcTextSize(mAxisLabelPaint, longest);
final float labelWidth = labelSize.width;
final float labelHeight = Utils.calcTextHeight(mAxisLabelPaint, "Q");
final FSize labelRotatedSize = Utils.getSizeOfRotatedRectangleByDegrees(
labelWidth,
labelHeight,
mXAxis.getLabelRotationAngle());
mXAxis.mLabelWidth = Math.round(labelWidth);
mXAxis.mLabelHeight = Math.round(labelHeight);
mXAxis.mLabelRotatedWidth = Math.round(labelRotatedSize.width);
mXAxis.mLabelRotatedHeight = Math.round(labelRotatedSize.height);
FSize.recycleInstance(labelRotatedSize);
FSize.recycleInstance(labelSize);
}
代码示例来源:origin: PhilJay/MPAndroidChart
final float labelLineHeight = Utils.calcTextHeight(mLimitLinePaint, label);
mLimitLinePaint.setTextAlign(Align.LEFT);
c.drawText(label, position[0] + xOffset, mViewPortHandler.contentTop() + yOffset + labelLineHeight,
final float labelLineHeight = Utils.calcTextHeight(mLimitLinePaint, label);
c.drawText(label, position[0] - xOffset, mViewPortHandler.contentTop() + yOffset + labelLineHeight,
mLimitLinePaint);
代码示例来源:origin: PhilJay/MPAndroidChart
final float labelLineHeight = Utils.calcTextHeight(mLimitLinePaint, label);
mLimitLinePaint.setTextAlign(Align.LEFT);
c.drawText(label, pts[0] + xOffset, mViewPortHandler.contentTop() + yOffset + labelLineHeight, mLimitLinePaint);
final float labelLineHeight = Utils.calcTextHeight(mLimitLinePaint, label);
c.drawText(label, pts[0] - xOffset, mViewPortHandler.contentTop() + yOffset + labelLineHeight, mLimitLinePaint);
} else {
代码示例来源:origin: PhilJay/MPAndroidChart
mLimitLinePaint.setTextSize(l.getTextSize());
final float labelLineHeight = Utils.calcTextHeight(mLimitLinePaint, label);
float xOffset = Utils.convertDpToPixel(4f) + l.getXOffset();
float yOffset = l.getLineWidth() + labelLineHeight + l.getYOffset();
代码示例来源:origin: PhilJay/MPAndroidChart
mLimitLinePaint.setTextSize(l.getTextSize());
final float labelLineHeight = Utils.calcTextHeight(mLimitLinePaint, label);
float xOffset = Utils.convertDpToPixel(4f) + l.getXOffset();
float yOffset = l.getLineWidth() + labelLineHeight + l.getYOffset();
代码示例来源:origin: PhilJay/MPAndroidChart
float yoffset = Utils.calcTextHeight(mAxisLabelPaint, "A") / 2.5f + mYAxis.getYOffset();
代码示例来源:origin: PhilJay/MPAndroidChart
float textHeight = Utils.calcTextHeight(mAxisLabelPaint, "Q");
代码示例来源:origin: PhilJay/MPAndroidChart
float lineHeight = Utils.calcTextHeight(mValuePaint, "1");
代码示例来源:origin: PhilJay/MPAndroidChart
float lineHeight = Utils.calcTextHeight(mValuePaint, "Q")
+ Utils.convertDpToPixel(4f);
代码示例来源:origin: PhilJay/MPAndroidChart
float labelLineSpacing = Utils.getLineSpacing(mLegendLabelPaint, legendFontMetrics)
+ Utils.convertDpToPixel(mLegend.getYEntrySpace());
float formYOffset = labelLineHeight - Utils.calcTextHeight(mLegendLabelPaint, "ABC") / 2.f;
代码示例来源:origin: PhilJay/MPAndroidChart
float valueTextHeight = Utils.calcTextHeight(mValuePaint, "8");
posOffset = (drawValueAboveBar ? -valueOffsetPlus : valueTextHeight + valueOffsetPlus);
negOffset = (drawValueAboveBar ? valueTextHeight + valueOffsetPlus : -valueOffsetPlus);
代码示例来源:origin: PhilJay/MPAndroidChart
final float halfTextHeight = Utils.calcTextHeight(mValuePaint, "10") / 2f;
代码示例来源:origin: com.github.PhilJay/MPAndroidChart
/**
* returns the maximum height in pixels across all legend labels
*
* @param p the paint object used for rendering the text
* @return
*/
public float getMaximumEntryHeight(Paint p) {
float max = 0f;
for (LegendEntry entry : mEntries) {
String label = entry.label;
if (label == null) continue;
float length = (float) Utils.calcTextHeight(p, label);
if (length > max)
max = length;
}
return max;
}
代码示例来源:origin: WenWangAndroid/ChartManager
/**
* returns the maximum height in pixels across all legend labels
*
* @param p the paint object used for rendering the text
* @return
*/
public float getMaximumEntryHeight(Paint p) {
float max = 0f;
for (LegendEntry entry : mEntries) {
String label = entry.label;
if (label == null) continue;
float length = (float) Utils.calcTextHeight(p, label);
if (length > max)
max = length;
}
return max;
}
代码示例来源:origin: com.github.PhilJay/MPAndroidChart
/**
* This is for HorizontalBarChart vertical spacing.
*
* @param p
* @return
*/
public float getRequiredHeightSpace(Paint p) {
p.setTextSize(mTextSize);
String label = getLongestLabel();
return (float) Utils.calcTextHeight(p, label) + getYOffset() * 2f;
}
代码示例来源:origin: WallaceXiao/StockChart-MPAndroidChart
/**
* This is for HorizontalBarChart vertical spacing.
*
* @param p
* @return
*/
public float getRequiredHeightSpace(Paint p) {
p.setTextSize(mTextSize);
String label = getLongestLabel();
return (float) Utils.calcTextHeight(p, label) + getYOffset() * 2f;
}
代码示例来源:origin: WenWangAndroid/ChartManager
/**
* This is for HorizontalBarChart vertical spacing.
*
* @param p
* @return
*/
public float getRequiredHeightSpace(Paint p) {
p.setTextSize(mTextSize);
String label = getLongestLabel();
return (float) Utils.calcTextHeight(p, label) + getYOffset() * 2f;
}
代码示例来源:origin: xiaolongonly/Ticket-Analysis
/**
* This is for HorizontalBarChart vertical spacing.
*
* @param p
* @return
*/
public float getRequiredHeightSpace(Paint p) {
p.setTextSize(mTextSize);
String label = getLongestLabel();
return (float) Utils.calcTextHeight(p, label) + getYOffset() * 2f;
}
内容来源于网络,如有侵权,请联系作者删除!