Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: allow ticks to be configurable with total count, interval, and starting placement #330

Merged
merged 3 commits into from
Oct 22, 2020

Conversation

TCL735
Copy link
Contributor

@TCL735 TCL735 commented Oct 22, 2020

Closes #79

Allows user to specify tick generation in the config.

Screen Shot 2020-10-21 at 8 52 15 PM

@TCL735 TCL735 requested review from a team, kristinarobinson, hoorayimhelping and Palakp41 and removed request for a team October 22, 2020 04:21
Copy link
Contributor

@hoorayimhelping hoorayimhelping left a comment

Choose a reason for hiding this comment

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

The code looks fine in isolation, but the higher level concerns about the explosion of configuration options still remain for me


- **yTickStep**: _number. Optional. **Ignored when yTicks is specified**._ A number representing the tick interval for the y-axis. May be negative.

- **yTickStart**: _number. Optional. **Ignored when yTicks is specified**._ A number representing the value of the first tick on the y-axis. This will determine the placement of all subsequent ticks. Must be within the domain of the y-axis, otherwise will not be rendered. Subsequent ticks may still be rendered if their placement is within the domain.

Copy link
Contributor

Choose a reason for hiding this comment

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

initial reaction is that this is a bit alarming and the interface is pretty hefty. the interplay between all these different properties (e.g. if xTickStart is outside the domain of the x-axis, they aren't rendered) is a little complex and confusing. not sure if there's anything to do about this now, but i think we'll need to address the issues that are causing big configurations like this

Copy link
Contributor Author

@TCL735 TCL735 Oct 22, 2020

Choose a reason for hiding this comment

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

Slight clarification and change to the text of xTickStart and yTickStart.

What do you think of this?
Screen Shot 2020-10-22 at 4 00 00 PM

// when it includes a dash (negative number), it tends to be skinnier than
// a positive number because a dash is not as wide as a single digit (most of the time).
// Add padding when text has a dash by making dashes twice as wide.
const widthPadding =
Copy link
Contributor

Choose a reason for hiding this comment

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

is there a cleaner way of doing this? i don't think we can rely on a dash being the same thing as a negative indicator. some platforms might not render -1 consistently with other platforms

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes there is a cleaner way. No extra <span> necessary. We do need to check for a dash though, unfortunately. I will send up a new commit in the near future.

expect(result.length).toEqual(0)
})
})
})
Copy link
Contributor

Choose a reason for hiding this comment

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

great tests from a tactical level. from a higher, strategic level, just reinforcing what i said before - there's a lot of interplay here that is pretty complex and will probably be really confusing for users and might be an indication of larger design issues.

tickStep?: number
) => {
const [start = 0, end = 0] = domain
if (isFiniteNumber(totalTicks) || isFiniteNumber(tickStep)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

should this || be an &&?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No. It is correct as ||. I will demo this to show off the flexibility.

expect(isFiniteNumber(() => 123)).toEqual(false)
expect(isFiniteNumber(Symbol())).toEqual(false)
})
})
Copy link
Contributor

Choose a reason for hiding this comment

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

for consistency, can you change these tests to its please?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, will do.

@TCL735 TCL735 merged commit 95ff730 into master Oct 22, 2020
@TCL735 TCL735 deleted the feat_79_tick_generation branch October 22, 2020 23:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Can't control tick generation
2 participants