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

More »

 

Version 7.20
Version 7.20 (released in June 2026) is the latest version of RGraph and the major change in this version is an update to the default values of properties making for better looking charts without having to set any properties. Read more about this and other changes in the changelog.

Download »

 

Download
Get the latest version of RGraph (version 7.20, 9th June 2026) 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 »

 

Latest forum posts
These are the latest support forum posts that have been posted or updated.


16th June, Rachel
I have a question about the 3D Bar chart
12th June, Marco
Should I use SVG or canvas for the charts on my website?
9th June, Richard
New version of RGraph: version 7.20
3rd June, Patrick
Question about installing RGraph
1st June, Ouja
How do I add a click event to a bar in my Bar chart?


Support forum »

 

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 »

Issue with the Pie chart and it's labels


Posted by Vishal shukla at 16:06 on Wednesday 16th June 2021 [link]
Sir actually I am making a pai chart it's labels actually outside I wants it inside the pai chart so how I can done this please let me know as soon as possible you can see the my code just given below.
function ProductModel() {

        RGraph.AJAX.getJSON({
            url: '/Home/ProductModelForGraph' , callback: function (json) {
                var Ids1 = [];
                var IDs = [];
                var IDs2 = [];
                $(json.getData).each(function (index, value1) {
                    IDs.push(this.BomId);
                    IDs2.push(this.ModelName);
                    Ids1.push([this.ModelName, this.BomId ]);
                    
                });
                alert(Ids1);
            
                var colors = ['#45B39D', '#9bccf2', '#034f84', '#8044C1', '#2999CD', '#C8C02A', '#36C461', '#36C49F'];
            
                var key = RGraph.HTML.Key('container',
                    {
                        colors: colors,
                        labels: Ids1,

                        tableCss: {
                            position: 'absolute',
                            top: '50%',
                            right: '-575px',
                            transform: 'translateY(-50%)',
                            colors: colors
                        }
                    });
            
                new RGraph.Pie({
                    id: 'ProductModelGraph',
                    data: IDs,
                    options: {
                        vv: IDs2,
                        marginLeft: 20,
                        title: 'Product Model Wise Costing Count',
                        titleSize: 20,
                        labelsColor: '#0095cd',
                        titleBold: true,
                        marginRight: 50,
                        linewidth: 0,
                        colorsStroke: 'rgba(0,0,0,0)',
                        
                        colors: colors,
                        variant: 'donut3d',
                    
                        radius: 100,
                        radius: 80,
                        shadowOffsety: 4,
                        shadowOffsetx: 5,
                        shadowColor: '#aaa',
                        exploded: [5, 5, 5],
                        titleColor: '#0095cd',
                        textSize: 20,
                        tooltips: '<span style="font-size: 14pt;">%{property:vv[%{index}]}: %{value}</span>',
                        tooltipsFormattedKeyColors: ['#aaf', 'green'],
                        tooltipsPointer: false,
                        tooltipsPositionStatic: false,
                    
                        tooltipsEvent: 'mousemove',
                        tooltipsCss: {
                            fontFamily: 'Verdana',
                            fontSize: '20pt',
                            color: 'white',
                            border: 'groove',
                            //backgroundColor: '#0095cd',
                        },

                    }
                }).roundRobin();
                RGraph.tooltips.style.backgroundColor = '%{property:colors[%{index}]}';




            }
        });


    }

Posted by Richard at 18:08 on Wednesday 16th June 2021 [link]
Since you're using a 3D Pie/Donut chart maybe this would suit you:

https://codepen.io/rgraph/pen/yLMZMEN/left

If not then maybe setting the labels to be native canvas text with the textAccessible option (set it to false) and the labelsIngraph* options may be useful.

[Replies are closed]