How to get thin bars

Share RGraph:   

Summary
A guide to get thin bar chart bars. This is done by altering the hmargin setting - increasing it gives thinner bars and vice-versa

[No canvas support]

It's quite easy to get thin bars in your Bar chart by using the hmargin property. This property doesn't directly specify the width of the bar, but specifies the amount of space each side of the bar. If you set it to 0 to start with and gradually increase it you can more easily see the effect that it has.

This also applies to the Horizontal Bar chart and the vmargin property.

Warning: If you set this property too high it can make the width of the bars negative. The Bars may appear to be OK but dynamic features such as tooltips will cease to work.

<script>
    window.onload = (function ()
    {
        var bar = new RGraph.Bar({
            id: 'cvs',
            data: [4,8,5,6,3,5,8],
            options: {
                hmargin: 5,
                textAccessible: true,
                textSize: 14,
                labels: ['Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday']
            }
        }).draw();
    }
<script>

Comments

Add a new comment...