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 @@ -26,7 +26,7 @@ import info.appdev.charting.highlight.Highlight
import info.appdev.charting.interfaces.datasets.IBarDataSet
import info.appdev.charting.listener.OnChartValueSelectedListener
import info.appdev.charting.utils.Fill
import info.appdev.charting.utils.MPPointF
import info.appdev.charting.utils.PointF
import info.appdev.chartexample.DataTools.Companion.getValues
import info.appdev.chartexample.custom.XYMarkerView
import info.appdev.chartexample.databinding.ActivityBarchartBinding
Expand Down Expand Up @@ -288,7 +288,7 @@ class BarChartActivity : DemoBase(), OnSeekBarChangeListener, OnChartValueSelect
Timber.i("position = $position")
Timber.i("x-index low: ${+binding.chart1.lowestVisibleX}, high: ${+binding.chart1.highestVisibleX}")

MPPointF.recycleInstance(position)
PointF.recycleInstance(position)
}

override fun onNothingSelected() = Unit
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import info.appdev.charting.highlight.Highlight
import info.appdev.charting.interfaces.datasets.IBubbleDataSet
import info.appdev.charting.listener.OnChartValueSelectedListener
import info.appdev.charting.utils.ColorTemplate
import info.appdev.charting.utils.MPPointF
import info.appdev.charting.utils.PointF
import info.appdev.chartexample.DataTools.Companion.getValues
import info.appdev.chartexample.databinding.ActivityBubblechartBinding
import info.appdev.chartexample.notimportant.DemoBase
Expand Down Expand Up @@ -115,7 +115,7 @@ class BubbleChartActivity : DemoBase(), OnSeekBarChangeListener, OnChartValueSel

val set2 = BubbleDataSet(values2, "DS 2")
set2.isDrawIcons = false
set2.iconsOffset = MPPointF(0f, 15f)
set2.iconsOffset = PointF(0f, 15f)
set2.setColor(ColorTemplate.COLORFUL_COLORS[1], 130)
set2.isDrawValues = true

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import info.appdev.charting.data.Entry
import info.appdev.charting.highlight.Highlight
import info.appdev.charting.interfaces.datasets.IBarDataSet
import info.appdev.charting.listener.OnChartValueSelectedListener
import info.appdev.charting.utils.MPPointF
import info.appdev.charting.utils.PointF
import info.appdev.chartexample.DataTools.Companion.getValues
import info.appdev.chartexample.databinding.ActivityHorizontalbarchartBinding
import info.appdev.chartexample.notimportant.DemoBase
Expand Down Expand Up @@ -245,7 +245,7 @@ class HorizontalBarChartActivity : DemoBase(), OnSeekBarChangeListener, OnChartV
Timber.i(bounds.toString())
Timber.i(position.toString())

MPPointF.recycleInstance(position)
PointF.recycleInstance(position)
}

override fun onNothingSelected() {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import info.appdev.charting.data.Entry
import info.appdev.charting.highlight.Highlight
import info.appdev.charting.interfaces.datasets.IBarDataSet
import info.appdev.charting.listener.OnChartValueSelectedListener
import info.appdev.charting.utils.MPPointF
import info.appdev.charting.utils.PointF
import info.appdev.chartexample.DataTools.Companion.getValues
import info.appdev.chartexample.databinding.ActivityHorizontalbarchartBinding
import info.appdev.chartexample.notimportant.DemoBase
Expand Down Expand Up @@ -241,7 +241,7 @@ class HorizontalBarNegativeChartActivity : DemoBase(), OnSeekBarChangeListener,
Timber.i("bounds $bounds")
Timber.i("position $position")

MPPointF.recycleInstance(position)
PointF.recycleInstance(position)
}

