From b001abf2501c50ba6c7ea4c65dcb4bc231e2ae9f Mon Sep 17 00:00:00 2001 From: ebrillhart Date: Mon, 25 Jul 2016 10:38:01 -0700 Subject: [PATCH 01/14] fixed for main domain method and chart wrapper and axis --- demo/components/victory-line-demo.js | 5 +++- src/components/victory-axis/helper-methods.js | 3 ++- src/helpers/domain.js | 26 ++++++++++++++++++- src/helpers/wrapper.js | 2 +- 4 files changed, 32 insertions(+), 4 deletions(-) diff --git a/demo/components/victory-line-demo.js b/demo/components/victory-line-demo.js index 1bda8732..33cb2747 100644 --- a/demo/components/victory-line-demo.js +++ b/demo/components/victory-line-demo.js @@ -215,10 +215,13 @@ export default class App extends React.Component { ]} /> + + { + const domainOne = dom[0] === 0 ? 1 / Number.MAX_SAFE_INTEGER : dom[0]; + const domainTwo = dom[1] === 0 ? -Math.abs(1 / Number.MAX_SAFE_INTEGER) : dom[1]; + return scaleType[axis] === "log" ? [domainOne, domainTwo] : dom; + }; + + return rules(domain, "x") && rules(domain, "y"); }, getDomainWithZero(props, axis) { diff --git a/src/helpers/wrapper.js b/src/helpers/wrapper.js index 283a6376..53f3ef3c 100644 --- a/src/helpers/wrapper.js +++ b/src/helpers/wrapper.js @@ -18,7 +18,7 @@ export default { return propsDomain; } childComponents = childComponents || React.Children.toArray(props.children); - return this.getDomainFromChildren(props, axis, childComponents); + return Domain.cleanDomain(this.getDomainFromChildren(props, axis, childComponents), props); }, setAnimationState(nextProps) { From 5140bb5766c7a7c3082c5a7f9129edde3033ba03 Mon Sep 17 00:00:00 2001 From: ebrillhart Date: Mon, 25 Jul 2016 10:50:34 -0700 Subject: [PATCH 02/14] working in ensureZero method for area charts but not bar charts --- demo/components/victory-area-demo.js | 2 +- demo/components/victory-bar-demo.js | 1 + src/helpers/domain.js | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/demo/components/victory-area-demo.js b/demo/components/victory-area-demo.js index 0f65a747..69bb7299 100644 --- a/demo/components/victory-area-demo.js +++ b/demo/components/victory-area-demo.js @@ -103,7 +103,6 @@ export default class App extends React.Component { style={style} animate={{duration: 1000}} data={this.state.areaTransitionData} theme={VictoryTheme.material} - domainPadding={100} containerComponent={ Date: Mon, 25 Jul 2016 11:24:31 -0700 Subject: [PATCH 03/14] cleanDomain works for candlestick and errorbar --- demo/components/victory-bar-demo.js | 1 - src/components/victory-candlestick/helper-methods.js | 2 +- src/components/victory-errorbar/helper-methods.js | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/demo/components/victory-bar-demo.js b/demo/components/victory-bar-demo.js index 5d201d79..716a6ecf 100644 --- a/demo/components/victory-bar-demo.js +++ b/demo/components/victory-bar-demo.js @@ -432,7 +432,6 @@ export default class App extends React.Component { Date: Mon, 25 Jul 2016 13:23:21 -0700 Subject: [PATCH 04/14] refactoring --- src/helpers/domain.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/helpers/domain.js b/src/helpers/domain.js index 75e3d855..6b3a4494 100644 --- a/src/helpers/domain.js +++ b/src/helpers/domain.js @@ -16,7 +16,7 @@ export default { } const dataset = Data.getData(props); const domain = this.getDomainFromData(props, axis, dataset); - return this.cleanDomain(this.padDomain(domain, props, axis), props); + return this.cleanDomain(this.padDomain(domain, props, axis), props, axis); }, cleanDomain(domain, props) { @@ -33,10 +33,10 @@ export default { return domain; } - const rules = (dom, axis) => { + const rules = (dom, ax) => { const domainOne = dom[0] === 0 ? 1 / Number.MAX_SAFE_INTEGER : dom[0]; - const domainTwo = dom[1] === 0 ? -Math.abs(1 / Number.MAX_SAFE_INTEGER) : dom[1]; - return scaleType[axis] === "log" ? [domainOne, domainTwo] : dom; + const domainTwo = dom[1] === 0 ? 1 / Number.MAX_SAFE_INTEGER : dom[1]; + return scaleType[ax] === "log" ? [domainOne, domainTwo] : dom; }; return rules(domain, "x") && rules(domain, "y"); From f2ef08e53cda8ef02a2d22bdf229c7d0abed8aaf Mon Sep 17 00:00:00 2001 From: ebrillhart Date: Mon, 25 Jul 2016 13:40:08 -0700 Subject: [PATCH 05/14] refactor clean domain --- src/components/victory-axis/helper-methods.js | 2 +- src/helpers/domain.js | 21 +++++++++---------- src/helpers/wrapper.js | 2 +- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/src/components/victory-axis/helper-methods.js b/src/components/victory-axis/helper-methods.js index c8ac9029..352410ff 100644 --- a/src/components/victory-axis/helper-methods.js +++ b/src/components/victory-axis/helper-methods.js @@ -27,7 +27,7 @@ export default { domain = Domain.getDomainFromTickValues(props); } const paddedDomain = Domain.padDomain(domain, props, inherentAxis); - return domain ? Domain.cleanDomain(paddedDomain, props) : undefined; + return domain ? Domain.cleanDomain(paddedDomain, props, inherentAxis) : undefined; }, // exposed for use by VictoryChart diff --git a/src/helpers/domain.js b/src/helpers/domain.js index 6b3a4494..4c611669 100644 --- a/src/helpers/domain.js +++ b/src/helpers/domain.js @@ -19,27 +19,26 @@ export default { return this.cleanDomain(this.padDomain(domain, props, axis), props, axis); }, - cleanDomain(domain, props) { + cleanDomain(domain, props, axis) { // Some scale types break when certain data is supplies. This method will // remove data points that break scales. So far this method only removes // zeroes for log scales // TODO other cases? - const scaleType = { - x: Scale.getScaleType(props, "x"), - y: Scale.getScaleType(props, "y") - }; + const scaleType = Scale.getScaleType(props, axis); - if (scaleType.x !== "log" && scaleType.y !== "log") { + if (scaleType !== "log") { return domain; } - const rules = (dom, ax) => { - const domainOne = dom[0] === 0 ? 1 / Number.MAX_SAFE_INTEGER : dom[0]; - const domainTwo = dom[1] === 0 ? 1 / Number.MAX_SAFE_INTEGER : dom[1]; - return scaleType[ax] === "log" ? [domainOne, domainTwo] : dom; + const rules = (dom) => { + const almostZero = dom[0] < 0 || dom[1] < 0 ? -1 / Number.MAX_SAFE_INTEGER + : 1 / Number.MAX_SAFE_INTEGER; + const domainOne = dom[0] === 0 ? almostZero : dom[0]; + const domainTwo = dom[1] === 0 ? almostZero : dom[1]; + return [domainOne, domainTwo]; }; - return rules(domain, "x") && rules(domain, "y"); + return rules(domain); }, getDomainWithZero(props, axis) { diff --git a/src/helpers/wrapper.js b/src/helpers/wrapper.js index 53f3ef3c..5c132553 100644 --- a/src/helpers/wrapper.js +++ b/src/helpers/wrapper.js @@ -18,7 +18,7 @@ export default { return propsDomain; } childComponents = childComponents || React.Children.toArray(props.children); - return Domain.cleanDomain(this.getDomainFromChildren(props, axis, childComponents), props); + return Domain.cleanDomain(this.getDomainFromChildren(props, axis, childComponents), props, axis); }, setAnimationState(nextProps) { From 3182c686323589242bbf66fce1a65998cb70c3b8 Mon Sep 17 00:00:00 2001 From: ebrillhart Date: Mon, 25 Jul 2016 13:43:10 -0700 Subject: [PATCH 06/14] fix a linting error --- src/helpers/wrapper.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/helpers/wrapper.js b/src/helpers/wrapper.js index 5c132553..6a7de109 100644 --- a/src/helpers/wrapper.js +++ b/src/helpers/wrapper.js @@ -18,7 +18,9 @@ export default { return propsDomain; } childComponents = childComponents || React.Children.toArray(props.children); - return Domain.cleanDomain(this.getDomainFromChildren(props, axis, childComponents), props, axis); + return Domain.cleanDomain(this.getDomainFromChildren(props, axis, childComponents), + props, + axis); }, setAnimationState(nextProps) { From cdf349a07565b2b208f2a483efdcbf87175be528 Mon Sep 17 00:00:00 2001 From: ebrillhart Date: Mon, 25 Jul 2016 14:28:01 -0700 Subject: [PATCH 07/14] trying to track down the problem --- demo/components/victory-area-demo.js | 2 +- demo/components/victory-bar-demo.js | 618 ++++++++++--------- src/components/victory-bar/helper-methods.js | 5 +- src/helpers/domain.js | 6 +- 4 files changed, 323 insertions(+), 308 deletions(-) diff --git a/demo/components/victory-area-demo.js b/demo/components/victory-area-demo.js index 69bb7299..7bd09593 100644 --- a/demo/components/victory-area-demo.js +++ b/demo/components/victory-area-demo.js @@ -270,7 +270,7 @@ export default class App extends React.Component {

VictoryBar

- - - - - - - - - - - + {/* + + + + + + + + + + + + + + */} + - - - - "HELLO"} animate={{ duration: 500, @@ -216,270 +229,271 @@ export default class App extends React.Component { }]} data={this.state.barTransitionData} /> - - {this.state.multiTransitionData.map((data, index) => { - return ( - - - - ); - })} - - - - - {this.state.multiTransitionData.map((data, index) => { - return ; - })} - - - - - {this.getBarData().map((data, index) => { - return ; - })} - - - - {this.getBarData().map((data, index) => { - return ; - })} - - - - - {this.getBarData().map((data, index) => { - return ; - })} - - - {this.getBarData().map((data, index) => { - return ; - })} - - - {this.getBarData().map((data, index) => { - return ; - })} - - - - - {this.getBarData().map((data, index) => { - return ; - })} - - - - - - - - - - - - - - - - - - - - { - return [ + {/* + {this.state.multiTransitionData.map((data, index) => { + return ( + + + + ); + })} + + + + + {this.state.multiTransitionData.map((data, index) => { + return ; + })} + + + + + {this.getBarData().map((data, index) => { + return ; + })} + + + + {this.getBarData().map((data, index) => { + return ; + })} + + + + + {this.getBarData().map((data, index) => { + return ; + })} + + + {this.getBarData().map((data, index) => { + return ; + })} + + + {this.getBarData().map((data, index) => { + return ; + })} + + + + + {this.getBarData().map((data, index) => { + return ; + })} + + + + + + + + + + + + + + + + + + + + + { - return {style: merge({}, props.style, {fill: "orange"})}; + target: "data", + eventHandlers: { + onClick: () => { + return [ + { + mutation: (props) => { + return {style: merge({}, props.style, {fill: "orange"})}; + } + } + ]; + } } } - ]; - } - } - } - ]} - /> - - { - return [ + ]} + /> + + { - return {style: merge({}, props.style, {fill: "blue"})}; + target: "data", + eventHandlers: { + onClick: () => { + return [ + { + mutation: (props) => { + return {style: merge({}, props.style, {fill: "blue"})}; + } + } + ]; + } } } - ]; - } - } - } - ]} - /> - - - { - return { - childName: "secondBar", - mutation: (props) => { - return {style: merge({}, props.style, {fill: "blue"})}; - } - }; - } - } - }, { - childName: "secondBar", - target: "data", - eventKey: 0, - eventHandlers: { - onClick: () => { - return [ + ]} + /> + + + { - return props.style.fill === "cyan" ? null : - {style: merge({}, props.style, {fill: "cyan"})}; - } - }, - { - mutation: (props) => { - return {style: merge({}, props.style, {fill: "orange"})}; - } - }, - { - target: "labels", + target: "data", eventKey: 1, - mutation: () => { - return {text: "CLICKED"}; + eventHandlers: { + onClick: () => { + return { + childName: "secondBar", + mutation: (props) => { + return {style: merge({}, props.style, {fill: "blue"})}; + } + }; + } + } + }, { + childName: "secondBar", + target: "data", + eventKey: 0, + eventHandlers: { + onClick: () => { + return [ + { + childName: "firstBar", + mutation: (props) => { + return props.style.fill === "cyan" ? null : + {style: merge({}, props.style, {fill: "cyan"})}; + } + }, + { + mutation: (props) => { + return {style: merge({}, props.style, {fill: "orange"})}; + } + }, + { + target: "labels", + eventKey: 1, + mutation: () => { + return {text: "CLICKED"}; + } + } + ]; + } } } - ]; - } - } - } - ]} - > - - - - - { - evt.stopPropagation(); - return [ + ]} + > + + + + + { - return {style: {fill: "orange"}}; + target: "data", + eventKey: 2, + eventHandlers: { + onClick: (evt) => { + evt.stopPropagation(); + return [ + { + mutation: () => { + return {style: {fill: "orange"}}; + } + } + ]; + } } - } - ]; - } - } - }, { - target: "parent", - eventHandlers: { - onClick: () => { - return [ - { - target: "labels", - mutation: () => { - return {text: "o shit"}; + }, { + target: "parent", + eventHandlers: { + onClick: () => { + return [ + { + target: "labels", + mutation: () => { + return {text: "o shit"}; + } + } + ]; + } } } - ]; - } - } - } - ]} - /> + ]} + />*/} ); } diff --git a/src/components/victory-bar/helper-methods.js b/src/components/victory-bar/helper-methods.js index fa846ec6..1509e15d 100644 --- a/src/components/victory-bar/helper-methods.js +++ b/src/components/victory-bar/helper-methods.js @@ -1,4 +1,4 @@ -import { defaults, omit } from "lodash"; +import { defaults, omit, isFinite } from "lodash"; import { Helpers, Events } from "victory-core"; import Data from "../../helpers/data"; import Domain from "../../helpers/domain"; @@ -16,6 +16,7 @@ export default { x: Domain.getDomainWithZero(props, "x"), y: Domain.getDomainWithZero(props, "y") }; + console.log(domain); const xScale = Scale.getBaseScale(props, "x").domain(domain.x).range(range.x); const yScale = Scale.getBaseScale(props, "y").domain(domain.y).range(range.y); return { @@ -35,7 +36,7 @@ export default { }; return { x: scale.x(formatValue(x, "x")), - y0: scale.y(formatValue(y0, "y")), + y0: isFinite(scale.y(formatValue(y0, "y"))) ? scale.y(formatValue(y0, "y")) : 0, y: scale.y(formatValue(y, "y")) }; }, diff --git a/src/helpers/domain.js b/src/helpers/domain.js index 4c611669..d9329835 100644 --- a/src/helpers/domain.js +++ b/src/helpers/domain.js @@ -44,7 +44,7 @@ export default { getDomainWithZero(props, axis) { const propsDomain = this.getDomainFromProps(props, axis); if (propsDomain) { - return this.padDomain(propsDomain, props, axis); + return this.cleanDomain(this.padDomain(propsDomain, props, axis), props, axis); } const { horizontal } = props; const ensureZero = (domain) => { @@ -55,11 +55,11 @@ export default { }; const categoryDomain = this.getDomainFromCategories(props, axis); if (categoryDomain) { - return this.padDomain(ensureZero(categoryDomain), props, axis); + return this.cleanDomain(this.padDomain(ensureZero(categoryDomain), props, axis), props, axis); } const dataset = Data.getData(props); const domain = ensureZero(this.getDomainFromData(props, axis, dataset)); - return this.cleanDomain(this.padDomain(domain, props, axis), props); + return this.cleanDomain(this.padDomain(domain, props, axis), props, axis); }, getDomainFromProps(props, axis) { From 2623873ba6a51d4aa1c22f77755d8e16fbe99396 Mon Sep 17 00:00:00 2001 From: Lauren Date: Tue, 26 Jul 2016 09:46:09 -0700 Subject: [PATCH 08/14] working log scales for charts with baselines --- demo/components/victory-area-demo.js | 15 +- demo/components/victory-bar-demo.js | 649 +++++++++--------- src/components/victory-area/helper-methods.js | 4 +- src/components/victory-bar/helper-methods.js | 10 +- src/components/victory-chart/victory-chart.js | 4 +- 5 files changed, 357 insertions(+), 325 deletions(-) diff --git a/demo/components/victory-area-demo.js b/demo/components/victory-area-demo.js index 7bd09593..542a2842 100644 --- a/demo/components/victory-area-demo.js +++ b/demo/components/victory-area-demo.js @@ -98,6 +98,19 @@ export default class App extends React.Component { return (
+ + + + + + + -
); } diff --git a/demo/components/victory-bar-demo.js b/demo/components/victory-bar-demo.js index be086156..efc64595 100644 --- a/demo/components/victory-bar-demo.js +++ b/demo/components/victory-bar-demo.js @@ -79,7 +79,7 @@ export default class App extends React.Component { getBarTransitionData() { const bars = random(6, 10); return range(bars).map((bar) => { - return {x: bar, y: random(2, 10)}; + return {x: bar + 1, y: random(2, 10)}; }); } @@ -87,7 +87,7 @@ export default class App extends React.Component { const bars = random(3, 5); return range(4).map(() => { return range(bars).map((bar) => { - return {x: bar, y: random(2, 10)}; + return {x: bar + 1, y: random(2, 10)}; }); }); } @@ -118,74 +118,93 @@ export default class App extends React.Component { return (

VictoryBar

- {/* - - - - - - - - - - - - - - */} - + + + + + + + + + + - + + + + + + + + + + + + + {this.state.multiTransitionData.map((data, index) => { + return ( + + + + ); + })} + + + + + {this.state.multiTransitionData.map((data, index) => { + return ; + })} + + + + + {this.getBarData().map((data, index) => { + return ; + })} + + + + {this.getBarData().map((data, index) => { + return ; + })} + + + + + {this.getBarData().map((data, index) => { + return ; + })} + + + {this.getBarData().map((data, index) => { + return ; + })} + + + {this.getBarData().map((data, index) => { + return ; + })} + + + + + {this.getBarData().map((data, index) => { + return ; + })} + + + + + + + + + + + + + + + + - {/* - {this.state.multiTransitionData.map((data, index) => { - return ( - - - - ); - })} - - - - - {this.state.multiTransitionData.map((data, index) => { - return ; - })} - - - - - {this.getBarData().map((data, index) => { - return ; - })} - - - - {this.getBarData().map((data, index) => { - return ; - })} - - - - - {this.getBarData().map((data, index) => { - return ; - })} - - - {this.getBarData().map((data, index) => { - return ; - })} - - - {this.getBarData().map((data, index) => { - return ; - })} - - - - - {this.getBarData().map((data, index) => { - return ; - })} - - - - - - - - - - - - - - - - - - - - - + + { + return [ { - target: "data", - eventHandlers: { - onClick: () => { - return [ - { - mutation: (props) => { - return {style: merge({}, props.style, {fill: "orange"})}; - } - } - ]; - } + mutation: (props) => { + return {style: merge({}, props.style, {fill: "orange"})}; } } - ]} - /> - - + + { + return [ { - target: "data", - eventHandlers: { - onClick: () => { - return [ - { - mutation: (props) => { - return {style: merge({}, props.style, {fill: "blue"})}; - } - } - ]; - } + mutation: (props) => { + return {style: merge({}, props.style, {fill: "blue"})}; } } - ]} - /> - - - + + + { + return { + childName: "secondBar", + mutation: (props) => { + return {style: merge({}, props.style, {fill: "blue"})}; + } + }; + } + } + }, { + childName: "secondBar", + target: "data", + eventKey: 0, + eventHandlers: { + onClick: () => { + return [ { childName: "firstBar", - target: "data", - eventKey: 1, - eventHandlers: { - onClick: () => { - return { - childName: "secondBar", - mutation: (props) => { - return {style: merge({}, props.style, {fill: "blue"})}; - } - }; - } + mutation: (props) => { + return props.style.fill === "cyan" ? null : + {style: merge({}, props.style, {fill: "cyan"})}; } - }, { - childName: "secondBar", - target: "data", - eventKey: 0, - eventHandlers: { - onClick: () => { - return [ - { - childName: "firstBar", - mutation: (props) => { - return props.style.fill === "cyan" ? null : - {style: merge({}, props.style, {fill: "cyan"})}; - } - }, - { - mutation: (props) => { - return {style: merge({}, props.style, {fill: "orange"})}; - } - }, - { - target: "labels", - eventKey: 1, - mutation: () => { - return {text: "CLICKED"}; - } - } - ]; - } + }, + { + mutation: (props) => { + return {style: merge({}, props.style, {fill: "orange"})}; + } + }, + { + target: "labels", + eventKey: 1, + mutation: () => { + return {text: "CLICKED"}; } } - ]} - > - - - - - + + + + + { + evt.stopPropagation(); + return [ { - target: "data", - eventKey: 2, - eventHandlers: { - onClick: (evt) => { - evt.stopPropagation(); - return [ - { - mutation: () => { - return {style: {fill: "orange"}}; - } - } - ]; - } + mutation: () => { + return {style: {fill: "orange"}}; } - }, { - target: "parent", - eventHandlers: { - onClick: () => { - return [ - { - target: "labels", - mutation: () => { - return {text: "o shit"}; - } - } - ]; - } + } + ]; + } + } + }, { + target: "parent", + eventHandlers: { + onClick: () => { + return [ + { + target: "labels", + mutation: () => { + return {text: "o shit"}; } } - ]} - />*/} + ]; + } + } + } + ]} + />
); } diff --git a/src/components/victory-area/helper-methods.js b/src/components/victory-area/helper-methods.js index 5b88eae7..ac3ebd47 100644 --- a/src/components/victory-area/helper-methods.js +++ b/src/components/victory-area/helper-methods.js @@ -69,7 +69,9 @@ export default { getDataWithBaseline(props, domain) { const data = Data.getData(props); - const minY = Math.min(...domain.y) > 0 ? Math.min(...domain.y) : 0; + const defaultMin = Scale.getScaleType(props, "y") === "log" ? 1 / Number.MAX_SAFE_INTEGER : 0; + + const minY = Math.min(...domain.y) > 0 ? Math.min(...domain.y) : defaultMin; return data.map((datum) => { const y1 = datum.yOffset ? datum.yOffset + datum.y : datum.y; const y0 = datum.yOffset || minY; diff --git a/src/components/victory-bar/helper-methods.js b/src/components/victory-bar/helper-methods.js index 1509e15d..64a3f120 100644 --- a/src/components/victory-bar/helper-methods.js +++ b/src/components/victory-bar/helper-methods.js @@ -1,4 +1,4 @@ -import { defaults, omit, isFinite } from "lodash"; +import { defaults, omit } from "lodash"; import { Helpers, Events } from "victory-core"; import Data from "../../helpers/data"; import Domain from "../../helpers/domain"; @@ -16,7 +16,6 @@ export default { x: Domain.getDomainWithZero(props, "x"), y: Domain.getDomainWithZero(props, "y") }; - console.log(domain); const xScale = Scale.getBaseScale(props, "x").domain(domain.x).range(range.x); const yScale = Scale.getBaseScale(props, "y").domain(domain.y).range(range.y); return { @@ -26,9 +25,12 @@ export default { }, getBarPosition(props, datum, scale) { + const currentAxis = props.horizontal ? "x" : "y"; + const defaultMin = Scale.getScaleType(props, currentAxis) === "log" ? + 1 / Number.MAX_SAFE_INTEGER : 0; const yOffset = datum.yOffset || 0; const xOffset = datum.xOffset || 0; - const y0 = yOffset; + const y0 = yOffset || defaultMin; const y = datum.y + yOffset; const x = datum.x + xOffset; const formatValue = (value, axis) => { @@ -36,7 +38,7 @@ export default { }; return { x: scale.x(formatValue(x, "x")), - y0: isFinite(scale.y(formatValue(y0, "y"))) ? scale.y(formatValue(y0, "y")) : 0, + y0: scale.y(formatValue(y0, "y")), y: scale.y(formatValue(y, "y")) }; }, diff --git a/src/components/victory-chart/victory-chart.js b/src/components/victory-chart/victory-chart.js index 333f5793..339ba0e7 100644 --- a/src/components/victory-chart/victory-chart.js +++ b/src/components/victory-chart/victory-chart.js @@ -249,8 +249,8 @@ export default class VictoryChart extends React.Component { } getAxisProps(child, props, calculatedProps) { - const {domain, scale} = calculatedProps; - const axis = child.type.getAxis(child.props); + const {domain, scale, horizontal} = calculatedProps; + const axis = Axis.getCurrentAxis(Axis.getAxis(child.props), horizontal); const axisOffset = ChartHelpers.getAxisOffset(props, calculatedProps); const tickValues = ChartHelpers.getTicks(calculatedProps, axis, child); const tickFormat = From e96be9e887f6099557212820ababd76cee445555 Mon Sep 17 00:00:00 2001 From: Lauren Date: Tue, 26 Jul 2016 10:15:30 -0700 Subject: [PATCH 09/14] revert axis change --- src/components/victory-chart/victory-chart.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/victory-chart/victory-chart.js b/src/components/victory-chart/victory-chart.js index 339ba0e7..0e675890 100644 --- a/src/components/victory-chart/victory-chart.js +++ b/src/components/victory-chart/victory-chart.js @@ -250,7 +250,7 @@ export default class VictoryChart extends React.Component { getAxisProps(child, props, calculatedProps) { const {domain, scale, horizontal} = calculatedProps; - const axis = Axis.getCurrentAxis(Axis.getAxis(child.props), horizontal); + const axis = child.type.getAxis(child.props); const axisOffset = ChartHelpers.getAxisOffset(props, calculatedProps); const tickValues = ChartHelpers.getTicks(calculatedProps, axis, child); const tickFormat = From edab685e1957b38c476853547686e9e7928b321d Mon Sep 17 00:00:00 2001 From: Lauren Date: Tue, 26 Jul 2016 10:22:17 -0700 Subject: [PATCH 10/14] lint --- src/components/victory-chart/victory-chart.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/victory-chart/victory-chart.js b/src/components/victory-chart/victory-chart.js index 0e675890..46720a45 100644 --- a/src/components/victory-chart/victory-chart.js +++ b/src/components/victory-chart/victory-chart.js @@ -249,7 +249,7 @@ export default class VictoryChart extends React.Component { } getAxisProps(child, props, calculatedProps) { - const {domain, scale, horizontal} = calculatedProps; + const { domain, scale } = calculatedProps; const axis = child.type.getAxis(child.props); const axisOffset = ChartHelpers.getAxisOffset(props, calculatedProps); const tickValues = ChartHelpers.getTicks(calculatedProps, axis, child); From 877a77270554d6913eaeccad0a50ec7ef2c8c8b8 Mon Sep 17 00:00:00 2001 From: ebrillhart Date: Tue, 26 Jul 2016 12:12:34 -0700 Subject: [PATCH 11/14] commit changes to review during pairing session --- src/components/victory-axis/helper-methods.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/components/victory-axis/helper-methods.js b/src/components/victory-axis/helper-methods.js index 352410ff..09e88580 100644 --- a/src/components/victory-axis/helper-methods.js +++ b/src/components/victory-axis/helper-methods.js @@ -27,6 +27,7 @@ export default { domain = Domain.getDomainFromTickValues(props); } const paddedDomain = Domain.padDomain(domain, props, inherentAxis); + console.log("DOMAIN", Domain.cleanDomain(paddedDomain, props, inherentAxis), axis); return domain ? Domain.cleanDomain(paddedDomain, props, inherentAxis) : undefined; }, @@ -45,6 +46,7 @@ export default { // exposed for use by VictoryChart getScale(props) { const axis = this.getAxis(props); + console.log("PROPS", props); const scale = Scale.getBaseScale(props, axis); const domain = this.getDomain(props) || scale.domain(); scale.range(Helpers.getRange(props, axis)); From 39d5c7f1abc9ae64cbc081c018adbeab63abca79 Mon Sep 17 00:00:00 2001 From: ebrillhart Date: Wed, 27 Jul 2016 10:06:57 -0700 Subject: [PATCH 12/14] more attempts at debugging --- src/components/victory-axis/helper-methods.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/components/victory-axis/helper-methods.js b/src/components/victory-axis/helper-methods.js index 09e88580..04c6058c 100644 --- a/src/components/victory-axis/helper-methods.js +++ b/src/components/victory-axis/helper-methods.js @@ -28,6 +28,7 @@ export default { } const paddedDomain = Domain.padDomain(domain, props, inherentAxis); console.log("DOMAIN", Domain.cleanDomain(paddedDomain, props, inherentAxis), axis); + console.log("SCALE", props.scale, axis); return domain ? Domain.cleanDomain(paddedDomain, props, inherentAxis) : undefined; }, @@ -48,6 +49,7 @@ export default { const axis = this.getAxis(props); console.log("PROPS", props); const scale = Scale.getBaseScale(props, axis); + console.log("GET SCALE", scale); const domain = this.getDomain(props) || scale.domain(); scale.range(Helpers.getRange(props, axis)); scale.domain(domain); From 9e9d0947c475ea0a3ccc72307ee666759d31eb23 Mon Sep 17 00:00:00 2001 From: ebrillhart Date: Wed, 27 Jul 2016 13:19:17 -0700 Subject: [PATCH 13/14] remove debugging messages --- src/components/victory-axis/helper-methods.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/victory-axis/helper-methods.js b/src/components/victory-axis/helper-methods.js index 04c6058c..e67e0fdb 100644 --- a/src/components/victory-axis/helper-methods.js +++ b/src/components/victory-axis/helper-methods.js @@ -27,8 +27,8 @@ export default { domain = Domain.getDomainFromTickValues(props); } const paddedDomain = Domain.padDomain(domain, props, inherentAxis); - console.log("DOMAIN", Domain.cleanDomain(paddedDomain, props, inherentAxis), axis); - console.log("SCALE", props.scale, axis); + console.log("DOMAIN", Domain.cleanDomain(paddedDomain, props, inherentAxis), inherentAxis); + console.log("SCALE", Scale.getScaleType(props, inherentAxis)); return domain ? Domain.cleanDomain(paddedDomain, props, inherentAxis) : undefined; }, From afe87dcff89dca9fb95b373198e9858daea416db Mon Sep 17 00:00:00 2001 From: ebrillhart Date: Wed, 27 Jul 2016 13:20:18 -0700 Subject: [PATCH 14/14] remove more debug messages --- src/components/victory-axis/helper-methods.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/components/victory-axis/helper-methods.js b/src/components/victory-axis/helper-methods.js index e67e0fdb..352410ff 100644 --- a/src/components/victory-axis/helper-methods.js +++ b/src/components/victory-axis/helper-methods.js @@ -27,8 +27,6 @@ export default { domain = Domain.getDomainFromTickValues(props); } const paddedDomain = Domain.padDomain(domain, props, inherentAxis); - console.log("DOMAIN", Domain.cleanDomain(paddedDomain, props, inherentAxis), inherentAxis); - console.log("SCALE", Scale.getScaleType(props, inherentAxis)); return domain ? Domain.cleanDomain(paddedDomain, props, inherentAxis) : undefined; }, @@ -47,9 +45,7 @@ export default { // exposed for use by VictoryChart getScale(props) { const axis = this.getAxis(props); - console.log("PROPS", props); const scale = Scale.getBaseScale(props, axis); - console.log("GET SCALE", scale); const domain = this.getDomain(props) || scale.domain(); scale.range(Helpers.getRange(props, axis)); scale.domain(domain);