Skip to content

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

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

feat(chart) :: draw horizontal reference lines#1375
81reap wants to merge 2 commits 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

@81reap
81reap force-pushed the reference/1-horizontal-lines branch from 27c1482 to 48dbb7d Compare August 13, 2026 07:55
@81reap
81reap marked this pull request as ready for review August 13, 2026 07:58

@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 ?

@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.

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