com.github.mikephil.charting.utils.FSize Java Examples
The following examples show how to use
com.github.mikephil.charting.utils.FSize.
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 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 #6
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 #7
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 #8
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 #9
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); }
Example #10
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 #11
Source File: Legend.java From NetKnight with Apache License 2.0 | 4 votes |
public FSize[] getCalculatedLineSizes() { return mCalculatedLineSizes; }
Example #12
Source File: ChartUtils.java From fingen with Apache License 2.0 | 4 votes |
public static void drawXAxisValue(Canvas c, String text, float x, float y, Paint paint, PointF anchor, float angleDegrees, int color) { float drawOffsetX = 0.f; float drawOffsetY = 0.f; final float lineHeight = paint.getFontMetrics(mFontMetricsBuffer); paint.getTextBounds(text, 0, text.length(), mDrawTextRectBuffer); // Android sometimes has pre-padding drawOffsetX -= mDrawTextRectBuffer.left; // Android does not snap the bounds to line boundaries, // and draws from bottom to top. // And we want to normalize it. drawOffsetY += -mFontMetricsBuffer.ascent; // To have a consistent point of reference, we always draw left-aligned Paint.Align originalTextAlign = paint.getTextAlign(); paint.setTextAlign(Paint.Align.LEFT); Paint.Style oldStyle = paint.getStyle(); paint.setStyle(Paint.Style.STROKE); float oldStroleWidth = paint.getStrokeWidth(); paint.setStrokeWidth(ScreenUtils.dpToPx(3f, FGApplication.getContext())); int oldColor = paint.getColor(); paint.setColor(color); if (angleDegrees != 0.f) { // Move the text drawing rect in a way that it always rotates around its center drawOffsetX -= mDrawTextRectBuffer.width() * 0.5f; drawOffsetY -= lineHeight * 0.5f; float translateX = x; float translateY = y; // Move the "outer" rect relative to the anchor, assuming its centered if (anchor.x != 0.5f || anchor.y != 0.5f) { final FSize rotatedSize = getSizeOfRotatedRectangleByDegrees( mDrawTextRectBuffer.width(), lineHeight, angleDegrees); translateX -= rotatedSize.width * (anchor.x - 0.5f); translateY -= rotatedSize.height * (anchor.y - 0.5f); } c.save(); c.translate(translateX, translateY); c.rotate(angleDegrees); c.drawText(text, drawOffsetX, drawOffsetY, paint); c.restore(); } else { if (anchor.x != 0.f || anchor.y != 0.f) { drawOffsetX -= mDrawTextRectBuffer.width() * anchor.x; drawOffsetY -= lineHeight * anchor.y; } drawOffsetX += x; drawOffsetY += y; c.drawText(text, drawOffsetX, drawOffsetY, paint); } paint.setTextAlign(originalTextAlign); paint.setStyle(oldStyle); paint.setStrokeWidth(oldStroleWidth); paint.setColor(oldColor); }
Example #13
Source File: Legend.java From NetKnight with Apache License 2.0 | 4 votes |
public FSize[] getCalculatedLabelSizes() { return mCalculatedLabelSizes; }
Example #14
Source File: Legend.java From Stayfit with Apache License 2.0 | 4 votes |
public FSize[] getCalculatedLineSizes() { return mCalculatedLineSizes; }
Example #15
Source File: Legend.java From Stayfit with Apache License 2.0 | 4 votes |
public FSize[] getCalculatedLabelSizes() { return mCalculatedLabelSizes; }
Example #16
Source File: Legend.java From iMoney with Apache License 2.0 | 4 votes |
public FSize[] getCalculatedLineSizes() { return mCalculatedLineSizes; }
Example #17
Source File: Legend.java From iMoney with Apache License 2.0 | 4 votes |
public FSize[] getCalculatedLabelSizes() { return mCalculatedLabelSizes; }
Example #18
Source File: Legend.java From android-kline with Apache License 2.0 | 4 votes |
public List<FSize> getCalculatedLineSizes() { return mCalculatedLineSizes; }
Example #19
Source File: Legend.java From android-kline with Apache License 2.0 | 4 votes |
public List<FSize> getCalculatedLabelSizes() { return mCalculatedLabelSizes; }
Example #20
Source File: MarkerImage.java From android-kline with Apache License 2.0 | 4 votes |
public FSize getSize() { return mSize; }
Example #21
Source File: Legend.java From Ticket-Analysis with MIT License | 4 votes |
public List<FSize> getCalculatedLineSizes() { return mCalculatedLineSizes; }
Example #22
Source File: Legend.java From Ticket-Analysis with MIT License | 4 votes |
public List<FSize> getCalculatedLabelSizes() { return mCalculatedLabelSizes; }
Example #23
Source File: MarkerImage.java From Ticket-Analysis with MIT License | 4 votes |
public FSize getSize() { return mSize; }
Example #24
Source File: Legend.java From StockChart-MPAndroidChart with MIT License | 4 votes |
public List<FSize> getCalculatedLineSizes() { return mCalculatedLineSizes; }
Example #25
Source File: Legend.java From StockChart-MPAndroidChart with MIT License | 4 votes |
public List<FSize> getCalculatedLabelSizes() { return mCalculatedLabelSizes; }
Example #26
Source File: MarkerImage.java From StockChart-MPAndroidChart with MIT License | 4 votes |
public FSize getSize() { return mSize; }