I'm implementing a line chart on iOS with ability for comparing data using iOS Charts and Swift
Simplest Scenario
Compare data of Jan 04 to Jan 05, Jan 05 to Jan 06, Jan 06 to Jan 07 and so on...
So, I need to draw 2 lines with different XAxis (second line is 1 day shifted of first line) and same YAxis
I did
Create 2 line chart views (LineChartView), 1 with top XAxis and legend ; and 1 with bottom XAxis and legend
Problems
Because of space of XAxis labels and legends, 2 lines has different YAxis position (e.g: 0 value of line 1 is around 96 value of line 2). I think some margin may resolve this problem but I can find only 1 option
minOffset, which set margins for all top, bottom, left and right. What thing I can use to only margin top and bottom?All interactions (drag, zoom, touch, etc) only affect 1 of them, not both. How can I make interactions applied to both of them?
Update
I resolved first issue by adding minTopBottomOffset and modifying ChartViewBase to use it
More information about what I'm expecting:
- I have a data like this:
[{time: Jan 01, value: 10}, {time: Jan 02, value: 13}, {time: Jan 03, value: 5}] timeis X,valueis Y- I want to draw first line with XAxis at bottom, second line with XAxis displayed on top and second line has XAxis shifted to the right 1 day. 2 lines have same data
See my expected chart here: https://drive.google.com/file/d/0B5DT3STrB2t3UW0wTXpKU1RHSTA/view
Thank you!
LineChartViewinside same UIView and draw them. 1 with top XAxis and legend ; and 1 with bottom XAxis and legend. No special configurations - metamon[{time: Jan 01, value: 10}, {time: Jan 02, value: 13}, {time: Jan 03, value: 5}]-timeis X,valueis Y - I want to draw first line with XAxis at bottom, second line with XAxis displayed on top and second line has XAxis shifted to the right 1 day. 2 lines have same data See my expected chart here: drive.google.com/file/d/0B5DT3STrB2t3UW0wTXpKU1RHSTA/… - metamon