Is it possible to change dots size on LineChart? - ios

I am creating a CombinedChart with ios-chart library and I would like to change the dots size (data markers) of the LineChart. I would like to make them smaller because they are very big in comparison of the data. You can see an screenshot below:
Is it possible to change the size of that data markers? I could not find anything on the web.
Thanks in advance!

In Objective-c you can change the data marker radius from a LineChartDataSet
simply with
yourDataSet.circleRadius = 1.0

You can change the size of the circles with the next line:
yourline.circleRadius = CGFloat.init(4.0)

You are using a 3rd party framework. You can modify it to suit your needs.
In particular, it seems you would have to modify this file:
https://github.com/danielgindi/Charts/blob/master/Source/Charts/Components/MarkerImage.swift
If you run into any further difficulties you should ask a new question.

Related

Have to develop the component shown in below image

Need to develop the component shown in the image above using Objective-C language. No idea where to start and which framework to use. Any heads up/reference links to develop this component is highly appreciated.
Use a combination of UIBezierPaths with custom fill colors. You can either use a shape layer or core graphics. Bezier path allows you to construct a custom path, so the first one will be a triangle, and the second a quadrilateral.
You could also use paint code if you want to construct the path visually.
Look at this
https://www.raywenderlich.com/76433/how-to-make-a-custom-control-swift
It's a very general way to create whatever control you want.

Crop an image into a rectangle shape when the cropping points are on any shape which has 4 points - IOS/Swift

In my project, I want to set 4 cropping points manually on an image and crop that image according to set points. For example have a look on below image.
Like this, all I want is to crop the image according to that path and after cropping it should be a rectangle. This is just like image cropping in CamScanner IOS application. If anyone have any idea how to do this any help would be highly appreciated.
Here are found very nice github project that have same funtionality what you want but this is in Objective-C might be you can convert this code in to swift check the link following:
https://github.com/jberlana/JBCroppableView
It's output is:
UPDATE
I just made one Demo in Swift using JBCroppableView Objective-C class implements in Swift. Download from the following and use as per your requirement.
https://github.com/nitingohel/NGCropview
The Combination of Swift + Objective-C
OUTPUT
I think you need geometric_transformations.
If you plan to use opencv, here is a good example:
http://www.pyimagesearch.com/2014/08/25/4-point-opencv-getperspective-transform-example/

How to dynamic change frame in CorePlot even you touch it

I set up two CPTXYGraph plots and use UISegmentedControl to switch the UI. It works good but due to some reasons I want to have two different frame sizes, so I add the following code in one of plots:
CGRect hostframe=hostingView.bounds;
hostframe.origin.x+=100;
hostframe.size.width-=100;
[graph setFrame:hostframe];
It looks good and is actually working. However if you touch the plot UI the frame size is changed to the original. I also try to add the above code to the AxisDemo of CorePlotExamples, but still get the same result. Since I would like to have PointingDeviceDraggedEvent capability in the future, I has to find a solution for it.
Is there any way to do it?
Thanks in advance.
The Core Plot hosting view always keeps the graph sized to fill its bounds. Instead of resizing the graph, resize the hosting view.
Well, after several experiments I found a simplest solution:
graph.paddingLeft -= 100.0;
Now I can switch the UIs and change the frame size automatically without any problem. And also thanks for Eric's info.

The best way to create animation diagram

I'm trying to create something like this:
I looked many resources for that, but I still don't have idea how can I do it. Using CoreAnimation, Quartz2d or UIBezierPath I can draw a circle, but how can I draw a nice diagram with touch gesture's aid, using that? Maybe I wrong searched? If any tutorial, or sample code for this issue?
Best and easy library I used to draw pie chart with animation; MIM Chart Library for iOS
https://github.com/ReetuRaj/MIMChart-Library
Open source.
OK, CoreAnimation is not what you're looking for with this.
Anyway...
If you want to make a nice Pie Chart then you should take a look at CorePlot.
It has a lot of graphing functions and pie charts are in there too.
You can still animate with this you just need to update the percentages based on touch. Don't try to animate the sections of the circle. Change the percentages and update the circle.
Looks like you are trying to do some charts & plotting. If that is so, there is something called as
Core Plot
ILGraphics
OVGraphView
Some controls as well
Hope that helps.

Creating a new MKPolygon from two intersecting polygons

I know that there is exactly one specific question that talks about this but its a bit old and I wanted to get a little more technical about it if possible.
First of all take a look at this screenshot: https://www.dropbox.com/s/f94q3qaxrog0ec9/intersections.png
Want I want to have happen is say "I see where they both intersect and where that happens I do not want to draw those 'parts' of the polygon". In this case i would like to draw both polygons but not draw the 'path' of the yellow polygon that is inside the orange polygon. This include not only the line but the fill color as well.
Obviously this gets tricky because you aren't always going to have exact points along the path of each polygon that intersect exactly with other points along another polygon path. As you can see from this screenshot, in order to make this possible, I think, I need to get the points back where they do intersect.
After that and assuming that I can do this, I do not know if there is a way to use the CGPathRef class to do what i need to do. Obviously I am going to have re-create a polygon but according to the docs you cant fill it in unless it is a closed path. So how do you fill in the polygon that is not interesecting without closing the path??
The only thing that i can think of would be to "hide" the parts of the polygon that intersect but unsure how to do this. Can anyone offer any help/insight to this problem??
Here you go. I wrote an Objective-C wrapper around Alan's GPC library. Check out MKPolygon-GPC
Ok guys! well i went off and created my own MKPolygon category to solve what i needed to solve. I hope it is also useful to others!
the github link is: https://github.com/geeksweep/MKPolygon-GSPolygonIntersections
After days of investigation, here is the solution I found for Swift 4:
1) Go here and clone the project
2) Drag and drop the following in your project:
- MKPolygon+GPC.m
- MKPolygon+GPC.h
- gpc232 (folder)
3) Create a bridging header (here is a tutorial)
4) Open your bridging header file and add the following :
#import "MKPolygon+GPC.h"
5) In your View Controller , use this method to union your two Polygons :
let mergedPolygon = polygon1.fromUnion(with:polygon2)
NOTE : there is a crash in the current library, I fixed it but I am waiting my pull request to be reviewed. Thanks to SunGard-Labs for the framework !

Resources