我想在react-Native中的webview中呈现一个图表。我使用了highcharts npm包。
我定义了一个类似如下的Webview
<WebView ref='webview' />在componentDidMount中,我写道
componentDidMount(){
var chart = Highcharts.chart(this.refs.webview,{
series: [{
data: [1, 3, 2, 4]
}],
// ... more options - see http://api.highcharts.com/highcharts
});
}但这是抛出错误。
有人能指出我在这里做错了什么吗?谢谢
发布于 2020-01-24 02:24:32
我推荐使用react-native-highcharts或highcharts-react-native npm包。它通过react-native-highcharts中的ChartView组件和highcharts-react-native中的HigchchartsReactNative组件为您完成此任务。我认为您正在为react-highcharts编写代码,并试图将其放入WebView中。我不推荐这样做。这里有几个链接
https://www.highcharts.com/blog/post/creating-mobile-charts-with-highcharts-react-native/
https://www.npmjs.com/package/react-native-highcharts
主要区别在于,react-native-highcharts是一个第三方包,它支持大多数highcharts产品,如highstock或highmaps,而highcharts-react-native只支持highcharts。
https://stackoverflow.com/questions/37202507
复制相似问题