Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try to fix wrong position bug for BarChartView + HorizontalBarChartView #221

Closed
wants to merge 5 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add fix for horizontal bar chart
  • Loading branch information
liuxuan30 committed Jul 27, 2015
commit c861feafded48c5843caa5d95f6e9518a797eccd
4 changes: 2 additions & 2 deletions Charts/Classes/Renderers/HorizontalBarChartRenderer.swift
Original file line number Diff line number Diff line change
@@ -54,8 +54,8 @@ public class HorizontalBarChartRenderer: BarChartRenderer
var e = entries[j]

// calculate the x-position, depending on datasetcount
var x = CGFloat(e.xIndex + j * dataSetOffset) + CGFloat(index)
+ groupSpace * CGFloat(j) + groupSpaceHalf
var x = CGFloat(e.xIndex + e.xIndex * dataSetOffset) + CGFloat(index)
+ groupSpace * CGFloat(e.xIndex) + groupSpaceHalf
var vals = e.values

if (!containsStacks || vals == nil)
2 changes: 1 addition & 1 deletion Charts/Classes/Utils/ChartTransformer.swift
Original file line number Diff line number Diff line change
@@ -167,7 +167,7 @@ public class ChartTransformer: NSObject
var e = entries[j]

// calculate the x-position, depending on datasetcount
var x = CGFloat(e.xIndex + (j * (setCount - 1)) + dataSet) + space * CGFloat(j) + space / 2.0
var x = CGFloat(e.xIndex + (e.xIndex * (setCount - 1)) + dataSet) + space * CGFloat(e.xIndex) + space / 2.0
var y = e.value

valuePoints.append(CGPoint(x: CGFloat(y) * phaseY, y: x))