适用于Android和IOS的HighChart库 [英] HighChart Libraries for Android and IOS
问题描述
我想在Android和iOS移动应用中使用HighCharts。
Android或iOS中是否有任何库或Gradle依赖关系?
如果您已经编写了代码 Highcharts
,并希望显示在 iOS
中,那么最好的方法是将图表显示在 webView的
。从回答:
1)首先创建一个html文件并执行必要的代码或者试用可以从你从包中获得的例子复制html代码
rel =nofollow noreferrer > http://www.highcharts.com/download
2)确保html中的脚本应该有正确的.js链接,例如: -
或
如果您想在本地提供它,您可以编写但请确保.js文件在您的应用程序文件夹中。
$ b $ 3>NSString * htmlFile = [[NSBundle mainBundle] pathForResource:@graphofType:@html ]。
NSString * htmlString = [NSString stringWithContentsOfFile:htmlFile encoding:NSUTF8StringEncoding error:nil];
[obj loadHTMLString:htmlString baseURL:nil];
$ b strong>
您可以使用Android和iOS可用的许多本机库之一。 为什么我要这样做?你问?那么,对于初学者来说,本地代码执行得比 HTML / Javascript-code-inside-a-webview 更平滑更快。另外,你可以更好地控制你显示的内容。例如,您可以在应用内部处理群集。
以下是我所知道的一些很好的例子,但是如果您搜索,还有许多优秀的库。
Android >: MPAndroidChart
iOS : iOS-Charts 和 JBChartView
I want to use HighCharts in Android and iOS mobile apps . Is there any libraries or Gradle dependencies are availble in Android or iOS?
If you have already written code in Highcharts
and want to display it in iOS
, then the best way would be to display the chart inside a webView
. From this answer:
1) First just creat one html file and do the needful code or for trial can copy html code from examples that you get from package http://www.highcharts.com/download
2) Make sure that the scripts in html should have proper .js links for e.g:-
or
if you want to give it locally you can write But make sure that the .js files are there in your application folder.
3)
NSString *htmlFile = [[NSBundle mainBundle] pathForResource:@"graph" ofType:@"html"]; NSString* htmlString = [NSString stringWithContentsOfFile:htmlFile encoding:NSUTF8StringEncoding error:nil]; [obj loadHTMLString:htmlString baseURL:nil];
OR
You could use one of the many native libraries available for android and iOS. "Why would I want to do that" you ask? Well, for starters, Native code performs much smoother and faster than HTML/Javascript-code-inside-a-webview. Additionally, you would have much finer control of what you display. For instance, you could handle Clustering inside your app itself.
Here are some of the good ones I know, but there are lots of good libraries if you search.
Android : MPAndroidChart
iOS : iOS-Charts and JBChartView
这篇关于适用于Android和IOS的HighChart库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!