Search code examples
javascriptrgraph

rgraph problems with labelsAbove not appearing in second graph creation


I create a Hbar with labelsAbove in a canvas object. Then i remove the canvas object (in fact the parrent object changes innerHTML deleting the canvas). When i create a new canvas and a ne Hbar, all works well except the labelsAbove. They never appeard altought i am giving the same options.

var bar = new RGraph.HBar({
            id: "cvs",
            data: [2,3,8],
            options: {
                labels: ["a","b","c"],
                hmargin: 25,
                labelsAbove: true,
                hmarginGrouped: 3,
                backgroundGridAutofitNumvlines: 5,
                shadowOffsetx: 2,
                shadowOffsety: 2,
                textSize: 16,
                shadowBlur: 2,
                textAccessible: true
            }
        }).grow();

Anyone can help me? Thank you.


Solution

  • Ensure that the second canvas tag - that you add by setting innerHTML - has a different id.