{"action":"closed","issue":{"url":"https://api.github.com/repos/danielgindi/Charts/issues/2815","repository_url":"https://api.github.com/repos/danielgindi/Charts","labels_url":"https://api.github.com/repos/danielgindi/Charts/issues/2815/labels{/name}","comments_url":"https://api.github.com/repos/danielgindi/Charts/issues/2815/comments","events_url":"https://api.github.com/repos/danielgindi/Charts/issues/2815/events","html_url":"https://github.com/danielgindi/Charts/issues/2815","id":259586853,"number":2815,"title":"StackedBarChart isn't stacking bars","user":{"login":"rossmooney","id":3248040,"avatar_url":"https://avatars0.githubusercontent.com/u/3248040?v=4","gravatar_id":"","url":"https://api.github.com/users/rossmooney","html_url":"https://github.com/rossmooney","followers_url":"https://api.github.com/users/rossmooney/followers","following_url":"https://api.github.com/users/rossmooney/following{/other_user}","gists_url":"https://api.github.com/users/rossmooney/gists{/gist_id}","starred_url":"https://api.github.com/users/rossmooney/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rossmooney/subscriptions","organizations_url":"https://api.github.com/users/rossmooney/orgs","repos_url":"https://api.github.com/users/rossmooney/repos","events_url":"https://api.github.com/users/rossmooney/events{/privacy}","received_events_url":"https://api.github.com/users/rossmooney/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2017-09-21T18:18:46Z","updated_at":"2017-09-22T01:21:49Z","closed_at":"2017-09-22T01:21:49Z","author_association":"NONE","body":"I'm trying to create a stacked bar chart, but the bars won't stack.  I just get alternating colors for adjacent bars, and the values are summed from the array passed into it.  I pass in an array of x values (indexes) and an array of y value arrays as items.  A coworker ran into the same issue on the Android platform, but I don't see this issue mentioned anywhere else so maybe we aren't setting something correctly?\r\n\r\n<img width=\"342\" alt=\"screen shot 2017-09-21 at 2 15 24 pm\" src=\"https://user-images.githubusercontent.com/3248040/30711807-ecb4096e-9ed7-11e7-89c4-42b84fcbec01.png\">\r\n\r\n```\r\n        //Get x values and y value arrays\r\n \t\tguard let chart = chart as? BarChartView,\r\n            case .stackedY(let yValues) = data.yValues,\r\n        case .index(let xValues, _) = data.xValues else { return }\r\n\r\n        //Create entries\r\n        let entries = yValues.enumerated().map { index, items in\r\n            BarChartDataEntry(x: Double(xValues[index]), yValues: items)\r\n        }\r\n                \r\n        //Build set\r\n        let set = BarChartDataSet(values: [], label: config.title)\r\n        set.setColors(self.chartColors, alpha: 1.0)\r\n        set.drawValuesEnabled = false\r\n\r\n        //Update with entries\r\n        entries.forEach { entry in _ = set.addEntry(entry) }\r\n        barChartData?.dataSets[0] = set\r\n        \r\n        //Labels and legends\r\n        set.stackLabels = [\"Source1\", \"Source2\"]\r\n        chart.legend.enabled = !set.stackLabels.isEmpty\r\n        chart.legend.xEntrySpace = chartWidth / 4\r\n        chart.legend.xOffset = 20\r\n        chart.legend.form = .circle\r\n\r\n        //Update data on chart\r\n        barChartData.barWidth = 0.5\r\n        chart.data = barChartData\r\n```\r\n\r\n"}}
{"actor":{"display_login":"liuxuan30"}}