recharts#RadialBarChart TypeScript Examples

The following examples show how to use recharts#RadialBarChart. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ChartDetailsRadialBar.tsx    From kubenav with MIT License 6 votes vote down vote up
ChartDetailsRadialBar: React.FunctionComponent<IChartDetailsRadialBarProps> = ({
  title,
  data,
  unit,
}: IChartDetailsRadialBarProps) => {
  return (
    <IonCardEqualHeight>
      <IonCardHeader>
        <IonCardTitle>{title}</IonCardTitle>
      </IonCardHeader>
      <IonCardContent>
        <div style={{ height: '250px', width: '100%' }}>
          <ResponsiveContainer>
            <RadialBarChart innerRadius="25%" barSize={10} data={data} startAngle={90} endAngle={-270}>
              <RadialBar background={true} dataKey="value" />
            </RadialBarChart>
          </ResponsiveContainer>
        </div>
        {data && data.length > 0
          ? data.map((metric, index) => (
              <IonRow key={index}>
                <IonCol size="auto">
                  <span style={{ backgroundColor: metric.fill }}>&nbsp;&nbsp;&nbsp;&nbsp;</span>
                </IonCol>
                <IonCol size="auto">
                  <b>{metric.name}:</b>
                </IonCol>
                <IonCol>
                  {metric.value}
                  {unit}
                </IonCol>
              </IonRow>
            ))
          : null}
      </IonCardContent>
    </IonCardEqualHeight>
  );
}