Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
10 changes: 8 additions & 2 deletions packages/core/src/components/axes/Grid.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,14 @@ Grid.propTypes = {

xScale: PropTypes.func,
yScale: PropTypes.func,
xValues: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string])),
yValues: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string])),
xValues: PropTypes.oneOfType([
PropTypes.number,
PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string])),
]),
yValues: PropTypes.oneOfType([
PropTypes.number,
PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string])),
]),

theme: PropTypes.object.isRequired,

Expand Down
13 changes: 6 additions & 7 deletions packages/core/src/lib/cartesian/axes.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,13 +163,12 @@ export const computeAxisTicks = ({
*
* @return {Array.<Object>}
*/
export const computeGridLines = ({
width,
height,
scale,
axis,
values = getScaleValues(scale),
}) => {
export const computeGridLines = ({ width, height, scale, axis, values: _values }) => {
const gridValues = isArray(_values) ? _values : undefined
const gridCount = isNumber(_values) ? _values : undefined

const values = gridValues || getScaleValues(scale, gridCount)

const position = scale.bandwidth ? centerScale(scale) : scale

let lines
Expand Down
10 changes: 8 additions & 2 deletions packages/line/src/props.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,14 @@ export const LinePropTypes = {

enableGridX: PropTypes.bool.isRequired,
enableGridY: PropTypes.bool.isRequired,
gridXValues: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string])),
gridYValues: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string])),
gridXValues: PropTypes.oneOfType([
PropTypes.number,
PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string])),
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The line chart also supports Date objects, so you should add PropTypes.instanceOf(Date) to both gridXValues and gridYValues.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the feedback, I wasn't sure about that. I've added it now.

]),
gridYValues: PropTypes.oneOfType([
PropTypes.number,
PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string])),
]),

enableDots: PropTypes.bool.isRequired,
dotSymbol: PropTypes.func,
Expand Down