MENU
.net Powerful JavaScript charts

Tooltips with a single value in the dataset aren't working


Posted by steve at 08:49 on Tuesday 22nd October 2024 [link]
Hi, I'd like to modify the tooltip on the pie chart


When you set up a single data, all mouse events, including tooltips, will not work.

Tooltips and mouse events are working well when there are multiple data.

Is there a way to fix it?

Thank you always.




Posted by Richard at 13:13 on Tuesday 22nd October 2024 [link]
I've come up with a work around - which I'll add in to the Pie chart library to make it transparent to the user (ie it works as expected!).

It just involves adding a really small value to you dataset - so small that the resulting segment is not interactive or even visible to the user.

Here's some code:

<script>
    val = 4;
    val2 = val / 1000000;

    new RGraph.Pie({
        id: 'cvs',
        data: [val,val2],
        options: {
            tooltips: 'A tooltip!: %{index}',
            tooltipsCss: {
                fontSize: '20pt'
            
        
    }).draw();
</script>

Posted by steve at 08:58 on Wednesday 23rd October 2024 [link]
As a result, there is no way to make tooltips work when it's a single data, unless it's a really small way to add a really small value?

Would you like to work on additional patches for the library?

Posted by Richard at 09:46 on Wednesday 23rd October 2024 [link]
Yes, I'm going to alter the Pie chart library so that it's seamless and you can use a single value the way you'd expect. All being well, this will be part of version 6.20.

Posted by Richard at 20:26 on Saturday 26th October 2024 [link]
OK I've added the patch to the Pie chart library and you can try it out by getting the updated Pie chart library from Github here:

https://raw.githubusercontent.com/heyesr/rgraph/refs/heads/main/libraries/RGraph.pie.js

Let me know how you get on with it.

[Replies are closed]