Skip to content
This repository has been archived by the owner on Sep 17, 2021. It is now read-only.

I want that column and column between each other in my BarChart has scattered points or gaps. #56

Closed
Altraman opened this issue Jan 25, 2017 · 2 comments

Comments

@Altraman
Copy link

This is my bar chart:
qq20170125-113956
But I want to......:
qq20170125-113937

@marzolfb
Copy link
Contributor

The gutter configuration option is what you want to be adjusting. In the example app, you can see it set to a value of 20 for the basic bar chart:

let options = {
      width: 300,
      height: 300,
      margin: {
        top: 20,
        left: 25,
        bottom: 50,
        right: 20
      },
      color: '#2980B9',
      gutter: 20,

Also, the structure of the data object is maybe not so obvious. If you have a structure like the example app:

let data = [
      [{
        "v": 49,
        "name": "apple"
      }, {
        "v": 42,
        "name": "apple"
      }],
      [{
        "v": 69,
        "name": "banana"
      }, {
        "v": 62,
        "name": "banana"
      }],
      [{
        "v": 29,
        "name": "grape"
      }, {
        "v": 15,
        "name": "grape"
      }]
    ]

, you will see something like this:

image

and in that case, gutter represents the space between the 2 sets of 3 bars.

Now, if you have a more simple structure like this:

let data = [
      [{
        "v": 49,
        "name": "apple"
      }, {
        "v": 42,
        "name": "banana"
      }]
    ]

you will see this:

image

and gutter represents the space between the 2 items in the inner array.

Now if you instead have single-item arrays inside the main data array like this

let data = [
      [{
        "v": 49,
        "name": "apple"
      }], [{
        "v": 42,
        "name": "banana"
      }]
    ]

, you will see that the gutter option is ignored:

image

So, to make a long story short, spacing between bars is dictated by both the gutter configuration option AND the way you structure your data.

@Altraman
Copy link
Author

Thank you! @marzolfb

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants