Skip to content

feat(chart) :: draw horizontal reference lines - #1375

Open
81reap wants to merge 1 commit into
sqlpage:mainfrom
81reap:reference/1-horizontal-lines
Open

feat(chart) :: draw horizontal reference lines#1375
81reap wants to merge 1 commit into
sqlpage:mainfrom
81reap:reference/1-horizontal-lines

Conversation

@81reap

@81reap 81reap commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Motivation

#1374

Description

  • A row with a yline is drawn as a line across the chart at that value of the y axis, with yline_label and yline_color for its text and its color. Reference lines are rows, so a chart can have as many of them as the query returns. A line follows its axis, so on a horizontal bar chart a yline is drawn down the chart rather than across it. They are not added to the total of a stacked chart, and are not filled in an area chart.
  • Document the three parameters, add two examples (an alarm threshold on a line chart, a quota on a horizontal bar chart), and a changelog entry.

Testing

  • Two new browser tests: one chart draws a line and a label for every yline row it receives, and a horizontal bar chart draws its yline down the chart rather than across it.

  1. fix(chart) :: line series up on a category axis for every chart type #1371 :: fix(chart) :: line series up on a category axis for every chart type
  2. feat(chart) :: draw horizontal reference lines #1375 :: feat(chart) :: draw horizontal reference lines ← this PR
  3. feat(chart) :: draw vertical reference lines #1376 :: feat(chart) :: draw vertical reference lines
  4. feat(chart) :: turn a reference line into a band #1377 :: feat(chart) :: turn a reference line into a band

@lovasoa lovasoa left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think we can remove support for yline colors in this pr, then separately add support for both individual point colors and yline colors. What do you think ?

Comment on lines +680 to +681
('yline_label', 'A text to display next to the yline.', 'TEXT', FALSE, TRUE),
('yline_color', 'The name of a color for the yline. Grey by default.', 'COLOR', FALSE, TRUE)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Don't you think it would be better to use common property names ? color and label that describe the color and the label of the element being drawn, be it a point, a vertical line, a horizontal line, or something else ?

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.

image

here is the example page that shows how we can currently have multiple y reference lines. lmk you thoughts :)

https://github.com/sqlpage/SQLPage/pull/1375/changes#diff-5caa0e48a864e277cf43a80229ed27f3f626e3be5af47fe03f57ff2e27a58105R807-R820

@81reap

81reap commented Aug 18, 2026

Copy link
Copy Markdown
Contributor Author

@lovasoa I can try to split out the colour part into a separate PR, but I would push back against that and your comment a bit. Currently as the PR stands, users are able to add any number of X or Y reference lines. We would need colour to be able to tell them apart.

https://github.com/sqlpage/SQLPage/pull/1375/changes#diff-5caa0e48a864e277cf43a80229ed27f3f626e3be5af47fe03f57ff2e27a58105R807-R820

Your comment did bring to mind accessiblity, mainly colour blindness. I can do a follow up PR to add different kinds of dashed reference lines so that end users don't only have to rely on colour to be able to tell the difference.

@81reap

81reap commented Aug 20, 2026

Copy link
Copy Markdown
Contributor Author

not sure why this merge failed the CI :: b5913d8

but passed before :: 48dbb7d

I rebased the branch and pushed it back up to re-try the CI

@81reap
81reap force-pushed the reference/1-horizontal-lines branch from b5913d8 to c4b3fcb Compare August 20, 2026 20:48
@81reap
81reap requested a review from lovasoa August 20, 2026 23:03
@lovasoa

lovasoa commented Aug 22, 2026

Copy link
Copy Markdown
Collaborator

My problem is mainly with having multiple different color row level properties. In my opinion, we should have a single optional row level color property that works for horizontal lines, vertical lines, and individual points.

color is well established and works across components, whereas anything like yline_color would be ad hoc and would have to be memorized

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.

2 participants