Pie Charts
Generate a pie plot.
A pie plot is a proportional representation of the numerical data in a column
Examples
Pie Chart from Columns in a DataFrame
import { useEffect } from 'react';
import './App.css';
import { DataFrame } from "danfojs-nightly";
function App() {
useEffect(() => {
const df = new DataFrame({
Price: [19, 26, 55],
Location: ["NG", "GH", "SA"],
Type: ["Residential", "Non-Residential", "Utility"],
});
df.plot("plot_div").pie({ config: { values: "Price", labels: "Type" } });
}, [])
return (
<div className="App">
<header className="App-header">
<div id="plot_div"></div>
</header>
</div>
);
}
export default App;
Multiple Pie Chart from Columns in a DataFrame

Configure Position of Pie Charts
If you have more than one pie chart to display, you can set the grid parameter, and also the position of each pie.
For example, in the snippet below, we set the grid to 2 by 2 and also pass a set of row and column index positions. Each row/column position index corresponds to each pie.

Last updated
Was this helpful?