Add point selection handling to WebstatusLineChartPanel
#1178
+297
−4
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.
This will be useful for this milestone: https://github.com/GoogleChrome/webstatus.dev/milestone/10
This PR builds upon the enhanced
webstatus-gchart
component (see related PR #1177 ) by adding functionality to theWebstatusLineChartPanel
abstract class to handle point selection and deselection events. This provides a consistent and customizable way for subclasses to react to user interactions with the chart.Key changes:
createPointSelectedTask
method: This new method allows subclasses to define aTask
to be executed when a point is selected on the chart. It also enables them to provide arenderSuccess
function to render content based on the task's result.handlePointSelected
andhandlePointDeselected
methods handle thepoint-selected
andpoint-deselected
events dispatched by thewebstatus-gchart
component._pointSelectedTask
and_renderCustomPointSelectedSuccess
properties store the state associated with the selected point.renderPointSelectedDetails
method provides a placeholder for rendering details about the selected point, which can be customized by subclasses.renderPointSelectedDetails
method now includes loading states (pending, initial, error) to provide visual feedback during task execution.This enhancement enables subclasses of
WebstatusLineChartPanel
to easily handle point selection and deselection events, providing a more interactive and informative user experience. It leverages the new events introduced in thewebstatus-gchart
component (see related PR #1177) to provide a seamless and consistent way to manage chart interactions.