MENU
.net Powerful JavaScript charts
About
RGraph is a JavaScript charts library based on HTML5 SVG and canvas. RGraph is mature (over 17 years old) and has a wealth of features making it an ideal choice to use for showing charts on your website.

More »

 

New datagrid in v6.21
In version 6.21 a new datagrid object has been added. This makes it easy to add static or dynamic data tables to your pages. It can be used whether you use the canvas or SVG libraries or entirely standalone.

Read more »

 

Download
Get the latest version of RGraph (version 6.21, 10th April 2025) from the download page. You can read the changelog here. There's also older versions available, minified files and links to cdnjs.com hosted libraries.

Download »

 

License
RGraph can be used for free under the GPL or if that doesn't suit your situation there's an inexpensive (£129) commercial license available.

More »

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]