-
Notifications
You must be signed in to change notification settings - Fork 239
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: add grid lines #1179
base: dev
Are you sure you want to change the base?
feat: add grid lines #1179
Conversation
src/main.js
Outdated
return svg` | ||
<svg width='100%' height=${height !== 0 ? '100%' : 0} viewBox='0 0 500 ${height}' | ||
@click=${e => e.stopPropagation()}> | ||
<g> | ||
${grid_line_type ? this.renderGridLines() : ''} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably next "layers" will "overlay" the grid & make it less visible. I am thinking about drawing the grid AFTER these layers. But let's leave it this way & test...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried to move it around, but I don't see any visual changes to that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't see any visual changes to that
OK, we'll test it together
src/main.js
Outdated
const lines = []; | ||
|
||
for (let i = 0; i < numLines; i += 1) { | ||
const x = xRatio * (i + 0.5); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Assume we have hours_to_show=2
& grid_line_type=hour
.
Then numLines = 2
& xRatio = 250
.
Then we will have 2 lines - for 125
& 375
, i.e. for hour=0.5
& hour=1.5
.
And the 1st line will be "thin" (0 % 2 === 0), the 2nd line will be "thick" (1 % 2 = 1).
Not nice.
ALternatively we can make "thin" lines for "hour=0.5" & "hour=1.5", and "thick" line for "hour=1".
What do you think?
Also, can we turn a "frequency" - that "2" value - into an option like grid_line_?????
to define which lines should be "thin"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah that's the 0.5 in this line const x = xRatio * (i + 0.5);
If I remove it the first line is kinda hidden in the border and I find it wierd, that's why there is an offset
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am trying now to adapt the algorithm to a fractional hours_to_show
. For int values already made it, but for fractional more difficult story.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please check my addition below (currently last comment in the thread).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
refactored
@JulienDeveaux |
@JulienDeveaux
The code was tested locally. The code should be placed after this line:
till this last line:
|
Implements #837
This is a grid_line_type of day for an hours_to_show of 730