[英]react-d3-component implement in create-react-app
I'm new to react. 我是新来的。 By my research, I figured out that React-D3-component can serve my purpose.
通过研究,我发现React-D3组件可以达到我的目的。
I'm looking for an example of a Multi-series Line chart with tooltip and zoomable function. 我正在寻找带有工具提示和可缩放功能的多系列折线图的示例。 Basic line chart would also make this trick for my first steps.
基本的折线图也可以帮助我完成第一步。
I've a create-react-app, boilerplate ready. 我已经准备好一个create-react-app样板。 I need to put up this graph into a create-react-app project.
我需要将此图放入一个create-react-app项目中。
Please guide me through an example, which explains step by step how to implement this kind of graph. 请通过示例指导我,该示例逐步说明了如何实现这种图形。
Here are a few steps to do in order to make your app work: 为了使您的应用正常工作,请执行以下几个步骤:
Config your create-react-app boiler plate with Webpack and make sure you can run it without React-D3-component module. 使用Webpack配置您的create-react-app样板,并确保您可以在没有React-D3-component模块的情况下运行它。
Find the homepage component (normally main.js) try to modify some basic HTML elements and see if you can see the changes on page with hot-reloading. 找到主页组件(通常为main.js),尝试修改一些基本的HTML元素,并查看是否可以通过热重载看到页面上的更改。 For instance, adding a H1 red tag.
例如,添加一个H1红色标签。
Install React-D3-component module with npm command: 使用npm命令安装React-D3-component模块:
npm install react-d3-components --save
Start adding React-D3-component into your homepage component you just modified by importing the module: 通过导入模块,开始将React-D3-component添加到刚修改的主页组件中:
import ReactD3 from 'react-d3-components'
Follow the example here , and create your chart components in your homepage. 按照此处的示例,并在主页中创建图表组件。
This workflow should work for any React modules for testing purposes. 此工作流程应可用于任何React模块以进行测试。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.