Powerful Data Visualisation with AG Grid & AG Charts

Rate this content
Bookmark

Does your React app have lots (and lots) of data that needs to be displayed in both Data Grids and Charts? Do your users want to interact with, analyse, and work with this data without compromising on performance or reliability? AG Grid provide the best React Data Grid & Charts libraries that are packed with features and provide unbeatable performance whilst being fully customisable. In this workshop, you'll learn how to get started with both AG Grid and AG Charts, learn how to use their key features. You will walk away from this free 3-hour workshop equipped with the knowledge for implementing AG Grid & AG Charts into your React application.

This workshop has been presented at React Summit US 2024, check out the latest edition of this React Conference.

FAQ

Mike Ryan is a Google developer expert in Angular and web technologies, and one of the creators of NGRX. He is also involved in consultancy through LiveLab App.

Aggrid is a high-performance JavaScript grid that offers features like filtering, sorting, aggregation, and more. It is considered the fastest grid and works well with React, making it suitable for handling large datasets efficiently.

Aggrid uses virtualization and heavy caching to provide high performance when sorting, filtering, and aggregating large datasets, allowing users to interact with millions of records quickly.

Aggrid offers features such as filtering, sorting, aggregation, grouping, pivoting, exporting to Excel or other formats, and data visualization through charts.

To integrate Aggrid into a React project, you start by running 'npm install --save aggrid-react' and include necessary CSS files. You can choose from various themes or create your own following Aggrid documentation.

Aggrid offers client-side and server-side row models. The client-side model is available in the community edition and is sufficient for many projects, while the server-side model is an enterprise feature that provides better performance for large datasets.

Columns in Aggrid can be customized using value getters, value formatters, and cell renderers, allowing developers to define how data is retrieved, formatted, and displayed.

AG Charts is a canvas-based charting library that can be used independently or with AGGrid. It allows for creating various types of charts, such as line, bar, and pie charts, in React applications.

To enable cell editing in Aggrid, you set the 'editable' property to true in the column definition. Aggrid provides built-in cell editors like text, large text, date, and select editors.

Mike Ryan
Mike Ryan
107 min
12 Nov, 2024

Comments

Sign in or register to post your comment.
Video Summary and Transcription
In this workshop, we explored the features of Aggrid and how it works seamlessly with React. Aggrid is known for its speed and performance, handling large datasets with ease. We learned how to set up Aggrid, define columns, bind data, and implement AG Grid. We also covered sorting, filtering, cell rendering, and cell editing in Aggrid. Additionally, we were introduced to AGCharts, a canvas-based charting library that works well with AGGrid for plotting and graphing data. AGCharts is optimized for performance and offers a wide range of chart types and customization options. The workshop provided practical examples and exercises to demonstrate the use of Aggrid and AGCharts. Follow Mike Ryan on Twitter and Blue Sky at Mike Ryan Dev or Mike Ryan.dev for more information and resources.

1. Introduction to Aggrid with React

Short description:

In this workshop, we will explore the features of Aggrid and how it works seamlessly with React. Aggrid is known for its speed and performance, handling large datasets with ease. It also offers essential features like filtering, sorting, aggregation, grouping, and data visualization. We will use slides from the LiveLab App website, where you can find more resources and information. Let's dive into Aggrid and discover its capabilities.

Let's go ahead and get started. First, I'd like to introduce myself. My name is Mike Ryan. I'm a Google developer expert in Angular and web technologies. I'm one of the creators of NGRX. It's one of the most popular state management libraries in the Angular ecosystem. But today we're here to talk about how to use Aggrid with React.

So first I'll start off with why Aggrid. Well, if you've been to Aggrid's website, they have this marketing headline of being the fastest JavaScript grid in the world. And I actually do believe that to be true. It's extremely high performance. It uses a lot of handy performance features underneath the hood, like virtualization and a lot of heavy caching to give users a really great experience when sorting, filtering and aggregating through huge datasets. Personally, I've used Aggrid with some of the biggest banking and financial companies in the United States and I've seen these companies put millions of records into Aggrid and users are still able to get through that data lightning fast.

But it's not just about speed and performance. Aggrid also has a lot of features built into it that I think are essential when trying to build out those Excel-like features into our applications. Like I've already mentioned, it does filtering and sorting. It also does aggregation, grouping and pivoting. It can export results out into Excel or other formats. You can attach really nice charts to it to visualize the data you put into Aggrid. And best of all, it works really well with React. So if you want to bring it into your React project, it's one of the best grids for that reason.

Today we're going to be using slides from the LiveLab App website. LiveLab App is my consultancy. Me, along with Brian Love, another Google developer expert in web technologies, we offer training, workshops and consulting services through LiveLab App. So if you want to see more about LiveLab App, you're welcome to join or look through our content. But for the slides, you can use this link. For all of the slides today, what we'll be doing is kind of going through this workshop and all of these sections will have different challenges rendered through StackBlitz. So as we get to exercises, you'll open them up in StackBlitz. It'll bring in a full React development environment for us to perform those challenges in. So with that, let's get started with Aggrid.

Read also

2. Setting up Aggrid and Defining Columns

Short description:

To use Aggrid in your project, start by installing the necessary modules and CSS files. Aggrid offers various themes, including a new theme with a dark mode. You can choose from the built-in themes or create your own. Define the columns that will be displayed in the grid and bind them to the Aggrid React component. Use the use date hook to update the columns dynamically. The column definitions specify the name and field for each column, supporting nested referencing. AGGrid provides a client-side row model for fetching data, while the server-side row model is available in the enterprise edition for optimal performance.

So if you are trying to bring Aggrid into your own project, you start off by running npm install dash save aggrid react. And that's going to bring in the community set of modules needed to start using Aggrid in your project. Additionally, you need to bring a couple of CSS files along for the ride. So there should be the base CSS file. And then Aggrid actually comes with a number of different themes. There's a material theme, a quartz theme. There's a brand new Aggrid theme they just worked on and released this past year that brings in a dark mode. You can kind of peruse through all the different themes on the Aggrid documentation to see if one of the built-in ones is to your liking. And if you don't like any of the built-in ones, it's really well documented as to how you create your own theme. So again, Aggrid's flexible. It's meant to be embedded into your application and meant to look and feel like your application. And their theming capabilities certainly support that feature.

We're going to start off with how to actually get data into Aggrid from our React project. And every Aggrid implementation starts off by defining the columns that are going to be shown in your grid. Each column is defined using this call def object. It's short for column definition. By default, columns are going to be positioned in the order that matches the column definition specified. So we're going to create an array of column definitions, and we're going to supply them to Aggrid. And that order in that array is going to dictate what order they get displayed inside of the grid. To do that, we're going to create that array, and then we're going to bind it to the column defs prop on the Aggrid React component. We're going to be importing that Aggrid React component from the Aggrid React package. Additionally, as you might notice, we're also going to have to put a few theme classes on a wrapper element. So here I have a div with a class name of ag-theme-quartz-auto-dark. That means that we're going to apply that quartz theme. It's going to automatically transition between light and dark, but it's going to start at dark, kind of based on the system preferences.

Next we need to define those column definitions. My favorite way to do this is to first define an interface for the actual data we're going to be binding into our grid. So I hope most of you are familiar with TypeScript. If not, we're going to try and keep the TypeScript somewhat light here in this workshop. But for our TypeScript developers, in this case, our row data here is going to be a collection of colors. Those colors are going to have a name, and of course, the associated color. Then for our column definitions, I'm going to use the use date hook. Why is this? Well, in future challenges, we're going to want to be able to update the columns that we're showing in our grid. And so putting them in a use date hook is going to allow us to first supply that initial value to AGGridReact component. And then whenever we want to change or update these column definitions, we'll have that set column defs callback function that we can call to change those out. And for the type of this, I'm going to import the call def interface directly from AGGridReact. And it accepts a generic type parameter, which is the type of data that we're actually binding. So you can see here that I'm going to be passing in an array of column definitions based on this row data interface that I defined above. For each of these, we're going to supply at a minimum two values. We're going to tell AGGrid what the name of this column is, and then what field on our row data interface it should use to render the cells for that particular column.

