ivnsch / SwiftCharts

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

Display one data point for Custom Units Scrollable graph #326

Closed zoufishanmehdi closed 6 years ago

zoufishanmehdi commented 6 years ago

Hi, I would like to display one data point for Custom Units Scrollable graph (Custom Units Example). Is it possible to do it with this library? I have looked into issues and the library to check and I only see [ChartAxisValue] array to create ChartAxisModel (i.e. xModel an yModel), no function to only add one ChartAxisValue for each. Would really appreciate your input. Thank you!

ivnsch commented 6 years ago

Well, the axes need a range - if you just want to use one value, pass 2 additional values as fillers - one at the start and another at the end, such that your value appears centered in the middle. The values of those fillers are not important, as long as they are respectively smaller and bigger than your center value, by the same amount. And make them hidden, such that the labels will not appear on the axis. This is also possible using generators instead of arrays.

Sorry for the late response, but also, as stated in the placeholders, this kind of questions is better suited for stack overflow!