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
1 change: 1 addition & 0 deletions MPChartLib/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ dependencies {
implementation("androidx.annotation:annotation:1.9.1")
implementation("androidx.core:core:1.17.0")
implementation("androidx.activity:activity-ktx:1.12.2")
implementation("com.github.AppDevNext.Logcat:LogcatCoreLib:3.4")
testImplementation("junit:junit:4.13.2")
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ package com.github.mikephil.charting.charts
import android.content.Context
import android.graphics.RectF
import android.util.AttributeSet
import android.util.Log
import com.github.mikephil.charting.components.YAxis
import com.github.mikephil.charting.data.BarData
import com.github.mikephil.charting.data.BarEntry
import com.github.mikephil.charting.highlight.BarHighlighter
import com.github.mikephil.charting.highlight.Highlight
import com.github.mikephil.charting.interfaces.dataprovider.BarDataProvider
import com.github.mikephil.charting.renderer.BarChartRenderer
import timber.log.Timber
import java.util.Locale

/**
Expand Down Expand Up @@ -105,7 +105,7 @@ open class BarChart : BarLineChartBase<BarData>, BarDataProvider {
*/
override fun getHighlightByTouchPoint(x: Float, y: Float): Highlight? {
if (mData == null) {
Log.e(LOG_TAG, "Can't select by touch. No data set.")
Timber.e("Can't select by touch. No data set.")
return null
} else {
highlighter?.let {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import com.github.mikephil.charting.utils.UtilsKtKt;

import androidx.annotation.NonNull;
import timber.log.Timber;

/**
* Base-class of LineChart, BarChart, ScatterChart and CandleStickChart.
Expand Down Expand Up @@ -320,7 +321,7 @@ protected void onDraw(@NonNull Canvas canvas) {
totalTime += drawtime;
drawCycles += 1;
long average = totalTime / drawCycles;
Log.i(LOG_TAG, "Drawtime: " + drawtime + " ms, average: " + average + " ms, cycles: " + drawCycles);
Timber.i("Drawtime: " + drawtime + " ms, average: " + average + " ms, cycles: " + drawCycles);
}
}

Expand All @@ -335,7 +336,7 @@ public void resetTracking() {
protected void prepareValuePxMatrix() {

if (isLogEnabled()) {
Log.i(LOG_TAG, "Preparing Value-Px Matrix, xmin: " + mXAxis.mAxisMinimum + ", xmax: " + mXAxis.mAxisMaximum + ", xdelta: " + mXAxis.mAxisRange);
Timber.i("Preparing Value-Px Matrix, xmin: " + mXAxis.mAxisMinimum + ", xmax: " + mXAxis.mAxisMaximum + ", xdelta: " + mXAxis.mAxisRange);
}

mRightAxisTransformer.prepareMatrixValuePx(mXAxis.mAxisMinimum, mXAxis.mAxisRange, mAxisRight.mAxisRange, mAxisRight.mAxisMinimum);
Expand All @@ -353,12 +354,12 @@ public void notifyDataSetChanged() {

if (mData == null) {
if (isLogEnabled()) {
Log.i(LOG_TAG, "Preparing... DATA NOT SET.");
Timber.i("Preparing... DATA NOT SET.");
}
return;
} else {
if (isLogEnabled()) {
Log.i(LOG_TAG, "Preparing...");
Timber.i("Preparing data...");
}
}

Expand Down Expand Up @@ -520,8 +521,8 @@ public void calculateOffsets() {
getViewPortHandler().restrainViewPort(Math.max(minOffset, offsetLeft), Math.max(minOffset, offsetTop), Math.max(minOffset, offsetRight), Math.max(minOffset, offsetBottom));

if (isLogEnabled()) {
Log.i(LOG_TAG, "offsetLeft: " + offsetLeft + ", offsetTop: " + offsetTop + ", offsetRight: " + offsetRight + ", offsetBottom: " + offsetBottom);
Log.i(LOG_TAG, "Content: " + getViewPortHandler().getContentRect());
Timber.i("offsetLeft: " + offsetLeft + ", offsetTop: " + offsetTop + ", offsetRight: " + offsetRight + ", offsetBottom: " + offsetBottom);
Timber.i("Content: " + getViewPortHandler().getContentRect());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import android.graphics.RectF
import android.graphics.Typeface
import android.text.TextUtils
import android.util.AttributeSet
import android.util.Log
import android.view.View
import android.view.ViewGroup
import android.view.accessibility.AccessibilityEvent
Expand Down Expand Up @@ -45,6 +44,7 @@ import com.github.mikephil.charting.utils.ViewPortHandler
import com.github.mikephil.charting.utils.convertDpToPixel
import com.github.mikephil.charting.utils.getDecimals
import com.github.mikephil.charting.utils.initUtils
import timber.log.Timber
import kotlin.math.abs
import kotlin.math.max

Expand Down Expand Up @@ -274,7 +274,7 @@ abstract class Chart<T : ChartData<out IDataSet<out Entry>>?> : ViewGroup, IBase
mInfoPaint!!.textSize = 12f.convertDpToPixel()

if (this.isLogEnabled) {
Log.i("", "Chart.init()")
Timber.i("Chart.init()")

// enable being detected by ScreenReader
setFocusable(true)
Expand Down Expand Up @@ -339,7 +339,7 @@ abstract class Chart<T : ChartData<out IDataSet<out Entry>>?> : ViewGroup, IBase
notifyDataSetChanged()

if (this.isLogEnabled) {
Log.i(LOG_TAG, "Data is set.")
Timber.i("Data is set.")
}
}

Expand Down Expand Up @@ -649,7 +649,7 @@ abstract class Chart<T : ChartData<out IDataSet<out Entry>>?> : ViewGroup, IBase
this.highlighted = null
} else {
if (this.isLogEnabled) {
Log.i(LOG_TAG, "Highlighted: $high")
Timber.i("Highlighted: $high")
}

entry = mData!!.getEntryForHighlight(high)
Expand Down Expand Up @@ -685,7 +685,7 @@ abstract class Chart<T : ChartData<out IDataSet<out Entry>>?> : ViewGroup, IBase
*/
open fun getHighlightByTouchPoint(x: Float, y: Float): Highlight? {
if (mData == null) {
Log.e(LOG_TAG, "Can't select by touch. No data set.")
Timber.e("Can't select by touch. No data set.")
return null
} else {
return this.highlighter!!.getHighlight(x, y)
Expand Down Expand Up @@ -1292,17 +1292,17 @@ abstract class Chart<T : ChartData<out IDataSet<out Entry>>?> : ViewGroup, IBase

override fun onSizeChanged(w: Int, h: Int, oldw: Int, oldh: Int) {
if (this.isLogEnabled) {
Log.i(LOG_TAG, "OnSizeChanged()")
Timber.i("OnSizeChanged()")
}

if (w > 0 && h > 0 && w < 10000 && h < 10000) {
if (this.isLogEnabled) {
Log.i(LOG_TAG, "Setting chart dimens, width: $w, height: $h")
Timber.i("Setting chart dimens, width: $w, height: $h")
}
viewPortHandler.setChartDimens(w.toFloat(), h.toFloat())
} else {
if (this.isLogEnabled) {
Log.w(LOG_TAG, "*Avoiding* setting chart dimens! width: $w, height: $h")
Timber.w("*Avoiding* setting chart dimens! width: $w, height: $h")
}
}

Expand Down Expand Up @@ -1334,7 +1334,7 @@ abstract class Chart<T : ChartData<out IDataSet<out Entry>>?> : ViewGroup, IBase
override fun onDetachedFromWindow() {
super.onDetachedFromWindow()

//Log.i(LOG_TAG, "Detaching...");
//Timber.i("Detaching...");
if (mUnbind) {
unbindDrawables(this)
}
Expand Down Expand Up @@ -1380,7 +1380,7 @@ abstract class Chart<T : ChartData<out IDataSet<out Entry>>?> : ViewGroup, IBase

override fun dispatchPopulateAccessibilityEvent(event: AccessibilityEvent): Boolean {
val completed = super.dispatchPopulateAccessibilityEvent(event)
Log.d(LOG_TAG, "Dispatch called for Chart <View> and completed as $completed")
Timber.d("Dispatch called for Chart <View> and completed as $completed")

event.text.add(this.accessibilityDescription)

Expand All @@ -1393,8 +1393,6 @@ abstract class Chart<T : ChartData<out IDataSet<out Entry>>?> : ViewGroup, IBase
} // endregion

companion object {
const val LOG_TAG: String = "AndroidChart"

/**
* paint for the grid background (only line and barchart)
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package com.github.mikephil.charting.charts
import android.content.Context
import android.graphics.Canvas
import android.util.AttributeSet
import android.util.Log
import com.github.mikephil.charting.data.BarData
import com.github.mikephil.charting.data.BubbleData
import com.github.mikephil.charting.data.CandleData
Expand All @@ -16,6 +15,7 @@ import com.github.mikephil.charting.highlight.Highlight
import com.github.mikephil.charting.interfaces.dataprovider.CombinedDataProvider
import com.github.mikephil.charting.interfaces.datasets.IDataSet
import com.github.mikephil.charting.renderer.CombinedChartRenderer
import timber.log.Timber

/**
* This chart class allows the combination of lines, bars, scatter and candle
Expand Down Expand Up @@ -97,7 +97,7 @@ open class CombinedChart : BarLineChartBase<CombinedData>, CombinedDataProvider
*/
override fun getHighlightByTouchPoint(x: Float, y: Float): Highlight? {
if (mData == null) {
Log.e(LOG_TAG, "Can't select by touch. No data set.")
Timber.e("Can't select by touch. No data set.")
return null
} else {
highlighter?.let {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package com.github.mikephil.charting.charts
import android.content.Context
import android.graphics.RectF
import android.util.AttributeSet
import android.util.Log
import com.github.mikephil.charting.components.Legend.LegendHorizontalAlignment
import com.github.mikephil.charting.components.Legend.LegendOrientation
import com.github.mikephil.charting.components.Legend.LegendVerticalAlignment
Expand All @@ -21,6 +20,7 @@ import com.github.mikephil.charting.utils.MPPointF
import com.github.mikephil.charting.utils.MPPointF.Companion.getInstance
import com.github.mikephil.charting.utils.TransformerHorizontalBarChart
import com.github.mikephil.charting.utils.convertDpToPixel
import timber.log.Timber
import kotlin.math.max
import kotlin.math.min

Expand Down Expand Up @@ -154,17 +154,19 @@ open class HorizontalBarChart : BarChart {
XAxisPosition.BOTTOM -> {
offsetLeft += xLabelWidth
}

XAxisPosition.TOP -> {
offsetRight += xLabelWidth
}

XAxisPosition.BOTH_SIDED -> {
offsetLeft += xLabelWidth
offsetRight += xLabelWidth
}

XAxisPosition.TOP_INSIDE -> TODO()
XAxisPosition.BOTTOM_INSIDE -> TODO()
null -> Log.w(LOG_TAG, "XAxisPosition is null")
null -> Timber.w("XAxisPosition is null")
}
}

Expand All @@ -183,11 +185,8 @@ open class HorizontalBarChart : BarChart {
)

if (isLogEnabled) {
Log.i(
LOG_TAG, "offsetLeft: " + offsetLeft + ", offsetTop: " + offsetTop + ", offsetRight: " +
offsetRight + ", offsetBottom: " + offsetBottom
)
Log.i(LOG_TAG, "Content: " + viewPortHandler.contentRect)
Timber.i("offsetLeft: $offsetLeft, offsetTop: $offsetTop, offsetRight: $offsetRight, offsetBottom: $offsetBottom")
Timber.i("Content: ${viewPortHandler.contentRect}")
}

prepareOffsetMatrix()
Expand Down Expand Up @@ -255,7 +254,7 @@ open class HorizontalBarChart : BarChart {
override fun getHighlightByTouchPoint(x: Float, y: Float): Highlight? {
if (mData == null) {
if (isLogEnabled) {
Log.e(LOG_TAG, "Can't select by touch. No data set.")
Timber.e("Can't select by touch. No data set.")
}
return null
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import android.animation.ObjectAnimator
import android.annotation.SuppressLint
import android.content.Context
import android.util.AttributeSet
import android.util.Log
import android.view.MotionEvent
import com.github.mikephil.charting.animation.Easing.EasingFunction
import com.github.mikephil.charting.components.Legend.LegendHorizontalAlignment
Expand All @@ -19,6 +18,7 @@ import com.github.mikephil.charting.utils.MPPointF.Companion.getInstance
import com.github.mikephil.charting.utils.MPPointF.Companion.recycleInstance
import com.github.mikephil.charting.utils.Utils
import com.github.mikephil.charting.utils.convertDpToPixel
import timber.log.Timber
import kotlin.math.acos
import kotlin.math.cos
import kotlin.math.max
Expand Down Expand Up @@ -222,7 +222,7 @@ abstract class PieRadarChartBase<T : ChartData<out IDataSet<out Entry>>>
viewPortHandler.chartHeight * legend.maxSizePercent
)

LegendVerticalAlignment.CENTER -> Log.e(LOG_TAG, "LegendCenter/VerticalCenter not supported for PieRadarChart")
LegendVerticalAlignment.CENTER -> Timber.e("LegendCenter/VerticalCenter not supported for PieRadarChart")
}
}
}
Expand All @@ -247,7 +247,7 @@ abstract class PieRadarChartBase<T : ChartData<out IDataSet<out Entry>>>
when (legend.verticalAlignment) {
LegendVerticalAlignment.TOP -> legendTop = yLegendOffset
LegendVerticalAlignment.BOTTOM -> legendBottom = yLegendOffset
LegendVerticalAlignment.CENTER -> Log.e(LOG_TAG, "LegendCenter/HorizontalCenter not supported for PieRadarChart")
LegendVerticalAlignment.CENTER -> Timber.e("LegendCenter/HorizontalCenter not supported for PieRadarChart")
}
}
}
Expand Down Expand Up @@ -282,7 +282,7 @@ abstract class PieRadarChartBase<T : ChartData<out IDataSet<out Entry>>>
viewPortHandler.restrainViewPort(offsetLeft, offsetTop, offsetRight, offsetBottom)

if (isLogEnabled)
Log.i(LOG_TAG, "offsetLeft: $offsetLeft, offsetTop: $offsetTop, offsetRight: $offsetRight, offsetBottom: $offsetBottom")
Timber.i("offsetLeft: $offsetLeft, offsetTop: $offsetTop, offsetRight: $offsetRight, offsetBottom: $offsetBottom")
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ package com.github.mikephil.charting.components
import android.graphics.Color
import android.graphics.DashPathEffect
import android.graphics.Paint
import android.util.Log
import com.github.mikephil.charting.formatter.DefaultAxisValueFormatter
import com.github.mikephil.charting.formatter.IAxisValueFormatter
import com.github.mikephil.charting.utils.convertDpToPixel
import timber.log.Timber
import kotlin.math.abs

/**
Expand Down Expand Up @@ -398,10 +398,7 @@ abstract class AxisBase : ComponentBase() {
limitLines.add(l)

if (limitLines.size > 6) {
Log.e(
"MPAndroiChart",
"Warning! You have more than 6 LimitLines on your axis, do you really want that?"
)
Timber.e("Warning! You have more than 6 LimitLines on your axis, do you really want that?")
}
}

Expand All @@ -412,10 +409,7 @@ abstract class AxisBase : ComponentBase() {
limitRanges.add(l)

if (limitRanges.size > 6) {
Log.e(
"MPAndroiChart",
"Warning! You have more than 6 LimitLines on your axis, do you really want that?"
)
Timber.e("Warning! You have more than 6 LimitLines on your axis, do you really want that?")
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package com.github.mikephil.charting.data

import android.graphics.Typeface
import android.util.Log
import com.github.mikephil.charting.components.YAxis.AxisDependency
import com.github.mikephil.charting.formatter.IValueFormatter
import com.github.mikephil.charting.highlight.Highlight
import com.github.mikephil.charting.interfaces.datasets.IDataSet
import timber.log.Timber
import java.io.Serializable
import java.util.Collections

Expand Down Expand Up @@ -376,7 +376,7 @@ abstract class ChartData<T : IDataSet<out Entry>> : Serializable {

calcMinMax(entry, set.axisDependency)
} else {
Log.e("addEntry", "Cannot add Entry because dataSetIndex too high or too low.")
Timber.e("Cannot add Entry because dataSetIndex too high or too low.")
}
}

Expand Down
Loading
Loading