|
|
|
@ -1,31 +1,29 @@ |
|
|
|
package net.pokeranalytics.android.ui.graph |
|
|
|
package net.pokeranalytics.android.ui.graph |
|
|
|
|
|
|
|
|
|
|
|
import android.content.Context |
|
|
|
import android.content.Context |
|
|
|
import android.graphics.Typeface |
|
|
|
|
|
|
|
import androidx.core.content.ContextCompat |
|
|
|
import androidx.core.content.ContextCompat |
|
|
|
|
|
|
|
import androidx.core.content.res.ResourcesCompat |
|
|
|
import com.github.mikephil.charting.charts.BarLineChartBase |
|
|
|
import com.github.mikephil.charting.charts.BarLineChartBase |
|
|
|
import com.github.mikephil.charting.components.XAxis |
|
|
|
import com.github.mikephil.charting.components.XAxis |
|
|
|
import net.pokeranalytics.android.R |
|
|
|
import net.pokeranalytics.android.R |
|
|
|
import net.pokeranalytics.android.ui.extensions.px |
|
|
|
import net.pokeranalytics.android.ui.extensions.px |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fun BarLineChartBase<*>.setStyle(small: Boolean, context: Context) { |
|
|
|
fun BarLineChartBase<*>.setStyle(small: Boolean, context: Context) { |
|
|
|
|
|
|
|
|
|
|
|
// X Axis |
|
|
|
// X Axis |
|
|
|
this.xAxis.axisLineColor = ContextCompat.getColor(context, R.color.chart_default) |
|
|
|
this.xAxis.axisLineColor = ContextCompat.getColor(context, R.color.chart_default) |
|
|
|
this.xAxis.enableGridDashedLine(3.0f.px, 5.0f.px, 1.0f.px) |
|
|
|
this.xAxis.enableGridDashedLine(3.0f.px, 5.0f.px, 1.0f.px) |
|
|
|
this.xAxis.textColor = ContextCompat.getColor(context, R.color.chart_default) |
|
|
|
|
|
|
|
this.xAxis.labelCount = 4 |
|
|
|
|
|
|
|
this.xAxis.position = XAxis.XAxisPosition.BOTTOM |
|
|
|
this.xAxis.position = XAxis.XAxisPosition.BOTTOM |
|
|
|
|
|
|
|
|
|
|
|
this.xAxis.textColor = ContextCompat.getColor(context, R.color.chart_default) |
|
|
|
|
|
|
|
this.xAxis.typeface = Typeface.DEFAULT |
|
|
|
|
|
|
|
this.xAxis.labelCount = 4 |
|
|
|
|
|
|
|
this.xAxis.position = XAxis.XAxisPosition.BOTTOM |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.xAxis.setDrawLabels(true) |
|
|
|
this.xAxis.setDrawLabels(true) |
|
|
|
this.xAxis.setDrawGridLines(true) |
|
|
|
this.xAxis.setDrawGridLines(true) |
|
|
|
this.xAxis.granularity = 1.0f |
|
|
|
|
|
|
|
this.xAxis.isGranularityEnabled = true |
|
|
|
this.xAxis.isGranularityEnabled = true |
|
|
|
|
|
|
|
this.xAxis.granularity = 1.0f |
|
|
|
|
|
|
|
this.xAxis.textColor = ContextCompat.getColor(context, R.color.chart_default) |
|
|
|
|
|
|
|
this.xAxis.typeface = ResourcesCompat.getFont(context, R.font.roboto_medium) |
|
|
|
|
|
|
|
this.xAxis.labelCount = 4 |
|
|
|
|
|
|
|
this.xAxis.textSize = 12f |
|
|
|
this.xAxis.isEnabled = true |
|
|
|
this.xAxis.isEnabled = true |
|
|
|
|
|
|
|
|
|
|
|
// Y Axis |
|
|
|
// Y Axis |
|
|
|
@ -41,12 +39,14 @@ fun BarLineChartBase<*>.setStyle(small: Boolean, context: Context) { |
|
|
|
this.axisLeft.granularity = 1.0f |
|
|
|
this.axisLeft.granularity = 1.0f |
|
|
|
|
|
|
|
|
|
|
|
this.axisLeft.textColor = ContextCompat.getColor(context, R.color.chart_default) |
|
|
|
this.axisLeft.textColor = ContextCompat.getColor(context, R.color.chart_default) |
|
|
|
this.axisLeft.typeface = Typeface.DEFAULT |
|
|
|
this.axisLeft.typeface = ResourcesCompat.getFont(context, R.font.roboto_medium) |
|
|
|
this.axisLeft.labelCount = |
|
|
|
this.axisLeft.labelCount = if (small) 1 else 7 // @todo not great if interval is [0..2] for number of records as we get decimals |
|
|
|
if (small) 1 else 7 // @todo not great if interval is [0..2] for number of records as we get decimals |
|
|
|
this.axisLeft.textSize = 12f |
|
|
|
|
|
|
|
|
|
|
|
this.axisRight.isEnabled = false |
|
|
|
this.axisRight.isEnabled = false |
|
|
|
this.legend.isEnabled = false |
|
|
|
this.legend.isEnabled = false |
|
|
|
|
|
|
|
this.data.isHighlightEnabled = !small |
|
|
|
|
|
|
|
this.description.isEnabled = false |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// @todo |
|
|
|
// @todo |
|
|
|
|