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

All Charts Icons Support [Dub #629, #624] #1261

Closed
wants to merge 5 commits into from

Conversation

abjurato
Copy link
Contributor

@abjurato abjurato commented Jul 22, 2016

Finally, implemented Icons (Nodal Image) feature for all charts.

simulator screen shot 22 jul 2016 9 03 19 pm simulator screen shot 22 jul 2016 9 04 04 pm

I've chosen to store image in data parameter of ChartDataEntry to allow icons to be specified per-value (example of use: to sign personal records in running application). Dataset can specify if it will draw icons and customise offset from default placement. IconOffset is CGSize, but for radial Radar and Pie only height value matters — as distance from centre.

ChartBaseDataSet, IChartDataSet:

  1. drawIconsEnabled:Bool flag and isDrawIconsEnabled() accessor for it
  2. iconsOffset:CGSize which allows to influence at placement of icon on chart in relation to value's text (wether it is visible or not)

ChartUtils:

  1. drawImage(context:CGContext, image:NSUIImage, point:CGPoint, expectedSize:CGSize, offset:CGSize) - draws image in context

All xxxChartRenderers:

  1. code to draw icon (if data set's isDrawIconsEnabled and image is included to entry's data) in drawValues() method

BarChartDataEntry:

  1. initialiser for stacked bar with data parameter — one data for whole stack

Demos: included star image to project, for stacked bar, pie, scatter, radar, line, candle stick, bubble, bar and horizontal bar added Toggle Icon button and star to be drawn.

@liuxuan30
Copy link
Member

liuxuan30 commented Jul 25, 2016

Great work! Could you please squash the commits to compact :) if you can't, just leave it be, and Daniel will review it.

One thing to say that is, due to Daniel is working on 3.0 version, this could take longer time, as 3.0 has major changes.. Not sure the impact to this one

@liuxuan30
Copy link
Member

also, does this mean we can close #624, #629?

…a property and dataset allows. Demos updated accordingly.
@ghost
Copy link

ghost commented Jul 25, 2016

@liuxuan30 thanks! squashed. Yes, all effects of #624 and #629 can be achieved using this branch. Will wait and hope there will not be too many conflicts with 3.0 release.

Btw, will version 3.0 be written on Swift3?

@liuxuan30
Copy link
Member

liuxuan30 commented Jul 25, 2016

@AnatolyRosencrantz thanks for the effort.
I think it depends on when @danielgindi will finish the work. If Charts 3.0 comes after swift 3 release, it will be converted into swift 3.0 I suppose.
The current swift-3.0 branch is just a temp branch I guess in order to test iOS 10 for apps. It's much easier to convert all in once than continuous converting... every Xcode beta has swift changes is annoying

@liuxuan30
Copy link
Member

liuxuan30 commented Jul 25, 2016

BTW, do you consider include some unit tests, it's nice to have the coverage. If you don't have time that's fine -

@ghost
Copy link

ghost commented Jul 25, 2016

@liuxuan30 nope. Should I update BarChartTests and LineChartTests or something more complex?

@liuxuan30
Copy link
Member

liuxuan30 commented Jul 25, 2016

@AnatolyRosencrantz it's great that you could add the tests for icons, just have one sample for each chart type to test is enough? Take your time, it's nice to have but not forcing

@ghost
Copy link

ghost commented Jul 26, 2016

@liuxuan30 updated existing BarChartTests and LineChartTests

@liuxuan30
Copy link
Member

liuxuan30 commented Jul 27, 2016

@AnatolyRosencrantz great work! Thanks so much. Travis good:)
I am not sure when @danielgindi would finish v3.0 and review this, but we will look into this when free. Please be patient:)

@ghost
Copy link

ghost commented Aug 4, 2016

Is there a way to add different icons for each bar?

@ghost
Copy link

ghost commented Aug 4, 2016

@michaeljules yes, icon is being set per-DataEntry (bar in BarChart or point in LineChart), in it's data property. This property is optional, so if no UIImage will be included or some other object will be found there — icon for that exact DataEntry will just not be drawn.

@liuxuan30
Copy link
Member

@AnatolyRosencrantz just FYI, Daniel wants to release v3 first and review and merge this after v3

@anfriis
Copy link

anfriis commented Oct 31, 2016

Can this be merged now with the release of 3.0?

@abjurato
Copy link
Contributor Author

abjurato commented Nov 6, 2016

Pull Request for Swift3 — #1793

@kiroskirin
Copy link

kiroskirin commented Mar 21, 2017

@abjurato Is it possible to show icons only for highlight values? Also automatic change base on user change highlight values.

@timotiuserick
Copy link

Can it support gif ? Really love this feature

PeterSrost pushed a commit to sokol8/Charts that referenced this pull request Oct 31, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants