ChartsOrg/Charts

CombinedChartView: First and last bars are shown half only

開放

#2,105 建立於 2017年1月22日

 (3 則留言) (0 個反應) (0 位負責人)Swift (5,993 個分叉)batch import
bughelp wanted★★★

倉庫指標

星標
 (28,010 顆星)
PR 合併指標
 (30 天內沒有已合併 PR)

描述

I migrated my existing code to Charts 3.0.1 now and have some issues with the combined chart view (bars and lines).

After the straight forward migration my diagram looks as shown in the following picture. bildschirmfoto 2017-01-22 um 11 21 01

When I add the following lines of code in order to show the bars completely the xAxis values gets corrupted completely.

combChart.xAxis.granularityEnabled = true
combChart.xAxis.granularity        = 1.0
combChart.xAxis.spaceMin           = 0.5
combChart.xAxis.spaceMax           = 0.5
combChart.xAxis.valueFormatter     = self

bildschirmfoto 2017-01-22 um 11 23 47

The Strings for the xAxis values are drawn with the following lines of code.

public func stringForValue(_ value: Double, axis: AxisBase?) -> String
    {
        if Int(value) < _xValues.count {
            return _xValues[Int(value)]
        } else {
            return ""
        }
    }

I checked the output the stringForValuefunction. But the function gets called exactly 4 times and returns the correct Strings:

2017.01.22 11:23:43.460 [DEBUG] [DiagramCombinedCollectionViewCell stringForValue(_:axis:)](417): xValue: 0.000000 1. Serie
2017.01.22 11:23:43.461 [DEBUG] [DiagramCombinedCollectionViewCell stringForValue(_:axis:)](417): xValue: 1.000000 2. Serie
2017.01.22 11:23:43.462 [DEBUG] [DiagramCombinedCollectionViewCell stringForValue(_:axis:)](417): xValue: 2.000000 3. Serie
2017.01.22 11:23:43.463 [DEBUG] [DiagramCombinedCollectionViewCell stringForValue(_:axis:)](417): xValue: 3.000000 4. Serie

Any idea whats going wrong? Or do I forget to set any relevant axis parameter?

貢獻者指南