本文整理汇总了Java中com.github.mikephil.charting.utils.Utils.calcTextSize方法的典型用法代码示例。如果您正苦于以下问题:Java Utils.calcTextSize方法的具体用法?Java Utils.calcTextSize怎么用?Java Utils.calcTextSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.github.mikephil.charting.utils.Utils
的用法示例。
在下文中一共展示了Utils.calcTextSize方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: computeSize
import com.github.mikephil.charting.utils.Utils; //导入方法依赖的package包/类
@Override
protected void computeSize() {
mAxisLabelPaint.setTypeface(mXAxis.getTypeface());
mAxisLabelPaint.setTextSize(mXAxis.getTextSize());
String longest = mXAxis.getLongestLabel();
final FSize labelSize = Utils.calcTextSize(mAxisLabelPaint, longest);
final float labelWidth = (int)(labelSize.width + mXAxis.getXOffset() * 3.5f);
final float labelHeight = labelSize.height;
final FSize labelRotatedSize = Utils.getSizeOfRotatedRectangleByDegrees(
labelSize.width,
labelHeight,
mXAxis.getLabelRotationAngle());
mXAxis.mLabelWidth = Math.round(labelWidth);
mXAxis.mLabelHeight = Math.round(labelHeight);
mXAxis.mLabelRotatedWidth = (int)(labelRotatedSize.width + mXAxis.getXOffset() * 3.5f);
mXAxis.mLabelRotatedHeight = Math.round(labelRotatedSize.height);
FSize.recycleInstance(labelRotatedSize);
}
示例2: computeSize
import com.github.mikephil.charting.utils.Utils; //导入方法依赖的package包/类
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);
}
示例3: computeAxis
import com.github.mikephil.charting.utils.Utils; //导入方法依赖的package包/类
@Override
public void computeAxis(float xValAverageLength, List<String> xValues) {
mAxisLabelPaint.setTypeface(mXAxis.getTypeface());
mAxisLabelPaint.setTextSize(mXAxis.getTextSize());
mXAxis.setValues(xValues);
String longest = mXAxis.getLongestLabel();
final FSize labelSize = Utils.calcTextSize(mAxisLabelPaint, longest);
final float labelWidth = (int)(labelSize.width + mXAxis.getXOffset() * 3.5f);
final float labelHeight = labelSize.height;
final FSize labelRotatedSize = Utils.getSizeOfRotatedRectangleByDegrees(
labelSize.width,
labelHeight,
mXAxis.getLabelRotationAngle());
mXAxis.mLabelWidth = Math.round(labelWidth);
mXAxis.mLabelHeight = Math.round(labelHeight);
mXAxis.mLabelRotatedWidth = (int)(labelRotatedSize.width + mXAxis.getXOffset() * 3.5f);
mXAxis.mLabelRotatedHeight = Math.round(labelRotatedSize.height);
}
示例4: computeAxis
import com.github.mikephil.charting.utils.Utils; //导入方法依赖的package包/类
public void computeAxis(float xValMaximumLength, List<String> xValues) {
mAxisLabelPaint.setTypeface(mXAxis.getTypeface());
mAxisLabelPaint.setTextSize(mXAxis.getTextSize());
StringBuilder widthText = new StringBuilder();
int xValChars = Math.round(xValMaximumLength);
for (int i = 0; i < xValChars; i++) {
widthText.append('h');
}
final FSize labelSize = Utils.calcTextSize(mAxisLabelPaint, widthText.toString());
final float labelWidth = labelSize.width;
final float labelHeight = Utils.calcTextHeight(mAxisLabelPaint, "Q");
final FSize labelRotatedSize = Utils.getSizeOfRotatedRectangleByDegrees(
labelWidth,
labelHeight,
mXAxis.getLabelRotationAngle());
StringBuilder space = new StringBuilder();
int xValSpaceChars = mXAxis.getSpaceBetweenLabels();
for (int i = 0; i < xValSpaceChars; i++) {
space.append('h');
}
final FSize spaceSize = Utils.calcTextSize(mAxisLabelPaint, space.toString());
mXAxis.mLabelWidth = Math.round(labelWidth + spaceSize.width);
mXAxis.mLabelHeight = Math.round(labelHeight);
mXAxis.mLabelRotatedWidth = Math.round(labelRotatedSize.width + spaceSize.width);
mXAxis.mLabelRotatedHeight = Math.round(labelRotatedSize.height);
mXAxis.setValues(xValues);
}