有谁知道如何使用react-chartjs
?
我导入了模块和相关模块
但仍然得到
"未捕获的ReferenceError:未定义行"
这是我的html文件示例代码
我找到的大多数示例都是使用another .js file
来导入它
这是使用react-chartjs的唯一方法吗?
<!DOCTYPE html>
<html>
<head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width">
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.2.1/react.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.2.1/react-dom.min.js"></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.5.0/Chart.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/react-chartjs/0.8.0/react-chartjs.min.js'></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-standalone/6.18.1/babel.min.js"></script>
</head>
<body>
<script type="text/jsx">
class Test extends React.Component {
render() {
var DayData = {
labels : ['a','b'],
datasets : [
{
data : [1,2]
}
]
};
var options={
responsive: false};
return (
<div>
<Line id='b' name='a' data={DayData} redraw/>
</div>
);
}
}
ReactDOM.render(
<Test/>,
document.getElementById('Test')
);
</script>
<div id="Test">Test</div>
</body>
</html>
&#13;