How can I reduce the margins on the canvas in a Pie chart?

Share RGraph:  

« Back to message list

Enter your email address to get email updates on this topic. You can stop receiving updates by clicking the link in the update email messages.

Posted by dev on 22nd August 2017
Hi, I am using Rgraph for drawing pie chart. The chart is made successfully, but i have to reduce the margins that canvas is taking in left-right-up-down. When we reduce canvas size, it causes pie chart diagram making it small. Kindly help. Thanks in advance.!!
Posted by Richard on 22nd August 2017
Hi there,

You can use the gutters - and reduce the all to (eg) 5. Keep in mind though that as the Pie is circular the Pie will be sized to fit the smallest side - be it the horizontal side on the vertical side. Which ever is smallest.

If you canvas is a square (eg 300x300) then this won't concern you.

var pie = new RGraph.Pie({
     id: 'cvs',
     data: [4,8,6,3,5,4],
     options: {
         // You may need this if you still have labels
         // textAccessible: false,
         gutterLeft: 5,
         gutterRight: 5,
         gutterTop: 5,
         gutterBottom: 5
     }
}).draw();

Remember though that if you do this you won't have room for any labels - or if you don't disable the textAccessible option you may get text overlapping any text that's around the Pie.






Richard
Posted by dev on 22nd August 2017
thanks richard...it worked very well..!! I also wanted to know, how to reduce the length of label sticks pointing the portion in the graph..thnx
Posted by Richard on 22nd August 2017
Hi there,

You could try the labelsSticksLength property - though I can't remember if this is exactly what you need.






Richard
Posted by dev on 22nd August 2017
thnx for reply, but labelsSticksLength: 5 is not working...
Posted by Richard on 22nd August 2017
Hi there,

This is a canvas based Pie chart BTW.


www.rgraph.net/fiddle/view.html/pie-chart-sticks-length






Richard

Add a reply




« Back to message list