yang-wei / rd3

react + d3
https://yang-wei.github.io/rd3/
MIT License
319 stars 83 forks source link

Grouped bar charts fixes #40 #68

Closed brookiel closed 8 years ago

yang-wei commented 8 years ago

everything looks good to me =) will merge this and release it during the weekend

yang-wei commented 8 years ago

image

Things look good !

thetechnocrat-dev commented 8 years ago

Do you have an example of how to use the grouped prop? I've been trying to figure it out using the below JSfiddle from your docs, but to no avail.

https://jsfiddle.net/YangWei/8t16sp9g/?utm_source=website&utm_medium=embed&utm_campaign=8t16sp9g

yang-wei commented 8 years ago

cc @Brendtron5000

yang-wei commented 8 years ago

can you show me your code ?

thetechnocrat-dev commented 8 years ago

thanks for the quick response! I was just trying to get the JS fiddle to work first before trying in my own code base.

So Just

var BarChart = rd3.BarChart
var barData = [
  {
    "name": "Series A",
    "values": [
      { "x": 1, "y":  91},
      { "x": 2, "y": 290},
      { "x": 3, "y": -25},
    ]
  },
  {  
    "name": "Series B",
    "values": [
      { "x": 1, "y":  9},
      { "x": 2, "y": 49},
      { "x": 3, "y": -20},
    ]
  },
  {  
    "name": "Series C",
    "values": [
      { "x": 1, "y":  14},
      { "x": 2, "y": 77},
      { "x": 3, "y": -70},
    ]
  }
];

var Chart = React.createClass({
  render: function() {
    return  (
        <BarChart
      grouped={true}
      data={barData}
      width={500}
      height={300}
      title="Bar Chart"
      xAxisLabel="Value"
      yAxisLabel="Label"
      hoverAnimation={false}
      />
  )}
});

ReactDOM.render(
  <Chart />,
  document.getElementById('container')
);
yang-wei commented 8 years ago

ahh.... I think is the version. jsfiddle is still using the 0.6.3 version while the grouped prop is supported in 0.7.0.

Will fix the fiddle asap =)

thetechnocrat-dev commented 8 years ago

Sweet that did the trick! (Also, was using 0.6.3 in my project so that would of taken me a while to debug if you hadn't pointed that out.)