Advertisements
Home > ASP.NET > How to Add space and increase width of Morris.Js Bar?

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

Morris.Bar({
barGap:4,
barSizeRatio:0.55,
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!

Advertisements
Categories: ASP.NET Tags: , , ,
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: