Conversation
Reviewer's GuideAdds configurable formatting options for chart stacked total data labels, category axis labels, and tooltips, plus a DockView layout switch helper, by wiring new ChartOptions properties into the JavaScript chart configuration and exposing a new dock layout API. Sequence diagram for chart tooltip/title/category label formattingsequenceDiagram
participant ChartComponent
participant ChartOptions
participant getChartOption
participant formatChartText
ChartComponent->>getChartOption: getChartOption(option)
getChartOption->>ChartOptions: read CategoryLabelFormatter
getChartOption->>formatChartText: formatChartText(CategoryLabelFormatter, { value, label })
getChartOption->>ChartOptions: read TooltipTitleFormatter
getChartOption->>formatChartText: formatChartText(TooltipTitleFormatter, { label, value, datasetLabel, dataIndex, datasetIndex })
getChartOption->>ChartOptions: read TooltipLabelFormatter
getChartOption->>formatChartText: formatChartText(TooltipLabelFormatter, { label, value, datasetLabel, dataIndex, datasetIndex })
getChartOption-->>ChartComponent: configured chart options with formatted labels
Sequence diagram for stacked total data label formattingsequenceDiagram
participant ChartComponent
participant ChartOptions
participant getChartOption
participant getStackedTotal
participant formatChartText
ChartComponent->>getChartOption: getChartOption(option)
getChartOption->>ChartOptions: read ShowTotalDataLabel
getChartOption->>getStackedTotal: getStackedTotal(context)
getStackedTotal-->>getChartOption: total
getChartOption->>ChartOptions: read TotalDataLabelFormatter
getChartOption->>formatChartText: formatChartText(TotalDataLabelFormatter, { total, value: total })
formatChartText-->>getChartOption: formattedTotalText
getChartOption-->>ChartComponent: datalabels.labels.total with totalLabel
Sequence diagram for DockView layout switchingsequenceDiagram
participant DockClient
participant switchLayout
participant Data
participant dockview
DockClient->>switchLayout: switchLayout(id, options)
switchLayout->>Data: Data.get(id)
Data-->>switchLayout: dock
switchLayout->>dockview: dockview.switchLayout(options)
dockview-->>DockClient: layout updated
File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- The new
formatChartTexthelper relies onString.prototype.replaceAll, which may not be available in all target browsers/environments; consider using a more broadly supported implementation (e.g.replacewith a global regex) or a polyfill. - In
Chart.razor.jsthe checksif (option.options.totalDataLabelBorderRadius !== null)andif (option.options.totalDataLabelPadding !== null)will also be true when the values areundefined, causingborderRadius/paddingto be set toundefined; consider changing these to!= nullor explicitly checking fortypeof ... === 'number'to avoid passing undefined into the Chart.js config.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The new `formatChartText` helper relies on `String.prototype.replaceAll`, which may not be available in all target browsers/environments; consider using a more broadly supported implementation (e.g. `replace` with a global regex) or a polyfill.
- In `Chart.razor.js` the checks `if (option.options.totalDataLabelBorderRadius !== null)` and `if (option.options.totalDataLabelPadding !== null)` will also be true when the values are `undefined`, causing `borderRadius`/`padding` to be set to `undefined`; consider changing these to `!= null` or explicitly checking for `typeof ... === 'number'` to avoid passing undefined into the Chart.js config.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Link issues
fixes #1081
Summary By Copilot
Regression?
Risk
Verification
Packaging changes reviewed?
☑️ Self Check before Merge
Summary by Sourcery
Add configurable text formatting options for chart labels and tooltips and expose a new dock layout switching helper.
New Features:
Enhancements: