apexcharts / react-apexcharts

📊 React Component for ApexCharts
https://apexcharts.com
MIT License
1.31k stars 159 forks source link

Annotations not showing on RadialBar #584

Open NachoSanchez opened 8 months ago

NachoSanchez commented 8 months ago

Hello i'm trying to show a small annotation on a dinamic percentage of the radialBar/gauge chart. It does not show up. I allready checked the docs back and forth this is my code so far.

const Clicks: React.FC = ({ statsResume, stats }) => { const chartOptions = useChartOptions(statsResume);

return (

            <Chart
                height={220}
                series={[
                    60
                ]}
                type="radialBar"
                options={chartOptions}
            />

);

}

export default Clicks;

function useChartOptions(): ApexOptions {

const targetPercentage = 50; // Porcentaje en el que se mostrará el puntero

return {
    chart: {
        background: 'transparent'
    },

    colors: [
        "blue"
    ],

    dataLabels: {
        enabled: false,
    },

    labels: ["Clicks"],

    legend: { show: false },

    plotOptions: {
        radialBar: {
            startAngle: -105,
            endAngle: 105,
            hollow: {
                margin: 16,
                size: "70%"
            },
            dataLabels: {
                name: {
                    show: false,
                },
                value: {
                    show: false
                }
            }
        }
    },

    stroke: {
        lineCap: "round",
    },

    tooltip: {
        fillSeriesColor: false
    },

    annotations: {
        points: [
            {
                x: targetPercentage, 
                y: targetPercentage,
                seriesIndex: 0,
                marker: {
                    size: 16,
                    fillColor: '#333',
                    strokeColor: '#333',
                    radius: 8,
                    shape: "square",
                    offsetX: 0,
                    offsetY: 0,
                }
            } 
        ]
    }
};

}

and this is the result image

github-actions[bot] commented 3 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.