2

我正在使用一个使 chartjs 在 react-native 上可用的库:

react-native-chartjs。

该图表运行良好,但当我按下饼图时,我只得到工具提示。我想要的是创建我自己的函数来加载一个弹出窗口而不是chart.js提供的工具提示你们会怎么做?它甚至可行吗?(我对 react-native 很陌生,如果这是一个愚蠢的问题,我很抱歉)。

图片: 图表

图表代码:

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}
  />
 );
};
4

0 回答 0