Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Annotations not showing on RadialBar #584

Open
NachoSanchez opened this issue Mar 21, 2024 · 0 comments
Open

Annotations not showing on RadialBar #584

NachoSanchez opened this issue Mar 21, 2024 · 0 comments

Comments

@NachoSanchez
Copy link

NachoSanchez commented Mar 21, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant