ivnsch / SwiftCharts

Easy to use and highly customizable charts library for iOS
Apache License 2.0
2.53k stars 410 forks source link

Line circle layer- circle appearing stretched out #327

Closed zoufishanmehdi closed 6 years ago

zoufishanmehdi commented 6 years ago

Hi! As you can see below, I added code to generate circle found in BarsPlusMinusAndLinesExample. However, the circle doesn't appear circular as it should, but instead looks horizontally stretched out. Please refer to the code and screenshots below.

let circleViewGenerator = {(chartPointModel: ChartPointLayerModel, layer: ChartPointsLayer, chart: Chart) -> UIView? in let color = UIColor(red: 0.7, green: 0.7, blue: 0.7, alpha: 1) let screenLoc = CGPoint(x: chartPointModel.screenLoc.x.isNaN ? 50.0 : chartPointModel.screenLoc.x, y: chartPointModel.screenLoc.y) let circleView = ChartPointEllipseView(center: screenLoc, diameter: 6) circleView.animDuration = 0 circleView.fillColor = color return circleView }

    `let lineCirclesLayer = ChartPointsViewsLayer(xAxis: xAxisLayer.axis, yAxis: yAxisLayer.axis, chartPoints: chartPoints, viewGenerator: circleViewGenerator, displayDelay: 0, delayBetweenItems: 0.05)`
screen shot 2018-01-02 at 10 40 53 am screen shot 2018-01-02 at 10 40 34 am

Any ideas how to fix this? Thank you!

ivnsch commented 6 years ago

Please read https://github.com/i-schuetz/SwiftCharts/wiki/View-hierarchy-and-transforms#chartpointsviewslayer-transform-modes and see examples where the circles are not scaled.