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

Issue while displaying the chart (HorizontalBarChartView) #202

Closed
wganeshb opened this issue Jul 10, 2015 · 11 comments
Closed

Issue while displaying the chart (HorizontalBarChartView) #202

wganeshb opened this issue Jul 10, 2015 · 11 comments

Comments

@wganeshb
Copy link

I am trying to implement chart functionality using iOS-charts.
I tried with the ChartsDemo example. It compiled successfully. and could run it on device too.

I followed all the steps from README file.
I repeated it number of times in last 3 days. But I am still struggling with the integration.
I am not getting if I am missing something while integration.

After errorless integration I am getting console log as "Unknown class HorizontalBarChartView in Interface Builder file."

I created single view application using Xcode 6.4
Following are some of the screenshots of my Xcode. Please help me with the successful integration.

screen shot 2015-07-10 at 5 10 55 pm

screen shot 2015-07-10 at 5 14 01 pm

screen shot 2015-07-10 at 5 14 34 pm

In GraphViewController I have copied and used code from HorizontalBarChartViewController.h and .m
as it is.

screen shot 2015-07-10 at 5 15 00 pm

screen shot 2015-07-10 at 5 16 16 pm

@wganeshb
Copy link
Author

This is first time I am asking question on github. I don't know how to use github for communication. Please forgive me if the question is irrelevant.

@kvnbautista
Copy link

the compiler doesn't know where is HorizontalBarChartView because you changed the name from the original class name "HorizontalBarChartView" to "GraphViewController"
And make sure the class name is defined on one of the ViewController as GraphViewController

@wganeshb
Copy link
Author

@bautistax Thanks.
Actually I haven't changed the class name from "HorizontalBarChartView" to "GraphViewController". The pointer to "HorizontalBarChartView" is "chartView" and it is declared as property inside class "GraphViewController".

@danielgindi
Copy link
Collaborator

danielgindi commented Jul 10, 2015 via email

@wganeshb
Copy link
Author

@danielgindi Thanks.

Sorry But I didn't get you. how to use Charts.HorizontalBarChartView. Can you please elaborate it.

@danielgindi
Copy link
Collaborator

@wganeshb You're missing the namespace

@liuxuan30
Copy link
Member

  1. check build settings for embed content contains swift code, define module, and make sure your module name is correct.
  2. I think you add wrong @import for swift to Objective-C. There should be no bridging header file, instead, it looks like "{module name}-Swift.h", BY default (you can check it in swift compiler - code generation). the bridging header file is for swift to import Objective-C code, BY default.
  3. the Objective-C generated interface header file is generated by Xcode automatically. Once you can compile and import it, you should be able to use swift class.

@wganeshb
Copy link
Author

@liuxuan30 Thanks, You are right. now I changed the import to "DemoCharts-Swift.h". The build is successful without error.

But still I am getting console log as "Unknown class HorizontalBarChartView in Interface Builder file.".

I have IBOutlet for HorizontalBarChartView inside GraphViewController. And it is very well connected. Am I missing anything else.

screen shot 2015-07-13 at 1 20 03 pm

@danielgindi
Copy link
Collaborator

I've already said that you are missing a namespace. The charts are namespaced under Charts.

@wganeshb
Copy link
Author

@danielgindi Thanks, now it is not not giving any error or console log.

But somehow not showing the chart.
I am only trying HorizontalBarChartView for now.

I cross checked all the connections and still working on if I am missing anything.
It only shows up this view as shown in screen shot.

ios simulator screen shot 14-jul-2015 7 35 53 pm

I guess it should show default data from 'months' and 'parties' array.

Thanks.. 😄

@wganeshb
Copy link
Author

Thanks a lot for this great chart library.
This is the most interactive and good looking chart library for the iOS platform. Giving me the what exactly I was looking for. 😄

I tried to integrate this library almost for the 4 days in my objectiveC project. But every time missing something. Sorry for the trouble I gave.

@danielgindi already mentioned the usage steps in readme file. they are pretty straight forward. I read them again and again and everytime made the same mistakes. Finally successfully integrated the Charts in ObjectiveC project.

I would like to share the steps again that I went through.
Steps -

  1. Create single view app with language ObjectiveC.

  2. Go to, PROJECT -> Build Settings ->
    Search the term packaging. Under packaging select Defines Module to YES. As shown below.
    screen shot 2015-07-15 at 6 40 51 pm

  3. Go to, TARGETS -> Build Settings ->
    Search the term packaging. Under packaging set 'Product Module Name' and 'Product Name' to
    project name. In this case Testing. As shown below.
    screen shot 2015-07-15 at 6 51 05 pm

  4. Go to, TARGETS -> Build Settings ->
    Search the term Embedded. Under 'Build Options' set 'Embedded Content Contains Swift Code' to
    YES. As shown below.

screen shot 2015-07-15 at 7 05 36 pm

  1. Add new swift file to project with same name as project target name or project name. Here in this case 'Testing' As shown below.
    screen shot 2015-07-15 at 6 52 42 pm

On file create Xcode will Show popup as shown below. Select YES. It will create the bridging header files for project.
screen shot 2015-07-15 at 7 19 59 pm

  1. Add all file and subfolder from Charts folder to the Projects root file.
    screen shot 2015-07-15 at 7 25 04 pm

  2. Add copied Charts.xcodeproj to project using option 'Add files to project_name' As shown below.
    screen shot 2015-07-15 at 7 26 59 pm

On adding the Xcode will look like below screen shot.
screen shot 2015-07-15 at 7 32 25 pm

  1. Go to, TARGETS -> General
    Press + under the option 'Embedded binaries'. Select Charts.framework. Add it to the project.
    As shown.
    screen shot 2015-07-15 at 7 34 51 pm

These are some of the mandatory steps. In order to avoid the 'File not found' like other compile time errors.

Follow the objectiveC example Demos provided by the @danielgindi, the project owner under project ChartsDemo. These demos are really best example covering all the charts.

Thank you once again. 👍

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

No branches or pull requests

4 participants