Posts Tagged ‘Morris’

How to Add space and increase width of Morris.Js Bar?

There are two properties of Morris.Js bar we can use to achieve this
1) barGap
2) barSizeRatio

barGap is an integer that sets the space between bars in a single bar group.
Default is 3.
Increase this value to space them further, decrease it to bring them closer.

barSizeRatio is the proportion of the width of the entire graph given to bars. Defaults to 0.75.
Increase the number closer to 1 to make the bars wider, if its =1 the bars will take up the entire graph, if its > 1 bars will overlap.

Here is an example of code

element: ‘bar-chart’,
data: [
{ y: ‘Apr’, a: 75, b: 60, c: 5, d: 50 },
{ y: ‘May’, a: 180, b: 220, c: 140, d: 160 },
{ y: ‘June’, a: 420, b: 340, c: 350, d: 270 }
xkey: ‘y’,
ykeys: [‘a’, ‘b’, ‘c’, ‘d’],
labels: [‘A’, ‘B’, ‘C’, ‘D’],
barColors: [‘#0B62A4′,’#f75b68′,’#4DA74D’,’#646464′],
hideHover: ‘auto’

Hope it helps!

Categories: ASP.NET Tags: , , ,