Page 1 of 1

How to change TChart source code

Posted: Sun Mar 13, 2016 1:03 pm
by 17075092

I'm using TeeChart for my Android App. I would like to change the provided source code such that the behavior fits my needs a bit better.
I tried to add some methods in the provided java classes (files in "src" folder) and then to create a .jar (containing the modified src folder) of it and added this new jar file as library. (I created the jar file by using command "jar cvf new.jar META-INF com" in command promt)
This leads to errors regarding the compiler. TeeChart classes cannot be resolved anymore.
Then I copied the whole "com" folder of the "src" folder to my project in "app>src>main>java", which compiles fine.
But the app crashes as soon as the layout in which the TChart is placed is inflated .

Can you please give me a instruction how to import my modified source files to Android Studio properly?

Thank you in advance!
Best regards

Re: How to change TChart source code

Posted: Mon Mar 14, 2016 3:56 pm
by yeray

Check out this article.
Don't hesitate to let us know if you still find problems with it.

Re: How to change TChart source code

Posted: Mon Mar 14, 2016 4:40 pm
by 17075092
Hello Yeray,

thank you for your quick answer, but i'm afraid this didn't solve my problem. As far as I can see this more a instruction how to add the teechart library in general.
What I want is to change some methods in the provided library. So I thought best way would be unzip the "src" zip folder (which I could find after installation in the downloaded "TeeChartJavaAndroidSrc_3.2015.0108" folder and then to make changes in the therein contained java classes. The next step is where I get stuck. How do I import my modified classes to Android Studio?

Thank you in advance!
Kind regards

Re: How to change TChart source code

Posted: Tue Mar 15, 2016 9:19 am
by yeray

I'll try to explain the steps to add the TeeChart sources to an Android Studio project.

1. Create a new project in Android Studio. I've created a simple app targeting API 15+, with a blank activity leaving the default name "My Application".

2. Add a new library module to the Project Structure:
new_module.png (21.93 KiB) Viewed 4808 times
new_library.png (29.64 KiB) Viewed 4804 times
3. Give it a name and a target. I've named it as "TeeChart", "com.steema.teechart" and target API 7+:
new_module_name.png (16.87 KiB) Viewed 4802 times
This creates a folder tree under your app "teechart\src\main\java\com\steema\teechart"

4. After installing TeeChart for Android with sources or TeeChart Java Suite with sources, you should find a containing the sources. Extracting it you'll find the TeeChart Java for Android sources, with a structure similar than the created on the empty module above: "src\Android\com\steema\teechart".
Copy the contents of this path into the path above in your module to have something like this:
files.png (23.98 KiB) Viewed 4804 times
5. At "Project Structure", add the dependency:
module_dependendy.png (18.46 KiB) Viewed 4808 times
teechart_dependency.png (5.05 KiB) Viewed 4804 times
Now you should be able to import TeeChart units, so you would be using TeeChart directly from the sources!