Skip to content

Commit

Permalink
Showing 4 changed files with 45 additions and 2 deletions.
5 changes: 4 additions & 1 deletion packages/axes/src/components/Axis.js
Original file line number Diff line number Diff line change
@@ -149,7 +149,10 @@ class Axis extends Component {
<text
transform={`translate(${legendX}, ${legendY}) rotate(${legendRotation})`}
textAnchor={textAnchor}
style={theme.axis.legend.text}
style={{
alignmentBaseline: 'middle',
...theme.axis.legend.text,
}}
>
{legend}
</text>
10 changes: 9 additions & 1 deletion packages/parallel-coordinates/src/ParallelCoordinates.js
Original file line number Diff line number Diff line change
@@ -67,7 +67,15 @@ export class ParallelCoordinates extends Component {
x={layout === 'horizontal' ? variablesScale(variable.key) : 0}
y={layout === 'horizontal' ? 0 : variablesScale(variable.key)}
scale={variable.scale}
ticksPosition={axesTicksPosition}
ticksPosition={variable.ticksPosition || axesTicksPosition}
tickValues={variable.tickValues}
tickSize={variable.tickSize}
tickPadding={variable.tickPadding}
tickRotation={variable.tickRotation}
tickFormat={variable.tickFormat}
legend={variable.legend}
legendPosition={variable.legendPosition}
legendOffset={variable.legendOffset}
theme={theme}
{...motionProps}
/>
15 changes: 15 additions & 0 deletions packages/parallel-coordinates/src/props.js
Original file line number Diff line number Diff line change
@@ -11,6 +11,14 @@ import { themePropType, lineCurvePropType } from '@nivo/core'

const commonVariablePropTypes = {
key: PropTypes.string.isRequired,
ticksPosition: PropTypes.oneOf(['before', 'after']),
tickSize: PropTypes.number,
tickPadding: PropTypes.number,
tickRotation: PropTypes.number,
tickFormat: PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
legend: PropTypes.node,
legendPosition: PropTypes.oneOf(['start', 'middle', 'end']),
legendOffset: PropTypes.number,
}

export const commonPropTypes = {
@@ -25,12 +33,19 @@ export const commonPropTypes = {
values: PropTypes.arrayOf(
PropTypes.oneOfType([PropTypes.string, PropTypes.number])
),
tickValues: PropTypes.arrayOf(
PropTypes.oneOfType([PropTypes.string, PropTypes.number])
),
}),
PropTypes.shape({
...commonVariablePropTypes,
type: PropTypes.oneOf(['linear']).isRequired,
min: PropTypes.oneOfType([PropTypes.number, PropTypes.oneOf(['auto'])]),
max: PropTypes.oneOfType([PropTypes.number, PropTypes.oneOf(['auto'])]),
tickValues: PropTypes.oneOfType([
PropTypes.number,
PropTypes.arrayOf(PropTypes.number),
]),
}),
])
).isRequired,
17 changes: 17 additions & 0 deletions website/src/components/charts/parallel-coordinates/variables.js
Original file line number Diff line number Diff line change
@@ -13,29 +13,46 @@ export default [
type: 'linear',
min: 'auto',
max: 'auto',
ticksPosition: 'before',
legend: 'temperature',
legendPosition: 'start',
legendOffset: 20,
},
{
key: 'cost',
type: 'linear',
min: 0,
max: 'auto',
ticksPosition: 'before',
legend: 'cost',
legendPosition: 'start',
legendOffset: 20,
},
{
key: 'color',
type: 'point',
padding: 1,
values: ['red', 'yellow', 'green'],
legend: 'color',
legendPosition: 'start',
legendOffset: -20,
},
{
key: 'target',
type: 'point',
padding: 0,
values: ['A', 'B', 'C', 'D', 'E'],
legend: 'target',
legendPosition: 'start',
legendOffset: -20,
},
{
key: 'volume',
type: 'linear',
min: 0,
max: 'auto',
legend: 'volume',
legendPosition: 'start',
legendOffset: -20,
},
]

0 comments on commit b8a3907

Please sign in to comment.