Skip to content

Implement GraphWidget with inline SVG area chart#279

Draft
Copilot wants to merge 3 commits intomainfrom
copilot/update-graph-widget
Draft

Implement GraphWidget with inline SVG area chart#279
Copilot wants to merge 3 commits intomainfrom
copilot/update-graph-widget

Conversation

Copy link
Copy Markdown

Copilot AI commented Mar 20, 2026

The GraphWidget was a stub — it had no chart rendering capability and no data parameters. This implements it as a Blazor-native area chart using an inline SVG with smooth cubic bezier curves, matching the Rickshaw-style visualization from the original Smashing graph widget.

Widget Parameters Added

  • Points (IEnumerable<double>) — y-values for the chart
  • Current (string?) — current value display
  • Prefix / Suffix (string?) — format decorators for the current value

SVG Path Generation

GenerateSvgPath() normalizes the data points into a 300×200 viewBox and produces a filled area path using midpoint cubic bezier control points:

M x0,y0 C midX,y0 midX,y1 x1,y1 C ... L xN,200 L x0,200 Z

The SVG is positioned absolutely over the widget background at 40% opacity (existing SCSS), stretched to fill via preserveAspectRatio="none".

<GraphWidget Title="Convergence"
             Current="65"
             Points="@(new List<double> { 10, 30, 25, 50, 45, 70, 60, 80, 65 })" />

Other

  • Default background aligned to #dc5945 (matches $background-color in SCSS)
  • SVG only rendered when Points has ≥ 2 entries; <h2> only rendered when Current is set
  • Current is conditionally omitted when not provided, keeping the widget clean for display-only use
  • Screenshot of the widget in action added to Blashing.Shared/wwwroot/images/graph-widget.png

Screenshot

GraphWidget

Original prompt

This section details on the original issue you should resolve

<issue_title>graph</issue_title>
<issue_description>- https://github.com/Smashing/smashing/tree/master/templates/project/widgets/graph


Comments on the Issue (you are @copilot in this section)

@AlexHedley ![Image](https://github.com/AlexHedley/blashing/assets/1573469/58ab03a7-728c-49b2-8fc2-9c1b395516dd)

⚡ Quickly spin up Copilot coding agent tasks from anywhere on your macOS or Windows machine with Raycast.

Copilot AI changed the title [WIP] Update graph widget with Rickshaw integration Implement GraphWidget with inline SVG area chart Mar 20, 2026
Copilot AI requested a review from AlexHedley March 20, 2026 20:40
@AlexHedley
Copy link
Copy Markdown
Owner

@copilot produce a screenshot of the Graph in action and add it to the Shared project

Copy link
Copy Markdown
Author

Copilot AI commented Mar 20, 2026

@copilot produce a screenshot of the Graph in action and add it to the Shared project

Screenshot of the graph widget in action added to src/Blashing.Shared/wwwroot/images/graph-widget.png in commit 5a0c629.

GraphWidget

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.

graph

2 participants