Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PieChart, adding an imageView beside values #2318

Open
maryamfekri opened this issue Apr 3, 2017 · 6 comments
Open

PieChart, adding an imageView beside values #2318

maryamfekri opened this issue Apr 3, 2017 · 6 comments

Comments

@maryamfekri
Copy link

maryamfekri commented Apr 3, 2017

can you please help me how to add an imageView beside the position of the label like below image :

this is what I want :
screen shot 2017-04-05 at 10 25 19 am

version

Minor improvements, icons supports, Swift 3.1

supports icon for PieChart but it does not draw images on a good position regard to the related value label. it has an iconOffset with x and y but it won't fully support for all different values.

@liuxuan30
Copy link
Member

liuxuan30 commented Apr 5, 2017

The first question seems too generic and the answer you should already know. The real issue should be your second qestion, It's better can can explain with details for

but it does not draw images on a good position regard to the related value label. it has an iconOffset with x and y but it won't fully support for all different values.

If it's a bug or need enhancements so we can take a look.

@maryamfekri
Copy link
Author

at first I didn't know about the feature of having icon in your new version, but then I realize that there is a parameter for DataEntry that receive an NSUIIMage. but it will place the image in side the pie chart.
But what i need for my project is to have the image beside the labels (see the image above -> 5%).

I found that the icon has an offset property, which will receive x and y for moving the image, but It does not handle the overlaying of images. I mean if use this icon you provide in your new version and moving it to outside the pie chart, it will overlay with other images and labels.

can you please fix this issue to handle this? or maybe you need a Bool to determine image should be outside the piechart or inside the piechart.

@maryamfekri
Copy link
Author

I have also posted a question in stackOverFlow which you can track here

@maryamfekri
Copy link
Author

maryamfekri commented Apr 5, 2017

@liuxuan30
I developed in my project and also committed here as a merge request.
the purpose is to add an image beside the value in pie chart.

now I have this below image below image :

screen shot 2017-04-05 at 3 15 38 pm

@sashalondon
Copy link

I cannot find any reference in the wiki on how to do this?

@maryamfekri
Copy link
Author

maryamfekri commented May 28, 2017

@sashalondon yes , still not merged with the origin repo, but I have created the pull request which is waiting to be merge. although you can find my commits in my pull request

about how to do this:
you have to pass UIImageView to the PieChartDataEntry init class, which the name is imageView not the icon.
for example :

for i in 0..<dataPoints.count {
    let dataEntry = PieChartDataEntry(value: values[i], label: dataPoints[i], icon: nil, data: dataPoints as AnyObject, imageView: UIImageView()) //your imageView to be shown for each dataEntry
     dataEntries.append(dataEntry)
} 

maryamfekri added a commit to maryamfekri/Charts that referenced this issue Jan 24, 2018
… image will be shown beside the value label of each slice
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants