react-d3 / react-d3-tooltip

react-d3 tooltip implementation
http://www.reactd3.org/docs/tooltip/
23 stars 22 forks source link

showLegend = {false} does not hide legend #14

Open gordonwoon opened 8 years ago

gordonwoon commented 8 years ago

I am trying to hide the legend as my data is pretty huge and it occupies half of the container. Are there any other ways to disable it?

  <PieTooltip
    data= {this.state.data}
    width= {width}
    height= {height}
    chartSeries= {chartSeries}
    showLegend = {false}
    margins= {margins}
    value = {value}
    name = {name}
  />
freethejazz commented 8 years ago

@gordonwoon This is currently working for me. Must have gotten fixed in the last few months?

lizmallalieu commented 8 years ago

@gordonwoon I am running into the same problem (with react-d3-basic v. 1.6.11 and react-d3-tooltip v. 1.4.14). Did you ever find a solution?

gordonwoon commented 8 years ago

@lizmallalieu nope, didn't work worked with regards to this library. i switched over to creating a pure d3js file and merge it with react components manually. D3js can handle animations much better than react-d3

samuelhalim commented 8 years ago

@freethejazz Did you try that for react-d3-tooltip? I checked the commonProps.js and there's no showLegend property over there.

aureustaurus commented 8 years ago

Hi. I have the same problem. Legend create every time and doesn't look at option legendShow. During create legend no one condition, just: _react2.default.createElement(_reactD3Core.Legend, this.props)

Maybe insert something like this (example for BarGroupTooltip): ` _createClass(BarGroupTooltip, [{ key: 'render', value: function render() { var _props = this.props; var width = _props.width; var height = _props.height;

  var showLegend = _props.showLegend;
  var legend = null;
  if (showLegend) {
    legend = _react2.default.createElement(_reactD3Core.Legend, this.props);
  }

  return _react2.default.createElement(
    'div',
    null,
    _react2.default.createElement(
      _tooltip2.default,
      _extends({}, this.props, this.state),
      this.props.children
    ),
    legend,
    _react2.default.createElement(
      _reactD3Shape.Chart,
      _extends({}, this.props, this.state),
      _react2.default.createElement(_barGroup2.default, _extends({}, this.props, this.state, {
        onMouseOver: this.mouseOver.bind(this),
        onMouseOut: this.mouseOut.bind(this)
      }))
    )
  );}}]);`

I apply it and it's working for me. Can you commit something like it?

freethejazz commented 8 years ago

@samuel-halim95 You're absolutely right. Not sure how I mixed up repositories when posting this comment. I'm going to edit my original comment so people don't get thrown off.