λ΄ λ€μ΄μ΄κ·Έλ¨μ Charts 3.0.1λ‘ λ§μ΄κ·Έλ μ΄μ νμ΅λλ€. κ·Έκ²μ μμ£Ό μννκ² μλνμ§λ§ λ§λ μ°¨νΈλ₯Ό λ΄ xAxis κ°μ μ λ ¬ν μ μμ΅λλ€. λ€μ λ€μ΄μ΄κ·Έλ¨μ 0κ³Ό 10(11κ°μ λ§λ) μ¬μ΄ κ°μ νμ€ν κ·Έλ¨μ 보μ¬μΌ ν©λλ€.
λ³ν 1
barChart.xAxis.granularity = 1.0
barChart.xAxis.granularityEnabled = true
barChart.xAxis.setLabelCount(11, force: true)
λͺ¨λ μΈλ±μ€ κ°μ΄ νμλμ§λ§ λ§λμ μ λ ¬λμ§λ μμ΅λλ€.
λ³ν 2(centerAxisLabelsEnabled)
barChart.xAxis.granularity = 1.0
barChart.xAxis.granularityEnabled = true
barChart.xAxis.centerAxisLabelsEnabled = true
barChart.xAxis.setLabelCount(11, force: true)
xAxisμ μΈλ±μ€ 10μ΄ μμ΅λλ€.
λ³ν 3(fitBars)
barChart.xAxis.granularity = 1.0
barChart.xAxis.granularityEnabled = true
barChart.xAxis.centerAxisLabelsEnabled = true
barChart.xAxis.setLabelCount(11, force: true)
barChart.fitBars = true
xAxisλ -1λ‘ μμν©λλ€.
**λ³ν 4(axisMinimum λ° axisMaximum)
barChart.xAxis.granularity = 1.0
barChart.xAxis.granularityEnabled = true
barChart.xAxis.centerAxisLabelsEnabled = true
barChart.xAxis.setLabelCount(11, force: true)
barChart.xAxis.axisMinimum = 0.0
barChart.xAxis.axisMaximum = 10.0
barChart.fitBars = true
λ§λκ° λ μ΄μ μ€μμ λ°°μΉλμ§ μκ³ λ§μ§λ§ xAxis κ° 10μ΄ νμλμ§ μμ΅λλ€.
λλ λͺ κ°μ§ λ€λ₯Έ μ‘°ν©μ μλνμ§λ§ xAxisμμ λ΄ μ«μ 0...10μΌλ‘ λ§λλ₯Ό μ λ ¬ν μ μμμ΅λλ€. λκ΅°κ°κ° μ΄λ€ μκ°μ΄ μμ΅λκΉ?
λ λ€λ₯Έ μ¬ν. μμν κ²°κ³Όμ λΉμ·ν΄ 보μ΄μ§λ§ 첫 λ²μ§Έ λ§μ§λ§ λ§λλ μ λ°λ§ νμλ©λλ€(isst #2105 μ°Έμ‘°).
barChart.xAxis.axisMinimum = 0.0
barChart.xAxis.axisMaximum = 10.0
barChart.xAxis.granularity = 1.0
barChart.xAxis.granularityEnabled = true
barChart.xAxis.labelCount = 11
barChart.fitBars = true
Charts 2.xμ λΉν΄ κ°μ₯ κ°κΉμ΄ λ€μ΄μ΄κ·Έλ¨ λ μ΄μμμ λ€μ μ½λλ₯Ό μ 곡ν©λλ€. κ·Έλ¬λ Charts 2.xμμμ κ°μ΄ λ§λ μ¬μ΄μ λκΈμ μ μ΄λ»κ² μ΄λν μ μμ΅λκΉ? xAxis.centerAxisLabelsEnabled = true
λ° fitBars = true
μλνμ΅λλ€. λ μμ± λͺ¨λ λ΄ xAxis/bar λ μ΄μμμ μμμμΌ°μ΅λλ€.
barChart.xAxis.granularity = 1.0
barChart.xAxis.granularityEnabled = true
barChart.xAxis.labelCount = 11
@SvenMuc μ λ Combined Chart (Bar and Line chart)μ κ°μ λ¬Έμ μ μ§λ©΄νκ³ μμ΅λλ€... 첫 λ²μ§Έμ λ§μ§λ§ λ§λ λλΉκ° μ λ°μ λΆκ³Όν©λλ€. ν΄κ²°μ± μ μ°ΎμΌμ ¨λ€λ©΄ μ λ₯Ό λμμ£ΌμΈμ.
μ΄ λ¬Έμ λ‘ μ΄λ €μμ κ²ͺκ³ μλ λ€λ₯Έ μ¬λμ μν΄, μ΄ μΈλΆμ±κ³Ό setLabelCount() μ‘°ν©μ μ¬μ©ν μ μκ±°λ λ μ΄λΈμ΄ μλͺ» μ λ ¬λκ±°λ μΌμͺ½ λ° μ€λ₯Έμͺ½ λ§λκ° μ릴 μ μμμ λ°κ²¬νμ΅λλ€.
κ·Έλ¬λ μ΄κ²μ λλ₯Ό μν΄ μλνλ κ² κ°μ΅λλ€.
self.periodGraphView.xAxis.labelCount = barValues.count
self.periodGraphView.xAxis.spaceMin = 0.5
self.periodGraphView.xAxis.spaceMax = 0.5
self.periodGraphView.xAxis.granularityEnabled = true
self.periodGraphView.xAxis.granularity = 1
κ°μ¬ν©λλ€. xμΆ λ μ΄λΈμ λ§λ μ€μμ λ°°μΉνλ λ° λμμ΄ λμμ§λ§ λ§μ§λ§ λ§λκ° μ리λ κ²μ μ΄λ»μ΅λκΉ?
μ΄λ»κ² κ³ μ³€μ΅λκΉ?
κ°μ¬ν©λλ€. xμΆ λ μ΄λΈμ λ§λ μ€μμ λ°°μΉνλ λ° λμμ΄ λμμ§λ§ λ§μ§λ§ λ§λκ° μ리λ κ²μ μ΄λ»μ΅λκΉ?
μ΄λ»κ² κ³ μ³€μ΅λκΉ?
barChart.xAxis.axisMaximum = Double(values.count)
barChart.xAxis.centerAxisLabelsEnabled = κ±°μ§
μ΄κ²μ λ΄ κ²½μ°μ μμ λμμ΅λλ€.
centerAxisLabelsEnabledλ₯Ό trueλ‘ μ€μ νμ§ λ§μμμ€.
μ°¨νΈ λ°λͺ¨λ₯Ό μ°Έμ‘°νμμμ€. μ΄κ²μ μ€λλμμ΅λλ€ .. κ·Έλμ μ§κΈ 무ν¨ν΄μΌν©λλ€.
chartView.xAxis.axisMinimum = -0.5 // λ§μ§λ§ λ§λκ° λ°μΌλ‘ μ리λ λ¬Έμ λ₯Ό νΌνκΈ° μν΄
μ΄κ²μ λλ₯Ό μν΄ μΌνμ΅λλ€
μ무λ λμκ² κ·Έλνμ μ 체 μ½λλ₯Ό μ€ μ μμ΅λκΉ? μ€μ λ‘ λλ μ΄κ²μ μ μ©νμ§λ§ μλνμ§ μμμ΅λλ€.
κ°μ₯ μ μ©ν λκΈ
μ΄ λ¬Έμ λ‘ μ΄λ €μμ κ²ͺκ³ μλ λ€λ₯Έ μ¬λμ μν΄, μ΄ μΈλΆμ±κ³Ό setLabelCount() μ‘°ν©μ μ¬μ©ν μ μκ±°λ λ μ΄λΈμ΄ μλͺ» μ λ ¬λκ±°λ μΌμͺ½ λ° μ€λ₯Έμͺ½ λ§λκ° μ릴 μ μμμ λ°κ²¬νμ΅λλ€.
κ·Έλ¬λ μ΄κ²μ λλ₯Ό μν΄ μλνλ κ² κ°μ΅λλ€.