Customizable line chart curve that can display the image at different points

curved Line chart with image at given point

I am having problems displaying an image on a line chart at a certain point on the chart, and I also want to implement a curved line chart with a custom color, width and type (shown by a dashed line in the image) and labels on the x-axis and y-axis.

I wanted to know if there are any iOS libraries that provide such an implementation.

I know this is a duplicate question because there are a lot of questions about graphics for iOS, but all I wanted to know is some kind of library available there that can fulfill the above requirement and save a lot of time for this implementation.

so far i have got the following libraries by doing a google search.

all off above provides an implementation of a line chart, but a non-curved line chart also does not provide for displaying the image on the chart at the specified point.

I am very new to the chart in iOS, so any help would be greatly appreciated.

Thanks in advance.

+7
ios objective-c iphone core-graphics charts
source share
2 answers

The following lines can add an image at specified points (100,200), which will serve your purpose for drawing an image.

I developed a library of samples in which you get what you need, kindly go through it. Download library here

UIImage *image = [UIImage imageNamed:@"smiley.png"]; [image drawAtPoint:CGPointMake(100,200)]; 
0
source share

I recommend SwiftCharts for this, it is specially designed for such situations. You can add multiple layers to each other and create custom views (subclasses of UIView, which may be an image view or something else) in any of these layers.

In this case, you would add a curve layer and another layer on top of it with your custom overlays.

To create custom overlays, you get the full state of each point in the chart, so, for example, you can decide whether to display the image or not, or adjust the image in accordance with the chart data. See example :

enter image description here

There, warnings (called notifications in the example) are displayed only when the y value is less than 1.

There is also an example with a curved line.

enter image description here

You can use the example of curved lines as a basis and copy-paste the notification layer from the notification example into it and add it to the chart layers. Then configure accordingly.

(Disclosure: I am the author)

0
source share

All Articles