2017-08-06 12 views
1

コンテンツで凡例コンポーネントをレンダリングしようとしたときに、このエラーが発生しました。PieChartのレンダリング時に不明な小道具の警告

warning.js:36警告:不明小道具verticalAlignlayoutaligniconTypeiconSize、​​、chartWidthchartHeight、タグにmarginonBBoxUpdate

これは、それは未知の小道具は、私はこれらの親が子コンポーネントで小道具削除する方法warning.Thereforeなる理由です取得する複数のコンテンツの凡例コード、

const renderContent = (content, props) => { 
    if (React.isValidElement(content)) { 
    return React.cloneElement(content, props); 
    } else if (_.isFunction(content)) { 
    return content(props); 
    } 

    return React.createElement(DefaultLegendContent, props); 
}; 

です。

//Legend tag 
    <Legend verticalAlign="middle" layout="vertical" align="right" iconType="circle" content={this._LegendWithValues()} 

//Custom legend content 
_LegendWithValues =() => { 
     return (
      <ul className="cui-legend-content"> 
       { 
        this.props.data.map((entry, index) => (
         <li key={`item-${index}` }> 
          <svg height="20" width="20"> 
           <circle cx="10" cy="10" r="5" strokeWidth="3" fill={this._getColorScheme()[index]}/> 
          </svg> 
          <text style={ul_style} >{entry.name}:{entry.unit} {entry.value}</text> 
         </li> 
        )) 
       } 
      </ul> 
     ); 

    } 

答えて

関連する問題