Skip to content

RadialBar chart not updating when using formatter #688

Open
@furgerf

Description

@furgerf

Hi, I have a radialBar chart where I used the barLabels.formatter to show the bar value, However, when the data changes, the chart doesn't update. I tried a few things and noticed that the same happens when specifying e.g. dataLabels.value.formatter.

This is with apexcharts 4.7.0 / react-apexcharts 1.7.0 in a nextjs project and I'm pretty sure this used to work before the last update (which would've been with 3.49.2/1.4.1).

Here's an example to reproduce - removing the formatter function makes it update when value changes:

import { ApexOptions } from "apexcharts";
import dynamic from "next/dynamic";
import { FC } from "react";

const ReactApexChart = dynamic(() => import("react-apexcharts"), {
  ssr: false,
});

interface Props {
  value: number;
}

const RadialChart: FC<Props> = ({ value }) => {
  const chartOptions: ApexOptions = {
    chart: {
      type: "radialBar",
    },
    plotOptions: {
      radialBar: {
        dataLabels: {
          value: {
            formatter: (value) => value.toString(),
          },
        },
      },
    },
  };

  return (
    <ReactApexChart
      type="radialBar"
      series={[value]}
      options={chartOptions}
    />
  );
};

export default RadialChart;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions