@@ -67,31 +67,34 @@ class BarChartActivity : DemoBase(), OnSeekBarChangeListener, OnChartValueSelect
6767 // chart.setDrawYLabels(false);
6868 val xAxisFormatter: IAxisValueFormatter = DayAxisValueFormatter (binding.chart1)
6969
70- val xAxis = binding.chart1.xAxis
71- xAxis.position = XAxisPosition .BOTTOM
72- xAxis.typeface = tfLight
73- xAxis.setDrawGridLines(false )
74- xAxis.granularity = 1f // only intervals of 1 day
75- xAxis.labelCount = 7
76- xAxis.valueFormatter = xAxisFormatter
70+ binding.chart1.xAxis.apply {
71+ position = XAxisPosition .BOTTOM
72+ typeface = tfLight
73+ setDrawGridLines(false )
74+ granularity = 1f // only intervals of 1 day
75+ labelCount = 7
76+ valueFormatter = xAxisFormatter
77+ }
7778
7879 val custom: IAxisValueFormatter = MyAxisValueFormatter ()
7980
80- val leftAxis = binding.chart1.axisLeft
81- leftAxis.typeface = tfLight
82- leftAxis.setLabelCount(8 , false )
83- leftAxis.valueFormatter = custom
84- leftAxis.setPosition(YAxisLabelPosition .OUTSIDE_CHART )
85- leftAxis.spaceTop = 15f
86- leftAxis.axisMinimum = 0f // this replaces setStartAtZero(true)
87-
88- val rightAxis = binding.chart1.axisRight
89- rightAxis.setDrawGridLines(false )
90- rightAxis.typeface = tfLight
91- rightAxis.setLabelCount(8 , false )
92- rightAxis.valueFormatter = custom
93- rightAxis.spaceTop = 15f
94- rightAxis.axisMinimum = 0f // this replaces setStartAtZero(true)
81+ binding.chart1.axisLeft.apply {
82+ typeface = tfLight
83+ setLabelCount(8 , false )
84+ valueFormatter = custom
85+ spaceTop = 15f
86+ axisMinimum = 0f // this replaces setStartAtZero(true)
87+ setPosition(YAxisLabelPosition .OUTSIDE_CHART )
88+ }
89+
90+ binding.chart1.axisRight.apply {
91+ setDrawGridLines(false )
92+ typeface = tfLight
93+ setLabelCount(8 , false )
94+ valueFormatter = custom
95+ spaceTop = 15f
96+ axisMinimum = 0f // this replaces setStartAtZero(true)
97+ }
9598
9699 binding.chart1.legend.apply {
97100 verticalAlignment = Legend .LegendVerticalAlignment .BOTTOM
0 commit comments