SAP

Manage my Account SAP Devs YouTube ↗ Learnings ↗ Community ↗ Provide Feedback ↗
Logout
⤢ Open full site

Integrate Charts and Conditional Rendering

Display data in charts using UI5 Web Components for React.

Overview

🎓 beginner ⏱ 20 min. HTML5BeginnerSAP Fiori

You will learn

  • ✔How to import and use charts with UI5 Web Components for React
  • ✔How to add dynamic rendering

More from Lukas Harbarth

See all 6 tutorials by Lukas Harbarth →

Prerequisites

Steps

Intro

UI5 Web Components for React also comes with a chart library. In this tutorial, you will integrate two chart types and add data to them. Also, you will learn how to conditionally render components, and how React handles updates to the DOM and single components.


Step 1 Install dependencies and import charts
—

  1. Install the chart library of UI5 Web Components for React.

    Shell
     npm install @ui5/webcomponents-react-charts

    Note: When facing issues with installing, please ensure you’re using the same minor version as the other @ui5/webcomponents* packages. You might have to also manually pin @ui5/webcomponents-react-base to that minor version. In that case, the install command would be npm install @ui5/webcomponents-react-charts@<version> @ui5/webcomponents-react-base@<version>.

    For example:

    Shell
    npm install @ui5/webcomponents-react-charts@2.27 @ui5/webcomponents-react-base@2.27
  2. Then, import LineChart and BarChart into MyApp.tsx.

    TypeScript
    import { BarChart, LineChart } from "@ui5/webcomponents-react-charts";
Step 2 Add charts to Card component
+
Step 3 Add conditional rendering
+
Step 4 Update a component in React - Loading Indicator
+
Step 5 Add dynamic header and text
+

Resources

Discussion

Share feedback on this tutorial or join the conversation in SAP Community.

Submit detailed feedback Discuss in Community
Steps
Step 1 of 5
1. Install dependencies and import charts 2. Add charts to Card component 3. Add conditional rendering 4. Update a component in React - Loading Indicator 5. Add dynamic header and text
Next