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

Single Item Bar Chart with Spacing #96

Closed
mosesmc52 opened this issue Feb 26, 2017 · 2 comments
Closed

Single Item Bar Chart with Spacing #96

mosesmc52 opened this issue Feb 26, 2017 · 2 comments

Comments

@mosesmc52
Copy link

Hi,

I got the bar chart to work. Instead of using multiple categories, I'm using a single item. The chart doesn't display, spacing between the bars. Is there a configuration parameter that I can use to insert spacing between the bars in the chart? Below is my modified code.

let data = [
  [{
    "v": 49,
    "name": "1"
  }],
  [{
    "v": 69,
    "name": "2"
  }],
  [{
    "v": 29,
    "name": "3"
  }],
  [{
    "v": 40,
    "name": "4"
  }]
]

let options = {
  width: 300,
  height: 200,
  margin: {
    top: 20,
    left: 25,
    bottom: 50,
    right: 20
  },
  color: '#3cb3e2',
  gutter: 20,
  animate: {
    type: 'oneByOne',
    duration: 200,
    fillTransition: 3
  },
  axisX: {
    showAxis: false,
    showLines: true,
    showLabels: true,
    showTicks: false,
    zeroAxis: false,
    orient: 'bottom',
    label: {
      fontFamily: 'Arial',
      fontSize: 8,
      fontWeight: false,
      fill: '#34495E'
    }
  },
  axisY: {
    showAxis: false,
    showLines: false,
    showLabels: true,
    showTicks: false,
    zeroAxis: false,
    orient: 'left',
    label: {
      fontFamily: 'Arial',
      fontSize: 8,
      fontWeight: false,
      fill: '#34495E'
    }
  }
}
@marzolfb
Copy link
Contributor

Your data variable should switch from an array of arrays to an array of objects like this:

let data = [
  [{
    "v": 49,
    "name": "1"
  },
  {
    "v": 69,
    "name": "2"
  },
  {
    "v": 29,
    "name": "3"
  },
  {
    "v": 40,
    "name": "4"
  }]
]

This should fix it, so I'm closing this but if it doesn't feel free to reopen.

@mosesmc52
Copy link
Author

It worked.

Thanks

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