override fun onNothingSelected() {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import info.appdev.charting.formatter.PercentFormatter
import info.appdev.charting.highlight.Highlight
import info.appdev.charting.listener.OnChartValueSelectedListener
import info.appdev.charting.utils.ColorTemplate
import info.appdev.charting.utils.MPPointF
import info.appdev.charting.utils.PointF
import info.appdev.chartexample.DataTools.Companion.getValues
import info.appdev.chartexample.databinding.ActivityPiechartBinding
import info.appdev.chartexample.notimportant.DemoBase
Expand Down Expand Up @@ -119,7 +119,7 @@ class PieChartActivity : DemoBase(), OnSeekBarChangeListener, OnChartValueSelect
dataSet.isDrawIcons = false

dataSet.sliceSpace = 3f
dataSet.iconsOffset = MPPointF(0f, 40f)
dataSet.iconsOffset = PointF(0f, 40f)
dataSet.selectionShift = 5f

// add a lot of colors
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import info.appdev.charting.highlight.Highlight
import info.appdev.charting.listener.OnChartValueSelectedListener
import info.appdev.charting.renderer.PieChartRenderer
import info.appdev.charting.utils.ColorTemplate
import info.appdev.charting.utils.MPPointF
import info.appdev.charting.utils.PointF
import info.appdev.chartexample.DataTools.Companion.getValues
import info.appdev.chartexample.databinding.ActivityPiechartBinding
import info.appdev.chartexample.notimportant.DemoBase
Expand Down Expand Up @@ -120,7 +120,7 @@ class PieChartRoundedActivity : DemoBase(), OnSeekBarChangeListener, OnChartValu
dataSet.isDrawIcons = false

dataSet.sliceSpace = 3f
dataSet.iconsOffset = MPPointF(0f, 40f)
dataSet.iconsOffset = PointF(0f, 40f)
dataSet.selectionShift = 5f

// add a lot of colors
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ import info.appdev.charting.data.Entry
import info.appdev.charting.highlight.Highlight
import info.appdev.charting.interfaces.datasets.IBarDataSet
import info.appdev.charting.listener.OnChartValueSelectedListener
import info.appdev.charting.utils.MPPointF
import info.appdev.charting.utils.PointF
import info.appdev.chartexample.DataTools.Companion.getValues
import info.appdev.chartexample.R
import info.appdev.chartexample.notimportant.DemoBaseCompose
Expand Down Expand Up @@ -281,7 +281,7 @@ class HorizontalBarComposeActivity : DemoBaseCompose() {
Timber.tag("bounds $bounds")
Timber.tag("position $position")

MPPointF.recycleInstance(position)
PointF.recycleInstance(position)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import info.appdev.charting.components.MarkerView
import info.appdev.charting.data.CandleEntry
import info.appdev.charting.data.Entry
import info.appdev.charting.highlight.Highlight
import info.appdev.charting.utils.MPPointF
import info.appdev.charting.utils.PointF
import info.appdev.charting.utils.formatNumber
import info.appdev.chartexample.R

Expand All @@ -31,6 +31,6 @@ class MyMarkerView(context: Context?, layoutResource: Int) : MarkerView(context,
super.refreshContent(entry, highlight)
}

override var offset: MPPointF = MPPointF()
get() = MPPointF(-(width / 2).toFloat(), -height.toFloat())
override var offset: PointF = PointF()
get() = PointF(-(width / 2).toFloat(), -height.toFloat())
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import android.widget.TextView
import info.appdev.charting.components.MarkerView
import info.appdev.charting.data.Entry
import info.appdev.charting.highlight.Highlight
import info.appdev.charting.utils.MPPointF
import info.appdev.charting.utils.PointF
import info.appdev.chartexample.R
import java.text.DecimalFormat

Expand All @@ -31,6 +31,6 @@ class RadarMarkerView(context: Context, layoutResource: Int) : MarkerView(contex
super.refreshContent(entry, highlight)
}

override var offset: MPPointF = MPPointF()
get() = MPPointF(-(width / 2).toFloat(), (-height - 10).toFloat())
override var offset: PointF = PointF()
get() = PointF(-(width / 2).toFloat(), (-height - 10).toFloat())
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import info.appdev.charting.components.MarkerView
import info.appdev.charting.data.BarEntry
import info.appdev.charting.data.Entry
import info.appdev.charting.highlight.Highlight
import info.appdev.charting.utils.MPPointF
import info.appdev.charting.utils.PointF
import info.appdev.charting.utils.formatNumber
import info.appdev.chartexample.R

Expand Down Expand Up @@ -37,6 +37,6 @@ class StackedBarsMarkerView(context: Context?, layoutResource: Int) : MarkerView
super.refreshContent(entry, highlight)
}

override var offset: MPPointF = MPPointF()
get() = MPPointF(-(width / 2).toFloat(), -height.toFloat())
override var offset: PointF = PointF()
get() = PointF(-(width / 2).toFloat(), -height.toFloat())
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import info.appdev.charting.components.MarkerView
import info.appdev.charting.data.Entry
import info.appdev.charting.formatter.IAxisValueFormatter
import info.appdev.charting.highlight.Highlight
import info.appdev.charting.utils.MPPointF
import info.appdev.charting.utils.PointF
import info.appdev.chartexample.R
import java.text.DecimalFormat

Expand All @@ -27,6 +27,6 @@ class XYMarkerView(context: Context?, private val xAxisValueFormatter: IAxisValu
super.refreshContent(entry, highlight)
}

override var offset: MPPointF = MPPointF()
get() = MPPointF(-(width / 2).toFloat(), -height.toFloat())
override var offset: PointF = PointF()
get() = PointF(-(width / 2).toFloat(), -height.toFloat())
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ import info.appdev.charting.listener.BarLineChartTouchListener
import info.appdev.charting.listener.OnDrawListener
import info.appdev.charting.renderer.XAxisRenderer
import info.appdev.charting.renderer.YAxisRenderer
import info.appdev.charting.utils.MPPointD
import info.appdev.charting.utils.MPPointD.Companion.getInstance
import info.appdev.charting.utils.MPPointD.Companion.recycleInstance
import info.appdev.charting.utils.MPPointF
import info.appdev.charting.utils.MPPointF.Companion.getInstance
import info.appdev.charting.utils.MPPointF.Companion.recycleInstance
import info.appdev.charting.utils.PointD
import info.appdev.charting.utils.PointD.Companion.getInstance
import info.appdev.charting.utils.PointD.Companion.recycleInstance
import info.appdev.charting.utils.PointF
import info.appdev.charting.utils.PointF.Companion.getInstance
import info.appdev.charting.utils.PointF.Companion.recycleInstance
import info.appdev.charting.utils.Transformer
import info.appdev.charting.utils.convertDpToPixel
import timber.log.Timber
Expand Down Expand Up @@ -951,11 +951,11 @@ abstract class BarLineChartBase<T : BarLineScatterCandleBubbleData<IBarLineScatt
protected var mGetPositionBuffer: FloatArray = FloatArray(2)

/**
* Returns a recyclable MPPointF instance.
* Returns a recyclable PointF instance.
* Returns the position (in pixels) the provided Entry has inside the chart
* view or null, if the provided Entry is null.
*/
open fun getPosition(e: Entry?, axis: AxisDependency?): MPPointF? {
open fun getPosition(e: Entry?, axis: AxisDependency?): PointF? {
if (e == null) {
return null
}
Expand Down Expand Up @@ -1054,28 +1054,28 @@ abstract class BarLineChartBase<T : BarLineScatterCandleBubbleData<IBarLineScatt
}

/**
* Returns a recyclable MPPointD instance
* Returns a recyclable PointD instance
* Returns the x and y values in the chart at the given touch point
* (encapsulated in a MPPointD). This method transforms pixel coordinates to
* (encapsulated in a PointD). This method transforms pixel coordinates to
* coordinates / values in the chart. This is the opposite method to
* getPixelForValues(...).
*/
fun getValuesByTouchPoint(x: Float, y: Float, axis: AxisDependency?): MPPointD {
fun getValuesByTouchPoint(x: Float, y: Float, axis: AxisDependency?): PointD {
val result = getInstance(0.0, 0.0)
getValuesByTouchPoint(x, y, axis, result)
return result
}

fun getValuesByTouchPoint(x: Float, y: Float, axis: AxisDependency?, outputPoint: MPPointD) {
fun getValuesByTouchPoint(x: Float, y: Float, axis: AxisDependency?, outputPoint: PointD) {
getTransformer(axis).getValuesByTouchPoint(x, y, outputPoint)
}

/**
* Returns a recyclable MPPointD instance
* Returns a recyclable PointD instance
* Transforms the given chart values into pixels. This is the opposite
* method to getValuesByTouchPoint(...).
*/
fun getPixelForValues(x: Float, y: Float, axis: AxisDependency?): MPPointD {
fun getPixelForValues(x: Float, y: Float, axis: AxisDependency?): PointD {
return getTransformer(axis).getPixelForValues(x, y)
}

Expand Down Expand Up @@ -1104,7 +1104,7 @@ abstract class BarLineChartBase<T : BarLineScatterCandleBubbleData<IBarLineScatt
/**
* buffer for storing lowest visible x point
*/
protected var posForGetLowestVisibleX: MPPointD = getInstance(0.0, 0.0)
protected var posForGetLowestVisibleX: PointD = getInstance(0.0, 0.0)

override val lowestVisibleX: Float
/**
Expand All @@ -1118,7 +1118,7 @@ abstract class BarLineChartBase<T : BarLineScatterCandleBubbleData<IBarLineScatt
/**
* buffer for storing highest visible x point
*/
protected var posForGetHighestVisibleX: MPPointD = getInstance(0.0, 0.0)
protected var posForGetHighestVisibleX: PointD = getInstance(0.0, 0.0)

override val highestVisibleX: Float
/**
Expand Down
16 changes: 8 additions & 8 deletions chartLib/src/main/kotlin/info/appdev/charting/charts/Chart.kt
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ import info.appdev.charting.listener.OnChartGestureListener
import info.appdev.charting.listener.OnChartValueSelectedListener
import info.appdev.charting.renderer.DataRenderer
import info.appdev.charting.renderer.LegendRenderer
import info.appdev.charting.utils.MPPointF
import info.appdev.charting.utils.MPPointF.Companion.getInstance
import info.appdev.charting.utils.PointF
import info.appdev.charting.utils.PointF.Companion.getInstance
import info.appdev.charting.utils.SaveUtils.saveToGallery
import info.appdev.charting.utils.SaveUtils.saveToPath
import info.appdev.charting.utils.Utils
Expand Down Expand Up @@ -936,16 +936,16 @@ abstract class Chart<T : ChartData<out IDataSet<out Entry>>?> : ViewGroup, IBase
override val xRange: Float
get() = mXAxis.mAxisRange

val center: MPPointF
val center: PointF
/**
* Returns a recyclable MPPointF instance.
* Returns a recyclable PointF instance.
* Returns the center point of the chart (the whole View) in pixels.
*/
get() = getInstance(width / 2f, height / 2f)

override val centerOffsets: MPPointF
override val centerOffsets: PointF
/**
* Returns a recyclable MPPointF instance.
* Returns a recyclable PointF instance.
* Returns the center of the chart taking offsets under consideration.
* (returns the center of the content rectangle)
*/
Expand Down Expand Up @@ -1165,9 +1165,9 @@ abstract class Chart<T : ChartData<out IDataSet<out Entry>>?> : ViewGroup, IBase
this.highlighter = highlighter
}

override val centerOfView: MPPointF
override val centerOfView: PointF
/**
* Returns a recyclable MPPointF instance.
* Returns a recyclable PointF instance.
*/
get() = this.center

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ import info.appdev.charting.renderer.HorizontalBarChartRenderer
import info.appdev.charting.renderer.XAxisRendererHorizontalBarChart
import info.appdev.charting.renderer.YAxisRendererHorizontalBarChart
import info.appdev.charting.utils.HorizontalViewPortHandler
import info.appdev.charting.utils.MPPointF
import info.appdev.charting.utils.MPPointF.Companion.getInstance
import info.appdev.charting.utils.PointF
import info.appdev.charting.utils.PointF.Companion.getInstance
import info.appdev.charting.utils.TransformerHorizontalBarChart
import info.appdev.charting.utils.convertDpToPixel
import timber.log.Timber
Expand Down Expand Up @@ -231,9 +231,9 @@ open class HorizontalBarChart : BarChart {
protected var getPositionBuffer: FloatArray = FloatArray(2)

/**
* Returns a recyclable MPPointF instance.
* Returns a recyclable PointF instance.
*/
override fun getPosition(e: Entry?, axis: AxisDependency?): MPPointF? {
override fun getPosition(e: Entry?, axis: AxisDependency?): PointF? {
if (e == null) {
return null
}
Expand Down
10 changes: 5 additions & 5 deletions chartLib/src/main/kotlin/info/appdev/charting/charts/PieChart.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import info.appdev.charting.data.PieData
import info.appdev.charting.highlight.Highlight
import info.appdev.charting.highlight.PieHighlighter
import info.appdev.charting.renderer.PieChartRenderer
import info.appdev.charting.utils.MPPointF
import info.appdev.charting.utils.MPPointF.Companion.getInstance
import info.appdev.charting.utils.MPPointF.Companion.recycleInstance
import info.appdev.charting.utils.PointF
import info.appdev.charting.utils.PointF.Companion.getInstance
import info.appdev.charting.utils.PointF.Companion.recycleInstance
import info.appdev.charting.utils.Utils
import info.appdev.charting.utils.convertDpToPixel
import java.util.Locale
Expand Down Expand Up @@ -421,7 +421,7 @@ class PieChart : PieRadarChartBase<PieData> {
return min(circleBox.width() / 2f, circleBox.height() / 2f)
}

val centerCircleBox: MPPointF
val centerCircleBox: PointF
get() = getInstance(circleBox.centerX(), circleBox.centerY())

fun setCenterTextTypeface(t: Typeface?) {
Expand Down Expand Up @@ -450,7 +450,7 @@ class PieChart : PieRadarChartBase<PieData> {
mCenterTextOffset.y = y.convertDpToPixel()
}

val centerTextOffset: MPPointF
val centerTextOffset: PointF
/**
* Returns the offset on the x- and y-axis the center text has in dp.
*/
Expand Down
Loading
Loading