Skip to content

Commit ab28c20

Browse files
committed
Kotlin of some components
1 parent f01d647 commit ab28c20

File tree

11 files changed

+295
-396
lines changed

11 files changed

+295
-396
lines changed

MPChartLib/src/main/java/com/github/mikephil/charting/charts/Chart.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ protected void drawDescription(Canvas c) {
439439
y = position.y;
440440
}
441441

442-
c.drawText(mDescription.getText(), x, y, mDescPaint);
442+
c.drawText(mDescription.text, x, y, mDescPaint);
443443
}
444444
}
445445

MPChartLib/src/main/java/com/github/mikephil/charting/components/Description.java

Lines changed: 0 additions & 95 deletions
This file was deleted.
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
package com.github.mikephil.charting.components
2+
3+
import android.graphics.Paint.Align
4+
import com.github.mikephil.charting.utils.MPPointF
5+
import com.github.mikephil.charting.utils.Utils
6+
7+
class Description : ComponentBase() {
8+
/**
9+
* Sets the text to be shown as the description.
10+
* Never set this to null as this will cause nullpointer exception when drawing with Android Canvas.
11+
*
12+
* @param text
13+
*/
14+
@JvmField
15+
var text: String? = "Description Label"
16+
17+
/**
18+
* Returns the customized position of the description, or null if none set.
19+
*
20+
* @return
21+
*/
22+
/**
23+
* the custom position of the description text
24+
*/
25+
var position: MPPointF? = null
26+
private set
27+
28+
/**
29+
* Sets the text alignment of the description text. Default RIGHT.
30+
*/
31+
/**
32+
* the alignment of the description text
33+
*/
34+
var textAlign: Align? = Align.RIGHT
35+
36+
init {
37+
// default size
38+
mTextSize = Utils.convertDpToPixel(8f)
39+
}
40+
41+
/**
42+
* Sets a custom position for the description text in pixels on the screen.
43+
*
44+
* @param x - xcoordinate
45+
* @param y - ycoordinate
46+
*/
47+
fun setPosition(x: Float, y: Float) {
48+
if (this.position == null) {
49+
this.position = MPPointF.getInstance(x, y)
50+
} else {
51+
position!!.x = x
52+
position!!.y = y
53+
}
54+
}
55+
}

MPChartLib/src/main/java/com/github/mikephil/charting/components/MarkerImage.java

Lines changed: 0 additions & 167 deletions
This file was deleted.

0 commit comments

Comments
 (0)