Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Adding new chart types to react pivottable

I’m wondering if it’s possible to add new type of charts, like a radar chart, to the React library plotly/react-pivottable https://github.com/plotly/react-pivottable.

I would like to add a spider chart, always from the chart library plotly, but I can’t understand where to start as the documentation is a litle poor and the GitHub repo is quite silence…

Maybe it’s not even possible.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Does anyone know if it’s possible?

>Solution :

Yes, it is possible to add new types of charts to the React Pivottable library, including a radar chart. The React Pivottable library is built on top of the Pivottable library, which is a powerful data-aggregation tool that can generate a variety of different charts and visualizations. It uses the Plotly library to render the charts, so you can use any of the chart types supported by Plotly in React Pivottable, including the radar chart.

To add a new chart type, such as a radar chart, to React Pivottable, you can use the addRenderer method of the pivottable object. This method takes two arguments: the name of the new chart type, and a function that generates the chart using the Plotly library.

Here’s an example of how you could use the addRenderer method to add a radar chart to React Pivottable:

import { pivottable } from 'react-pivottable';
import Plotly from 'plotly.js-basic-dist';

// Define a function that generates a radar chart using the
// data and configuration provided by the Pivottable library
const radarChartRenderer = (pivotData, opts) => {
  // Use the Plotly library to generate the chart
  const chartData = [{
    type: 'scatterpolar',
    r: pivotData.map(d => d.value),
    theta: pivotData
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading