Skip to content
This repository has been archived by the owner on Feb 19, 2022. It is now read-only.

don't reverse polar domain #487

Merged
merged 1 commit into from
Jun 29, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion demo/components/victory-polar-chart-demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -791,7 +791,6 @@ class App extends React.Component {
axisAngle={200}
theme={VictoryTheme.material}
style={chartStyle}
domain={[0, 10]}
tickValues={[2, 4, 6, 8, 10]}
/>
</svg>
Expand Down
14 changes: 12 additions & 2 deletions src/components/victory-polar-axis/helper-methods.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {
assign, uniqBy, includes, defaults, defaultsDeep, isFunction, range as lodashRange, without
} from "lodash";
import { Helpers, LabelHelpers, Scale, Domain } from "victory-core";
import { Helpers, LabelHelpers, Scale, Domain, Collection } from "victory-core";

export default {
getCalculatedValues(props) {
Expand Down Expand Up @@ -49,12 +49,22 @@ export default {
} else if (props.domain && props.domain[inherentAxis]) {
domain = props.domain[inherentAxis];
} else if (Array.isArray(props.tickValues) && props.tickValues.length > 1) {
domain = Domain.getDomainFromTickValues(props, axis);
domain = this.getDomainFromTickValues(props, axis);
}
const paddedDomain = Domain.padDomain(domain, props, inherentAxis);
return domain ? Domain.cleanDomain(paddedDomain, props, inherentAxis) : undefined;
},

getDomainFromTickValues(props, axis) {
if (Helpers.stringTicks(props)) {
return [1, props.tickValues.length];
} else {
const ticks = props.tickValues.map((value) => +value);
const initialDomain = [Collection.getMinValue(ticks), Collection.getMaxValue(ticks)];
return axis === "x" ?
Domain.getSymmetricDomain(initialDomain, ticks) : initialDomain;
}
},

getRadius(props) {
const { left, right, top, bottom } = Helpers.getPadding(props);
Expand Down