| | |
| | | import android.graphics.Color |
| | | import android.widget.GridLayout |
| | | import com.example.firstapp.model.DailyStat |
| | | import com.github.mikephil.charting.components.YAxis |
| | | |
| | | class DashboardFragment : Fragment() { |
| | | |
| | |
| | | setDrawGridLines(false) |
| | | granularity = 1f |
| | | labelRotationAngle = 0f |
| | | textSize = 12f |
| | | textSize = 10f //标签字体 |
| | | setExtraLeftOffset(5f) // 减少左侧留白 |
| | | setExtraBottomOffset(15f) |
| | | } |
| | | |
| | |
| | | setExtraOffsets(10f, 10f, 10f, 20f) |
| | | } |
| | | |
| | | |
| | | |
| | | updateBarChartData() |
| | | } |
| | | private fun updateBarChartData() { |
| | |
| | | binding.layoutWeekStats.root.visibility = View.VISIBLE |
| | | binding.layoutYearStats.root.visibility = View.GONE |
| | | binding.layoutWeekStats.chartDailyPackages.visibility = View.VISIBLE |
| | | (binding.layoutWeekStats.chartDailyPackages.parent as? View)?.visibility = View.VISIBLE |
| | | binding.layoutWeekStats.heatmapYearly.visibility = View.GONE |
| | | binding.cardPackageStats.visibility = View.VISIBLE |
| | | updateBarChartData() |