{"action":"created","comment":{"url":"https://api.github.com/repos/FormidableLabs/victory-chart/pulls/comments/43447517","id":43447517,"diff_hunk":"@@ -881,157 +583,89 @@ export default class VictoryChart extends React.Component {\n     }\n   }\n \n-  drawLine(dataset) {\n-    const animate = this.props.animate && (this.props.animate.line || this.props.animate);\n-    const {type, name, ...attrs} = dataset.attrs;\n-    const lineStyle = {data: _.merge({}, this.style.line.data, attrs)};\n-    const style = _.merge({}, {parent: this.style.parent}, this.style.line, lineStyle);\n-    return (\n-      <VictoryLine\n-        {...this.props}\n-        animate={animate}\n-        standalone={false}\n-        data={dataset.data}\n-        label={attrs.label}\n-        interpolation={attrs.interpolation || this.props.interpolation}\n-        style={style}\n-        domain={this.domain}\n-        range={this.range}\n-        ref={name}\n-        key={\"line-\" + dataset.index}/>\n-    );\n-  }\n-\n-  drawScatter(dataset) {\n-    const animate = this.props.animate && (this.props.animate.scatter || this.props.animate);\n-    const {type, name, symbol, size, ...attrs} = dataset.attrs;\n-    const scatterStyle = {data: _.merge({}, this.style.scatter.data, attrs)};\n-    const style = _.merge({}, {parent: this.style.parent}, this.style.scatter, scatterStyle);\n-    return (\n-      <VictoryScatter\n-        {...this.props}\n-        animate={animate}\n-        standalone={false}\n-        data={dataset.data}\n-        size={size || 3}\n-        symbol={symbol || \"circle\"}\n-        style={style}\n-        domain={this.domain}\n-        range={this.range}\n-        ref={name}\n-        key={\"scatter-\" + dataset.index}/>\n-    );\n-  }\n-\n-  drawBars(datasets, options) {\n-    const animate = this.props.animate && (this.props.animate.bar || this.props.animate);\n-    const categories = (this.stringMap.x) && _.keys(this.stringMap.x);\n-    return (\n-      <VictoryBar\n-        {...this.props}\n-        animate={animate}\n-        standalone={false}\n-        data={_.pluck(datasets, \"data\")}\n-        dataAttributes={_.pluck(datasets, \"attrs\")}\n-        stacked={(options && !!options.stacked) ? options.stacked : false}\n-        style={_.merge({}, {parent: this.style.parent}, this.style.bar)}\n-        domain={this.domain}\n-        range={this.range}\n-        categories={this.props.categories || categories}\n-        categoryLabels={this.props.categoryLabels}\n-        key={\"bar\"}/>\n-    );\n-  }\n-\n-  drawStackedBars(datasets) {\n-    return this.drawBars(datasets, {stacked: true});\n+  generateData(child) {\n+    if (!child.props.y) {\n+      return undefined;\n+    }\n+    const generateX = (component) => {\n+      const domain = this.domain.x;\n+      const samples = _.isArray(component.props.y) ? component.props.y.length : 50;\n+      const step = _.max(domain) / samples;\n+      // return an array of x values spaced across the domain,\n+      // include the maximum of the domain\n+      return _.union(_.range(_.min(domain), _.max(domain), step), [_.max(domain)]);\n+    };\n+    const y = child.props.y;\n+    const xArray = child.props.x || generateX(child);\n+    if (_.isFunction(y)) {\n+      return _.map(xArray, (x) => {\n+        return {x, y: y(x)};\n+      });\n+    } else {\n+      const n = _.min([xArray.length, y.length]);\n+      return _.map(_.take(xArray, n), (x, index) => {\n+        return { x, y: y[index]};\n+      });\n+    }","path":"src/components/victory-chart.jsx","position":1269,"original_position":1269,"commit_id":"713ef6b2f17ff7601f71bb099a16cc43f6120a30","original_commit_id":"713ef6b2f17ff7601f71bb099a16cc43f6120a30","user":{"login":"exogen","id":53522,"avatar_url":"https://avatars.githubusercontent.com/u/53522?v=3","gravatar_id":"","url":"https://api.github.com/users/exogen","html_url":"https://github.com/exogen","followers_url":"https://api.github.com/users/exogen/followers","following_url":"https://api.github.com/users/exogen/following{/other_user}","gists_url":"https://api.github.com/users/exogen/gists{/gist_id}","starred_url":"https://api.github.com/users/exogen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/exogen/subscriptions","organizations_url":"https://api.github.com/users/exogen/orgs","repos_url":"https://api.github.com/users/exogen/repos","events_url":"https://api.github.com/users/exogen/events{/privacy}","received_events_url":"https://api.github.com/users/exogen/received_events","type":"User","site_admin":false},"body":"I find all these small functions and nested lodash calls hard to follow. Can we break some of these out into `util.js` so this functionality has a name and clear parameters?","created_at":"2015-10-29T21:34:54Z","updated_at":"2015-10-29T21:34:54Z","html_url":"https://github.com/FormidableLabs/victory-chart/pull/32#discussion_r43447517","pull_request_url":"https://api.github.com/repos/FormidableLabs/victory-chart/pulls/32","_links":{"self":{"href":"https://api.github.com/repos/FormidableLabs/victory-chart/pulls/comments/43447517"},"html":{"href":"https://github.com/FormidableLabs/victory-chart/pull/32#discussion_r43447517"},"pull_request":{"href":"https://api.github.com/repos/FormidableLabs/victory-chart/pulls/32"}}},"pull_request":{"url":"https://api.github.com/repos/FormidableLabs/victory-chart/pulls/32","id":49188799,"html_url":"https://github.com/FormidableLabs/victory-chart/pull/32","diff_url":"https://github.com/FormidableLabs/victory-chart/pull/32.diff","patch_url":"https://github.com/FormidableLabs/victory-chart/pull/32.patch","issue_url":"https://api.github.com/repos/FormidableLabs/victory-chart/issues/32","number":32,"state":"open","locked":false,"title":"Big refactor","user":{"login":"boygirl","id":3719995,"avatar_url":"https://avatars.githubusercontent.com/u/3719995?v=3","gravatar_id":"","url":"https://api.github.com/users/boygirl","html_url":"https://github.com/boygirl","followers_url":"https://api.github.com/users/boygirl/followers","following_url":"https://api.github.com/users/boygirl/following{/other_user}","gists_url":"https://api.github.com/users/boygirl/gists{/gist_id}","starred_url":"https://api.github.com/users/boygirl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/boygirl/subscriptions","organizations_url":"https://api.github.com/users/boygirl/orgs","repos_url":"https://api.github.com/users/boygirl/repos","events_url":"https://api.github.com/users/boygirl/events{/privacy}","received_events_url":"https://api.github.com/users/boygirl/received_events","type":"User","site_admin":false},"body":"cc/ @exogen \r\n\r\nThis is finally clean and stable enough for a PR. I think this version is a lot more flexible, but that means it can also get broken more easily. There are probably a lot more places that need warnings. ","created_at":"2015-10-29T19:34:40Z","updated_at":"2015-10-29T21:34:54Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2c7403d502e91eac301497e7eed36dd1b47514ee","assignee":{"login":"exogen","id":53522,"avatar_url":"https://avatars.githubusercontent.com/u/53522?v=3","gravatar_id":"","url":"https://api.github.com/users/exogen","html_url":"https://github.com/exogen","followers_url":"https://api.github.com/users/exogen/followers","following_url":"https://api.github.com/users/exogen/following{/other_user}","gists_url":"https://api.github.com/users/exogen/gists{/gist_id}","starred_url":"https://api.github.com/users/exogen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/exogen/subscriptions","organizations_url":"https://api.github.com/users/exogen/orgs","repos_url":"https://api.github.com/users/exogen/repos","events_url":"https://api.github.com/users/exogen/events{/privacy}","received_events_url":"https://api.github.com/users/exogen/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/FormidableLabs/victory-chart/pulls/32/commits","review_comments_url":"https://api.github.com/repos/FormidableLabs/victory-chart/pulls/32/comments","review_comment_url":"https://api.github.com/repos/FormidableLabs/victory-chart/pulls/comments{/number}","comments_url":"https://api.github.com/repos/FormidableLabs/victory-chart/issues/32/comments","statuses_url":"https://api.github.com/repos/FormidableLabs/victory-chart/statuses/713ef6b2f17ff7601f71bb099a16cc43f6120a30","head":{"label":"FormidableLabs:bigRefactor","ref":"bigRefactor","sha":"713ef6b2f17ff7601f71bb099a16cc43f6120a30","user":{"login":"FormidableLabs","id":5078602,"avatar_url":"https://avatars.githubusercontent.com/u/5078602?v=3","gravatar_id":"","url":"https://api.github.com/users/FormidableLabs","html_url":"https://github.com/FormidableLabs","followers_url":"https://api.github.com/users/FormidableLabs/followers","following_url":"https://api.github.com/users/FormidableLabs/following{/other_user}","gists_url":"https://api.github.com/users/FormidableLabs/gists{/gist_id}","starred_url":"https://api.github.com/users/FormidableLabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/FormidableLabs/subscriptions","organizations_url":"https://api.github.com/users/FormidableLabs/orgs","repos_url":"https://api.github.com/users/FormidableLabs/repos","events_url":"https://api.github.com/users/FormidableLabs/events{/privacy}","received_events_url":"https://api.github.com/users/FormidableLabs/received_events","type":"Organization","site_admin":false},"repo":{"id":40037231,"name":"victory-chart","full_name":"FormidableLabs/victory-chart","owner":{"login":"FormidableLabs","id":5078602,"avatar_url":"https://avatars.githubusercontent.com/u/5078602?v=3","gravatar_id":"","url":"https://api.github.com/users/FormidableLabs","html_url":"https://github.com/FormidableLabs","followers_url":"https://api.github.com/users/FormidableLabs/followers","following_url":"https://api.github.com/users/FormidableLabs/following{/other_user}","gists_url":"https://api.github.com/users/FormidableLabs/gists{/gist_id}","starred_url":"https://api.github.com/users/FormidableLabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/FormidableLabs/subscriptions","organizations_url":"https://api.github.com/users/FormidableLabs/orgs","repos_url":"https://api.github.com/users/FormidableLabs/repos","events_url":"https://api.github.com/users/FormidableLabs/events{/privacy}","received_events_url":"https://api.github.com/users/FormidableLabs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/FormidableLabs/victory-chart","description":"Chart Component for Victory","fork":false,"url":"https://api.github.com/repos/FormidableLabs/victory-chart","forks_url":"https://api.github.com/repos/FormidableLabs/victory-chart/forks","keys_url":"https://api.github.com/repos/FormidableLabs/victory-chart/keys{/key_id}","collaborators_url":"https://api.github.com/repos/FormidableLabs/victory-chart/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/FormidableLabs/victory-chart/teams","hooks_url":"https://api.github.com/repos/FormidableLabs/victory-chart/hooks","issue_events_url":"https://api.github.com/repos/FormidableLabs/victory-chart/issues/events{/number}","events_url":"https://api.github.com/repos/FormidableLabs/victory-chart/events","assignees_url":"https://api.github.com/repos/FormidableLabs/victory-chart/assignees{/user}","branches_url":"https://api.github.com/repos/FormidableLabs/victory-chart/branches{/branch}","tags_url":"https://api.github.com/repos/FormidableLabs/victory-chart/tags","blobs_url":"https://api.github.com/repos/FormidableLabs/victory-chart/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/FormidableLabs/victory-chart/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/FormidableLabs/victory-chart/git/refs{/sha}","trees_url":"https://api.github.com/repos/FormidableLabs/victory-chart/git/trees{/sha}","statuses_url":"https://api.github.com/repos/FormidableLabs/victory-chart/statuses/{sha}","languages_url":"https://api.github.com/repos/FormidableLabs/victory-chart/languages","stargazers_url":"https://api.github.com/repos/FormidableLabs/victory-chart/stargazers","contributors_url":"https://api.github.com/repos/FormidableLabs/victory-chart/contributors","subscribers_url":"https://api.github.com/repos/FormidableLabs/victory-chart/subscribers","subscription_url":"https://api.github.com/repos/FormidableLabs/victory-chart/subscription","commits_url":"https://api.github.com/repos/FormidableLabs/victory-chart/commits{/sha}","git_commits_url":"https://api.github.com/repos/FormidableLabs/victory-chart/git/commits{/sha}","comments_url":"https://api.github.com/repos/FormidableLabs/victory-chart/comments{/number}","issue_comment_url":"https://api.github.com/repos/FormidableLabs/victory-chart/issues/comments{/number}","contents_url":"https://api.github.com/repos/FormidableLabs/victory-chart/contents/{+path}","compare_url":"https://api.github.com/repos/FormidableLabs/victory-chart/compare/{base}...{head}","merges_url":"https://api.github.com/repos/FormidableLabs/victory-chart/merges","archive_url":"https://api.github.com/repos/FormidableLabs/victory-chart/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/FormidableLabs/victory-chart/downloads","issues_url":"https://api.github.com/repos/FormidableLabs/victory-chart/issues{/number}","pulls_url":"https://api.github.com/repos/FormidableLabs/victory-chart/pulls{/number}","milestones_url":"https://api.github.com/repos/FormidableLabs/victory-chart/milestones{/number}","notifications_url":"https://api.github.com/repos/FormidableLabs/victory-chart/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/FormidableLabs/victory-chart/labels{/name}","releases_url":"https://api.github.com/repos/FormidableLabs/victory-chart/releases{/id}","created_at":"2015-08-01T06:05:36Z","updated_at":"2015-10-27T11:09:24Z","pushed_at":"2015-10-29T19:34:41Z","git_url":"git://github.com/FormidableLabs/victory-chart.git","ssh_url":"git@github.com:FormidableLabs/victory-chart.git","clone_url":"https://github.com/FormidableLabs/victory-chart.git","svn_url":"https://github.com/FormidableLabs/victory-chart","homepage":"","size":4908,"stargazers_count":3,"watchers_count":3,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":11,"forks":0,"open_issues":11,"watchers":3,"default_branch":"master"}},"base":{"label":"FormidableLabs:master","ref":"master","sha":"2d1db6e176a9aa2592da7baaa1b35fdc2cdc05ac","user":{"login":"FormidableLabs","id":5078602,"avatar_url":"https://avatars.githubusercontent.com/u/5078602?v=3","gravatar_id":"","url":"https://api.github.com/users/FormidableLabs","html_url":"https://github.com/FormidableLabs","followers_url":"https://api.github.com/users/FormidableLabs/followers","following_url":"https://api.github.com/users/FormidableLabs/following{/other_user}","gists_url":"https://api.github.com/users/FormidableLabs/gists{/gist_id}","starred_url":"https://api.github.com/users/FormidableLabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/FormidableLabs/subscriptions","organizations_url":"https://api.github.com/users/FormidableLabs/orgs","repos_url":"https://api.github.com/users/FormidableLabs/repos","events_url":"https://api.github.com/users/FormidableLabs/events{/privacy}","received_events_url":"https://api.github.com/users/FormidableLabs/received_events","type":"Organization","site_admin":false},"repo":{"id":40037231,"name":"victory-chart","full_name":"FormidableLabs/victory-chart","owner":{"login":"FormidableLabs","id":5078602,"avatar_url":"https://avatars.githubusercontent.com/u/5078602?v=3","gravatar_id":"","url":"https://api.github.com/users/FormidableLabs","html_url":"https://github.com/FormidableLabs","followers_url":"https://api.github.com/users/FormidableLabs/followers","following_url":"https://api.github.com/users/FormidableLabs/following{/other_user}","gists_url":"https://api.github.com/users/FormidableLabs/gists{/gist_id}","starred_url":"https://api.github.com/users/FormidableLabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/FormidableLabs/subscriptions","organizations_url":"https://api.github.com/users/FormidableLabs/orgs","repos_url":"https://api.github.com/users/FormidableLabs/repos","events_url":"https://api.github.com/users/FormidableLabs/events{/privacy}","received_events_url":"https://api.github.com/users/FormidableLabs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/FormidableLabs/victory-chart","description":"Chart Component for Victory","fork":false,"url":"https://api.github.com/repos/FormidableLabs/victory-chart","forks_url":"https://api.github.com/repos/FormidableLabs/victory-chart/forks","keys_url":"https://api.github.com/repos/FormidableLabs/victory-chart/keys{/key_id}","collaborators_url":"https://api.github.com/repos/FormidableLabs/victory-chart/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/FormidableLabs/victory-chart/teams","hooks_url":"https://api.github.com/repos/FormidableLabs/victory-chart/hooks","issue_events_url":"https://api.github.com/repos/FormidableLabs/victory-chart/issues/events{/number}","events_url":"https://api.github.com/repos/FormidableLabs/victory-chart/events","assignees_url":"https://api.github.com/repos/FormidableLabs/victory-chart/assignees{/user}","branches_url":"https://api.github.com/repos/FormidableLabs/victory-chart/branches{/branch}","tags_url":"https://api.github.com/repos/FormidableLabs/victory-chart/tags","blobs_url":"https://api.github.com/repos/FormidableLabs/victory-chart/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/FormidableLabs/victory-chart/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/FormidableLabs/victory-chart/git/refs{/sha}","trees_url":"https://api.github.com/repos/FormidableLabs/victory-chart/git/trees{/sha}","statuses_url":"https://api.github.com/repos/FormidableLabs/victory-chart/statuses/{sha}","languages_url":"https://api.github.com/repos/FormidableLabs/victory-chart/languages","stargazers_url":"https://api.github.com/repos/FormidableLabs/victory-chart/stargazers","contributors_url":"https://api.github.com/repos/FormidableLabs/victory-chart/contributors","subscribers_url":"https://api.github.com/repos/FormidableLabs/victory-chart/subscribers","subscription_url":"https://api.github.com/repos/FormidableLabs/victory-chart/subscription","commits_url":"https://api.github.com/repos/FormidableLabs/victory-chart/commits{/sha}","git_commits_url":"https://api.github.com/repos/FormidableLabs/victory-chart/git/commits{/sha}","comments_url":"https://api.github.com/repos/FormidableLabs/victory-chart/comments{/number}","issue_comment_url":"https://api.github.com/repos/FormidableLabs/victory-chart/issues/comments{/number}","contents_url":"https://api.github.com/repos/FormidableLabs/victory-chart/contents/{+path}","compare_url":"https://api.github.com/repos/FormidableLabs/victory-chart/compare/{base}...{head}","merges_url":"https://api.github.com/repos/FormidableLabs/victory-chart/merges","archive_url":"https://api.github.com/repos/FormidableLabs/victory-chart/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/FormidableLabs/victory-chart/downloads","issues_url":"https://api.github.com/repos/FormidableLabs/victory-chart/issues{/number}","pulls_url":"https://api.github.com/repos/FormidableLabs/victory-chart/pulls{/number}","milestones_url":"https://api.github.com/repos/FormidableLabs/victory-chart/milestones{/number}","notifications_url":"https://api.github.com/repos/FormidableLabs/victory-chart/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/FormidableLabs/victory-chart/labels{/name}","releases_url":"https://api.github.com/repos/FormidableLabs/victory-chart/releases{/id}","created_at":"2015-08-01T06:05:36Z","updated_at":"2015-10-27T11:09:24Z","pushed_at":"2015-10-29T19:34:41Z","git_url":"git://github.com/FormidableLabs/victory-chart.git","ssh_url":"git@github.com:FormidableLabs/victory-chart.git","clone_url":"https://github.com/FormidableLabs/victory-chart.git","svn_url":"https://github.com/FormidableLabs/victory-chart","homepage":"","size":4908,"stargazers_count":3,"watchers_count":3,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":11,"forks":0,"open_issues":11,"watchers":3,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/FormidableLabs/victory-chart/pulls/32"},"html":{"href":"https://github.com/FormidableLabs/victory-chart/pull/32"},"issue":{"href":"https://api.github.com/repos/FormidableLabs/victory-chart/issues/32"},"comments":{"href":"https://api.github.com/repos/FormidableLabs/victory-chart/issues/32/comments"},"review_comments":{"href":"https://api.github.com/repos/FormidableLabs/victory-chart/pulls/32/comments"},"review_comment":{"href":"https://api.github.com/repos/FormidableLabs/victory-chart/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/FormidableLabs/victory-chart/pulls/32/commits"},"statuses":{"href":"https://api.github.com/repos/FormidableLabs/victory-chart/statuses/713ef6b2f17ff7601f71bb099a16cc43f6120a30"}}}}