Skip to content
This repository has been archived by the owner on Aug 4, 2020. It is now read-only.

Document dataSort prop #256

Merged
merged 8 commits into from
Feb 25, 2017
Merged

Document dataSort prop #256

merged 8 commits into from
Feb 25, 2017

Conversation

DerekMaffett
Copy link
Contributor

## Sorting data


Sorting can be applied to the final data via the dataSort prop. This prop must
Copy link
Contributor

Choose a reason for hiding this comment

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

Change this to reflect the lodash sortBy param

Copy link
Contributor

Choose a reason for hiding this comment

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

link to the sortBy docs too

]}
x="experiment"
y={(d) => (d.actual / d.expected) * 100}
dataSort={(a, b) => (a.experiment - b.experiment)}
Copy link
Contributor

Choose a reason for hiding this comment

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

Here's a cool example that demonstrates why you would want to use this feature https://github.com/FormidableLabs/victory-chart/blob/master/demo/components/victory-line-demo.js#L304

Copy link
Contributor

Choose a reason for hiding this comment

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

In general docs examples should be as minimal as possible so that it is clear what is being explained

### sortKey

Use the `sortKey` prop to indicate how data should be sorted. This prop is
given directly to the lodash `sortBy` function to be executed on the final
Copy link
Contributor

Choose a reason for hiding this comment

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

Please include a link to the sortKey documentation.

Copy link
Contributor

Choose a reason for hiding this comment

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

You should also briefly describe what this prop can be given as i.e. string, array etc

given directly to the lodash `sortBy` function to be executed on the final
dataset.

*examples*: `sortKey="x"`, `sortKey="y"`
Copy link
Contributor

Choose a reason for hiding this comment

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

It would be more useful to give examples with different prop types, like
sortKey="x", sortKey={["age", "height"]}

@@ -40,6 +40,12 @@ Use the `x` and `y` data accessor props to determine how the component defines d

*examples:* `y="employees.salary"`, `y={["employees", "salary"]}`

### sortKey

Copy link
Contributor

Choose a reason for hiding this comment

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

Should be the same as the other sortKey descriptions

@DerekMaffett
Copy link
Contributor Author

Ready for re-review


Use the `sortKey` prop to indicate how data should be sorted. This prop is
given directly to the lodash `sortBy` function to be executed on the final
dataset: https://lodash.com/docs/4.17.4#sortBy
Copy link
Contributor

Choose a reason for hiding this comment

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

As a markdown link, please. Maybe like

This prop is given directly to [the lodash sortBy function]...

with the link at the bottom on the file like
[the lodash sortBy function]: https://lodash.com/docs/4.17.4#sortBy

@boygirl
Copy link
Contributor

boygirl commented Feb 24, 2017

@DerekMaffett approved pending markdown links.

Copy link
Contributor

@boygirl boygirl left a comment

Choose a reason for hiding this comment

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

👍

@DerekMaffett DerekMaffett merged commit dd9dfe4 into master Feb 25, 2017
@DerekMaffett DerekMaffett deleted the feature/document-dataSort-prop branch February 25, 2017 11:07
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants