{"action":"created","issue":{"url":"https://api.github.com/repos/danielgindi/ios-charts/issues/256","labels_url":"https://api.github.com/repos/danielgindi/ios-charts/issues/256/labels{/name}","comments_url":"https://api.github.com/repos/danielgindi/ios-charts/issues/256/comments","events_url":"https://api.github.com/repos/danielgindi/ios-charts/issues/256/events","html_url":"https://github.com/danielgindi/ios-charts/issues/256","id":98103383,"number":256,"title":"viewPortHandler.setMaximumScaleX not working for horizontal bar chart","user":{"login":"liuxuan30","id":4375169,"avatar_url":"https://avatars.githubusercontent.com/u/4375169?v=3","gravatar_id":"","url":"https://api.github.com/users/liuxuan30","html_url":"https://github.com/liuxuan30","followers_url":"https://api.github.com/users/liuxuan30/followers","following_url":"https://api.github.com/users/liuxuan30/following{/other_user}","gists_url":"https://api.github.com/users/liuxuan30/gists{/gist_id}","starred_url":"https://api.github.com/users/liuxuan30/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/liuxuan30/subscriptions","organizations_url":"https://api.github.com/users/liuxuan30/orgs","repos_url":"https://api.github.com/users/liuxuan30/repos","events_url":"https://api.github.com/users/liuxuan30/events{/privacy}","received_events_url":"https://api.github.com/users/liuxuan30/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2015-07-30T07:36:28Z","updated_at":"2015-07-30T08:43:03Z","closed_at":null,"body":"I am trying to set max scaleX for horizontal bar chart via `viewPortHandler.setMaximumScaleX`, let's say the maxScaleX to be 3.\r\n\r\nHowever when zooming in on xAxis for horizontal bart chart, it can zoom in as much I want.\r\n\r\nAfter the investigation, I found in below function `matrix.a` is always 1, but `matrix.d` is keeping increasing as the correct scale in `limitTransAndScale`. It seems like we forgot to switch them for horizontal bart chart, or do you intend to do so? \r\n```Swift\r\n    private func limitTransAndScale(inout #matrix: CGAffineTransform, content: CGRect?)\r\n    {\r\n        // min scale-x is 1, max is the max CGFloat\r\n        // for horizontal bar chart, matrix.a is always 1\r\n        _scaleX = min(max(_minScaleX, matrix.a), _maxScaleX)\r\n        \r\n        // min scale-y is 1\r\n        _scaleY = max(_minScaleY, matrix.d)\r\n```\r\nAlso, I want to propose could we change the gestures and their handlers to be 'internal' rather than 'private'?\r\n\r\nThe pinch gesture handler is private and I cannot override it to adapt for horizontal bar charts, though we could use `is HorizontalBarChartView` in BarLineChartViewBase and make some changes, just like `performPanChange`\r\n\r\nI tried to fix it but I found it's more complicated than I thought. I added setMaximumScaleY, and have to change `canZoomInMoreX` and have to get chart type in ChartViewPortHandler in order to read maxScaleY for horizontal bar chart, which seems not a good design pattern.\r\n\r\n\r\nNeeds your help how to fix this.\r\n"},"comment":{"url":"https://api.github.com/repos/danielgindi/ios-charts/issues/comments/126227298","html_url":"https://github.com/danielgindi/ios-charts/issues/256#issuecomment-126227298","issue_url":"https://api.github.com/repos/danielgindi/ios-charts/issues/256","id":126227298,"user":{"login":"danielgindi","id":366926,"avatar_url":"https://avatars.githubusercontent.com/u/366926?v=3","gravatar_id":"","url":"https://api.github.com/users/danielgindi","html_url":"https://github.com/danielgindi","followers_url":"https://api.github.com/users/danielgindi/followers","following_url":"https://api.github.com/users/danielgindi/following{/other_user}","gists_url":"https://api.github.com/users/danielgindi/gists{/gist_id}","starred_url":"https://api.github.com/users/danielgindi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danielgindi/subscriptions","organizations_url":"https://api.github.com/users/danielgindi/orgs","repos_url":"https://api.github.com/users/danielgindi/repos","events_url":"https://api.github.com/users/danielgindi/events{/privacy}","received_events_url":"https://api.github.com/users/danielgindi/received_events","type":"User","site_admin":false},"created_at":"2015-07-30T08:43:03Z","updated_at":"2015-07-30T08:43:03Z","body":"You might be encountering the problem of the axis changing its size. You\nmight want to specify its size customly.\n\nOn Thu, Jul 30, 2015 at 11:40 AM, Xuan <notifications@github.com> wrote:\n\n> I tried adding property axisRotated and just switch them like this in\n> limitTransAndScale:\n>\n>         if (_axisRotated)\n>         {\n>             // min scale-x is 1, max is the max CGFloat\n>             _scaleX = min(max(_minScaleX, matrix.d), _maxScaleX)\n>\n>             // min scale-y is 1\n>             _scaleY = max(_minScaleY, matrix.a)\n>         }\n>         else\n>         {\n>             // min scale-x is 1, max is the max CGFloat\n>             _scaleX = min(max(_minScaleX, matrix.a), _maxScaleX)\n>\n>             // min scale-y is 1\n>             _scaleY = max(_minScaleY, matrix.d)\n>         }\n>\n> Other code in ViewPortHandler not changed.\n>\n> It actually can zoom to correct maxScaleX, but while zooming, the chart is\n> moving like 'shaking' a lot not static.\n>\n> —\n> Reply to this email directly or view it on GitHub\n> <https://github.com/danielgindi/ios-charts/issues/256#issuecomment-126226758>\n> .\n>\n"}}