Skip to content
Related Articles

Related Articles

How to create line chart in react using material UI and DevExpress ?

View Discussion
Improve Article
Save Article
  • Difficulty Level : Expert
  • Last Updated : 14 Jul, 2021
View Discussion
Improve Article
Save Article

DevExpress: DevExpress is a package for controlling and building the user interface of the Window, Mobile, and other applications.

Line Charts: Line charts are used to represent the relation between two data relationships X and relationships Y on a different axis. One of the axes of the plot represents the specific categories being compared, while the other axis represents the measured values corresponding to those categories.

Steps for creating React Application And Installing Module:

  • Step 1: Create a React application using the following command.
    npx create-react-app foldername
  • Step 2: After creating your project folder i.e. folder name, move to it using the following command.
    cd foldername
  • Step 3: After creating the ReactJS application, install the required modules using the following command.
    npm i --save @devexpress/dx-react-core @devexpress/dx-react-chart
    npm install @material-ui/core
    npm i --save @devexpress/dx-react-chart-material-ui

Project Structure: It will look like the following :

Project Structure


Example: Now write down the following code in the App.js file. Here, the App is our default component where we have written our code.


import React from "react";
import Paper from '@material-ui/core/Paper';
import {
} from '@devexpress/dx-react-chart-material-ui';
const App = () => {
// Sample data
const data = [
  { x: 1, y: 30 },
  { x: 2, y: 40 },
  { x: 3, y: 5 },
  { x: 4, y: 2 },
  { x: 5, y: 21 },
return (
      <ArgumentAxis />
      <ValueAxis />
      <LineSeries valueField="y" argumentField="x" />
export default App;

Step to Run Application: Run the application using the following command from the root directory of the project:

npm start

Output: Now open your browser and go to http://localhost:3000/, you will see the following output:


My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!