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 »

 

SQLite Editor for PHP
The SQLite Editor for PHP software is a tool which will help you and/or your users administer and maintain your SQLite databases. Built as a tool that you can easily provide to your users, there's no danger of them damaging your database.

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.


23rd June, Richard
The SQLite Editor for PHP admin tool is now available for you to download

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

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 »

How to use CSS3 transitions

desc

By using CSS transitions you can make smooth CSS animations and effects for your canvas tag. The effect shown below switches between two charts using a CSS transition and also changing the CSS width and height (the HTML width and height attributes which set the width and height of the canvas remain unchanged). The code changes the CSS width and height settings at the correct times and the CSS transition does the rest. The CSS transition is defined on the canvas tag (in CSS like this:

<style>
    canvas {
        transition: width .5s, height .5s, top .5s, left .5s;
    }
</style>
<script>
    window.onload = (function ()
    {
        //
        // Used to track which chart is currently being displayed
        //
        var type = true;

        //
        // This function is called to draw the bar chart
        //
        function drawBar ()
        {
            var bar = new RGraph.Bar({
                id: 'cvs',
                data: [5,8,16,5,8,9,4,3,2,4,3,2],
                options: {
                    xaxisLabels: ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],
                    textSize: 14
                }
            }).draw();
        
            type = false;
        }




        //
        // This function is called to draw the line chart
        //
        function drawLine ()
        {
            var line = new RGraph.Line({
                id: 'cvs',
                data: [5,8,16,5,8,9,4,3,2,4,3,2],
                options: {
                    xaxisLabels: ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],
                    textSize: 14
                }
            }).draw();
                
            type = true;
        }



        //
        // This is the onclick event for the button
        //
        document.getElementById('myButton').onclick = function (e)
        {
            var canvas   = document.getElementById('cvs');

            //
            // This CSS change results in the <canvas> shrinking (due to the CSS transition)
            //
            canvas.style.width  = 0;
            canvas.style.height = 0;
            canvas.style.top    = '100px'
            canvas.style.left   = '300px';
            
            //
            // Now that the <canvas> has been shrunk - wait 0.75 seconds, draw the alternate
            // chart and unshrink it.
            //
            setTimeout(function ()
            {
                RGraph.reset(canvas);
                canvas.__rgraph_aa_translated__ = false;
                
                if (!type) {
                    drawBar();
                } else {
                    drawLine();
                }


                //
                // This CSS change results in the canvas expanding (due to the CSS transition)
                //
                canvas.style.width    = '600px';
                canvas.style.height   = '250px';
                canvas.style.position = 'relative';
                canvas.style.left     = 0;
                canvas.style.top      = 0;
                
            }, 750)
            
        }
        
        drawBar();
    });
</script>