Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ protected void drawDescription(Canvas c) {
y = position.y;
}

c.drawText(mDescription.getText(), x, y, mDescPaint);
c.drawText(mDescription.text, x, y, mDescPaint);
}
}

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
package com.github.mikephil.charting.components

import android.graphics.Paint.Align
import com.github.mikephil.charting.utils.MPPointF
import com.github.mikephil.charting.utils.Utils

class Description : ComponentBase() {
/**
* Sets the text to be shown as the description.
* Never set this to null as this will cause nullpointer exception when drawing with Android Canvas.
*
* @param text
*/
@JvmField
var text: String? = "Description Label"

/**
* Returns the customized position of the description, or null if none set.
*
* @return
*/
/**
* the custom position of the description text
*/
var position: MPPointF? = null
private set

/**
* Sets the text alignment of the description text. Default RIGHT.
*/
/**
* the alignment of the description text
*/
var textAlign: Align? = Align.RIGHT

init {
// default size
mTextSize = Utils.convertDpToPixel(8f)
}

/**
* Sets a custom position for the description text in pixels on the screen.
*
* @param x - xcoordinate
* @param y - ycoordinate
*/
fun setPosition(x: Float, y: Float) {
if (this.position == null) {
this.position = MPPointF.getInstance(x, y)
} else {
position!!.x = x
position!!.y = y
}
}
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package com.github.mikephil.charting.components

import android.graphics.Canvas
import com.github.mikephil.charting.data.Entry
import com.github.mikephil.charting.highlight.Highlight
import com.github.mikephil.charting.utils.MPPointF

interface IMarker {
/**
* @return The desired (general) offset you wish the IMarker to have on the x- and y-axis.
* By returning x: -(width / 2) you will center the IMarker horizontally.
* By returning y: -(height / 2) you will center the IMarker vertically.
*/
val offset: MPPointF

/**
* @return The offset for drawing at the specific `point`. This allows conditional adjusting of the Marker position.
* If you have no adjustments to make, return getOffset().
*
* @param posX This is the X position at which the marker wants to be drawn.
* You can adjust the offset conditionally based on this argument.
* @param posY This is the X position at which the marker wants to be drawn.
* You can adjust the offset conditionally based on this argument.
*/
fun getOffsetForDrawingAtPoint(posX: Float, posY: Float): MPPointF?

/**
* This method enables a specified custom IMarker to update it's content every time the IMarker is redrawn.
*
* @param entry The Entry the IMarker belongs to. This can also be any subclass of Entry, like BarEntry or
* CandleEntry, simply cast it at runtime.
* @param highlight The highlight object contains information about the highlighted value such as it's dataset-index, the
* selected range or stack-index (only stacked bar entries).
*/
fun refreshContent(entry: Entry, highlight: Highlight)

/**
* Draws the IMarker on the given position on the screen with the given Canvas object.
*
* @param canvas
* @param posX
* @param posY
*/
fun draw(canvas: Canvas, posX: Float, posY: Float)
}
Loading
Loading