Hi i am trying to find a way to make a data set that each of the markers will be an image instead of the default points or circles, is there a way to do it?
sure, there is already an UIImage property there:
public class ChartMarker: ChartComponentBase
{
/// The marker image to render
public var image: UIImage?
All you have to do is to figure out what's the position for it:
/// Draws the ChartMarker on the given position on the given context
public func draw(context context: CGContext, point: CGPoint)
{
let offset = self.offset
let size = self.size
let rect = CGRect(x: point.x + offset.x, y: point.y + offset.y, width: size.width, height: size.height)
UIGraphicsPushContext(context)
image!.drawInRect(rect)
UIGraphicsPopContext()
}
Can you provide an example I can't find any in the documentation and I couldn't understand your explanation.
Thanks,
Gal
I am saying ChartMarker already has image property. I have post the code and point out the function in my answer that you need look at.
i want to make a graph like this where 1 set will be a regular line and the other will be another indicator with pills for example if my x axis is the time i will have a series of times i need to take a pill.
i don't need the marker to show image when it is selected i need a complete set of data values to show images instead of default circle/dot.
i really appreciate any help.
screenshot:

answered in #506
Hi.
i want add marker using draw or property image same attachment file. help me. Thanks

Any one found solution for custom marker Image.
i want to add custom marker like in the bellow picture , anyone can help me. Thanks

I don't know if anyone still looking for a solution. Here is an example:
let entries = stride(from: 0.0, to: Double(10), by: 1.0).map { (i) -> ChartDataEntry in
return ChartDataEntry(x: i+0.25, y: Double(55), icon: UIImage.init(named: "YourImageName"))
}
I am using scatter plot, just create your data entries with an image name, and Charts will plot it for you automatically, depending on icon size of your file.
🥳
Most helpful comment
I don't know if anyone still looking for a solution. Here is an example:
I am using scatter plot, just create your data entries with an image name, and Charts will plot it for you automatically, depending on icon size of your file.
🥳