So in its simplest form, what is a column definition doing? Well, it's telling AGGrid, here's what name we should use for the column header. And here's how to look up data inside of our row data to actually populate those cells. You might have noticed that I use the string for that field. And I'm excited to let you know that it does support nesting or deep references. So you can use dot notation if you're trying to traverse complex objects. You can also, as we'll see later on in the workshop, use other means of actually populating those cells besides just like a string based field. So if you want to use the callback function, for example, stick around. We're going to get there. We're just going to start off with the simplest form of column definitions first.

Broadly, there are going to be two different row models provided by AGGrid. There's a client-side row model and a server-side row model. For this workshop, because we're using the community edition of AGGrid, we're going to be limited to using the client-side row model. What the client-side row model means is that it's up to us as the developers or implementers of AGGrid to actually go and fetch all the data that we want to go render inside of our AGGrid. The other row model listed here, server-side row model, is an AGGrid enterprise feature. But it allows AGGrid to know how to go fetch data. And it's really best for performance because as we start applying things like filters, sorts, aggregates, groups, pivots, things of that nature, we don't want to go load in millions of records just to go populate an initial view for AGGrid. And so the server-side row model does is it's going to intelligently ask our back-end how to get just the set of rows that are visible on the screen. And as the user pivots and scrolls and filters and does everything that they want to do with their AGGrid, it's going to then go fetch just the data it needs making it a lot more performant. But as you'll see, the client-side row model is still blazing fast. I think it's really sufficient for a lot of projects.

QnA

Watch more workshops on topic

Build a powerful DataGrid in few hours with Ag Grid
React Summit US 2023React Summit US 2023
96 min
Build a powerful DataGrid in few hours with Ag Grid
Top Content
WorkshopFree
Mike Ryan
Mike Ryan
Does your React app need to efficiently display lots (and lots) of data in a grid? Do your users want to be able to search, sort, filter, and edit data? AG Grid is the best JavaScript grid in the world and is packed with features, highly performant, and extensible. In this workshop, you’ll learn how to get started with AG Grid, how we can enable sorting and filtering of data in the grid, cell rendering, and more. You will walk away from this free 3-hour workshop equipped with the knowledge for implementing AG Grid into your React application.
We all know that rolling our own grid solution is not easy, and let's be honest, is not something that we should be working on. We are focused on building a product and driving forward innovation. In this workshop, you'll see just how easy it is to get started with AG Grid.
Prerequisites: Basic React and JavaScript
Workshop level: Beginner
Build a Powerful Datagrid With AG Grid
React Summit 2024React Summit 2024
168 min
Build a Powerful Datagrid With AG Grid
Top Content
WorkshopFree
Brian Love
Brian Love
Does your React app need to efficiently display lots (and lots) of data in a grid? Do your users want to be able to search, sort, filter, and edit data? AG Grid is the best JavaScript grid in the world and is packed with features, highly performant, and extensible. In this workshop, you’ll learn how to get started with AG Grid, how we can enable sorting and filtering of data in the grid, cell rendering, and more. You will walk away from this free 3-hour workshop equipped with the knowledge for implementing AG Grid into your React application.
Powerful Data Visualisation with AG Grid & AG Charts
React Advanced 2024React Advanced 2024
145 min
Powerful Data Visualisation with AG Grid & AG Charts
WorkshopFree
Brian Love
Brian Love
Does your React app have lots (and lots) of data that needs to be displayed in both Data Grids and Charts? Do your users want to interact with, analyse, and work with this data without compromising on performance or reliability? AG Grid provide the best React Data Grid & Charts libraries that are packed with features and provide unbeatable performance whilst being fully customizable. In this workshop, you'll learn how to get started with both AG Grid and AG Charts, learn how to use their key features. You will walk away from this free 3-hour workshop equipped with the knowledge for implementing AG Grid & AG Charts into your React application.
Data Visualization for Web Developers
JSNation Live 2021JSNation Live 2021
139 min
Data Visualization for Web Developers
WorkshopFree
Anjana Vakil
Anjana Vakil
In this workshop, through hands-on projects we'll learn how to use Observable, a browser-based reactive coding platform, to rapidly build insightful, interactive visualizations in JavaScript. After completing this workshop, you'll have the basic tools & techniques you need to start using dataviz to better understand your code, your projects & your users, and make better data-driven decisions as a developer.
Painting with Data: Intro to d3.js
JSNation Live 2021JSNation Live 2021
130 min
Painting with Data: Intro to d3.js
Workshop
Ian Johnson
Ian Johnson
D3.js is a powerful JavaScript library for building data visualizations, but anyone who has tried to use it quickly finds out that it goes deeper picking your favorite chart type. This workshop is designed to give you a hands-on introduction to the essential concepts and techniques for creating custom data visualizations with d3.js. By the end of this workshop you will have made an interactive and animated visualization on a realistic dataset that you can easily swap out with your own.

