2

I am working with a library that makes chartjs usable on react-native:

react-native-chartjs.

The chart works well, but when I press on the pie slices I only get the tooltip. What I would like to, is to create my own function that will load a pop-up window instead of the tooltip provided by chart.js How would you guys do it? Is it even doable? (I am pretty new to react-native, so sorry if it's a stupid question).

Image of the: Chart

Chart code:

export const NutritionChart = (props) => {
return (
<Chart
  chartConfiguration={
  {
    type: 'polarArea',
    data: {
      labels: ['Fiber', 'Protein', 'Healthy Oil', 'Good Energy']‚
      datasets: [
        {
          label: '# of Votes',
          data: [ 50, 140, 90, 120 ],
          backgroundColor: backgroundColor,
          borderColor: borderColor,
          borderWidth: datasets.border,
          hoverBackgroundColor: hoverBackgroundColor,
        },
      ],
    },
    options: {
      layout: {
       padding: {
           top: options.layout.padding.top,
           bottom: options.layout.padding.bottom,
           }
       },
      scale: {
        display: false,
        ticks: {
          min:0,
          max:200,
        }
      },
      responsive: true,
      maintainAspectRatio: false,
    },
  }
  }
  defaultFontSize={10}
  />
 );
};
Gab
  • 37
  • 5

0 Answers0