Page 1 of 1

How to change TChart source code

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

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
msbt

Re: How to change TChart source code

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

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
msbt

Re: How to change TChart source code

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

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
new_module.png (21.93 KiB) Viewed 31851 times
new_library.png
new_library.png (29.64 KiB) Viewed 31847 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
new_module_name.png (16.87 KiB) Viewed 31845 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 src.zip 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
files.png (23.98 KiB) Viewed 31847 times
5. At "Project Structure", add the dependency:
module_dependendy.png
module_dependendy.png (18.46 KiB) Viewed 31851 times
teechart_dependency.png
teechart_dependency.png (5.05 KiB) Viewed 31847 times
Now you should be able to import TeeChart units, so you would be using TeeChart directly from the sources!

Re: How to change TChart source code

Posted: Tue Nov 23, 2021 12:20 pm
by 17091758
After I did that accroding to the step ,the source code can be compiled ,but it can't work ,it showed the following error

I know it's a problem about Resource Bundle ,i tried lost of approches to change the property files but finally failed, could anyone can help me to find out the reason and how to solve it.

E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.merkapp.hgis, PID: 18423
java.util.MissingResourceException: Can't find bundle for base name com.steema.teechart.languages.languages, locale en_US
at java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:1561)
at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1384)
at java.util.ResourceBundle.getBundle(ResourceBundle.java:771)
at com.steema.teechart.languages.Language.activate(Language.java:64)
at com.steema.teechart.languages.Language.activate(Language.java:80)
at com.steema.teechart.languages.Language.getString(Language.java:86)
at com.steema.teechart.Chart.initFields(Chart.java:204)
at com.steema.teechart.Chart.<init>(Chart.java:529)
at com.steema.teechart.Chart.<init>(Chart.java:523)
at com.steema.teechart.TChart.<init>(TChart.java:337)
at com.steema.teechart.TChart.<init>(TChart.java:329)
at com.steema.teechart.TChart.<init>(TChart.java:325)
at com.merkapp.hgis.display.PRPS.<init>(PRPS.java:82)
at com.merkapp.hgis.ui.home.UHFFragment.initViews(UHFFragment.java:227)
at com.merkapp.hgis.ui.home.UHFFragment.onCreateView(UHFFragment.java:51)
at androidx.fragment.app.Fragment.performCreateView(Fragment.java:2600)
at androidx.fragment.app.FragmentManagerImpl.moveToState(FragmentManagerImpl.java:881)
at androidx.fragment.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManagerImpl.java:1238)
at androidx.fragment.app.FragmentManagerImpl.moveToState(FragmentManagerImpl.java:1303)
at androidx.fragment.app.BackStackRecord.executeOps(BackStackRecord.java:439)
at androidx.fragment.app.FragmentManagerImpl.executeOps(FragmentManagerImpl.java:2079)
at androidx.fragment.app.FragmentManagerImpl.executeOpsTogether(FragmentManagerImpl.java:1869)
at androidx.fragment.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(FragmentManagerImpl.java:1824)
at androidx.fragment.app.FragmentManagerImpl.execSingleAction(FragmentManagerImpl.java:1696)
at androidx.fragment.app.BackStackRecord.commitNowAllowingStateLoss(BackStackRecord.java:299)
at androidx.fragment.app.FragmentPagerAdapter.finishUpdate(FragmentPagerAdapter.java:235)

Re: How to change TChart source code

Posted: Fri Nov 26, 2021 2:46 pm
by yeray
Hello,
17091758 wrote:
Tue Nov 23, 2021 12:20 pm
I know it's a problem about Resource Bundle ,i tried lost of approches to change the property files but finally failed, could anyone can help me to find out the reason and how to solve it.
I've been able to reproduce the problem here so I've added it to the public tracker at #2488.