javascript 与 React Native 等效的 Chart.js

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/29442037/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-28 10:32:44  来源:igfitidea点击:

Chart.js equivalent for React Native

javascriptiosobjective-cswiftreact-native

提问by millionhari

I want to get interactive charts to work in my React Native app. I know there's probably not a React Native specific library made yet, but what Objective-C/Swift/Javascript library should I be looking into that would allow me to make charts/graphs that look like the ones Chart.js generate?

我想让交互式图表在我的 React Native 应用程序中工作。我知道可能还没有一个 React Native 特定的库,但是我应该研究什么 Objective-C/Swift/Javascript 库来让我制作看起来像 Chart.js 生成的图表/图形?

回答by Sulliwane

I would go for ART libraryof the react-native project.

我会选择react-native 项目的ART 库

Here is a chart examplefor ReactJS that you could adapt for react-native, by looking at these React-native Artexamples.

这是ReactJS的图表示例,您可以通过查看这些React-native Art示例来适应 react-native 。

Also, there is probably something to investigate with Chartist librarywhich use SVG to draw charts, and that has a reactjs component.

此外,使用 SVG 绘制图表的Chartist 库可能需要调查一些事情,它有一个reactjs 组件

EDIT: As of version 0.18rc, React-Native also support ART library for Android.

编辑:从 0.18rc 版本开始,React-Native 也支持Android 的 ART 库

回答by Colin Ramsay

You'll be wanting to look at Obj-C and Swift, not JavaScript I think. Existing JS libraries will be drawing to the DOM, Canvas or some other browser target that won't be available in React Native. That should narrow the field a bit. Then to use it direct from RN you need to create a Native Modulebetween JS and Obj-C.

你会想看看 Obj-C 和 Swift,而不是我认为的 JavaScript。现有的 JS 库将绘制到 DOM、Canvas 或其他一些在 React Native 中不可用的浏览器目标。那应该会缩小范围。然后要直接从 RN 使用它,您需要在 JS 和 Obj-C 之间创建一个本机模块

So at that point it boils down to: "what's a good iOS charting library" and fortunately someone's already done the hard work on that one over on this answer. Core Plotlooks pretty comprehensive.

所以在这一点上它归结为:“什么是好的 iOS 图表库”,幸运的是有人已经在这个答案上完成了这项工作。核心情节看起来很全面。

回答by vinayr