Check out more articles and videos

We constantly think of articles and videos that might spark Git people interest / skill us up or help building a stellar career

(Easier) Interactive Data Visualization in React
React Advanced 2021React Advanced 2021
27 min
(Easier) Interactive Data Visualization in React
Top Content
This Talk is about interactive data visualization in React using the Plot library. Plot is a high-level library that simplifies the process of visualizing data by providing key concepts and defaults for layout decisions. It can be integrated with React using hooks like useRef and useEffect. Plot allows for customization and supports features like sorting and adding additional marks. The Talk also discusses accessibility concerns, SSR support, and compares Plot to other libraries like D3 and Vega-Lite.
GPU Accelerating Node.js Web Services and Visualization with RAPIDS
JSNation 2022JSNation 2022
26 min
GPU Accelerating Node.js Web Services and Visualization with RAPIDS
Welcome to GPU Accelerating Node.js Web Services and Visualization with Rapids. Rapids aims to bring high-performance data science capabilities to Node.js, providing a streamlined API to the Rapids platform without the need to learn a new language or environment. GPU acceleration in Node.js enables performance optimization and memory access without changing existing code. The demos showcase the power and speed of GPUs and rapids in ETL data processing, graph visualization, and point cloud interaction. Future plans include expanding the library, improving developer UX, and exploring native Windows support.
Never Have an Unmaintainable Jupyter Notebook Again!
ML conf EU 2020ML conf EU 2020
26 min
Never Have an Unmaintainable Jupyter Notebook Again!
Jupyter Notebooks are important for data science, but maintaining them can be challenging. Visualizing data sets and using code quality tools like NBQA can help address these challenges. Tools like nbdime and Precommit can assist with version control and future code quality. Configuring NBQA and other code quality tools can be done in the PyProject.toml file. NBQA has been integrated into various projects' continuous integration workflows. Moving code from notebooks to Python packages should be considered based on the need for reproducibility and self-contained solutions.
Sharing is Caring: Reusing Web Data Viz in React Native
React Summit 2022React Summit 2022
26 min
Sharing is Caring: Reusing Web Data Viz in React Native
PolarisViz is a collection of React components that provide consistent visual styles, motion design, and accessibility features. It aims to solve the problem of inconsistencies in visualization decisions made by different teams. The library is flexible for different visual styles and has centralized theme management. PolarisViz was integrated with React Native using a separate library called Polaris Viz core. Challenges included limitations in native apps and the need to share UI components between web and mobile platforms.