Java Code Examples for com.github.mikephil.charting.utils.Utils#calcTextSize()
The following examples show how to use
com.github.mikephil.charting.utils.Utils#calcTextSize() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: XAxisRendererHorizontalBarChart.java From StockChart-MPAndroidChart with MIT License | 6 votes |
@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); }
Example 2
Source File: XAxisRenderer.java From StockChart-MPAndroidChart with MIT License | 6 votes |
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); }
Example 3
Source File: XAxisRendererHorizontalBarChart.java From Ticket-Analysis with MIT License | 6 votes |
@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); }
Example 4
Source File: XAxisRenderer.java From Ticket-Analysis with MIT License | 6 votes |
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); }
Example 5
Source File: XAxisRendererHorizontalBarChart.java From android-kline with Apache License 2.0 | 6 votes |
@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); }
Example 6
Source File: XAxisRenderer.java From android-kline with Apache License 2.0 | 6 votes |
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); }
Example 7
Source File: XAxisRendererHorizontalBarChart.java From Stayfit with Apache License 2.0 | 6 votes |
@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); }
Example 8
Source File: XAxisRendererHorizontalBarChart.java From NetKnight with Apache License 2.0 | 6 votes |
@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); }
Example 9
Source File: XAxisRenderer.java From Stayfit with Apache License 2.0 | 5 votes |
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); }
Example 10
Source File: XAxisRenderer.java From NetKnight with Apache License 2.0 | 5 votes |
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); }