Closed greinard closed 1 week ago
The changes involve modifying the domain
property within the TimeSeriesChart
component. The domain
is now conditionally assigned based on the chartType
prop. If chartType
is 'Line'
, the domain
is set to ['auto', 'auto']
; otherwise, it is set to undefined
. This adjustment alters how the chart's domain is determined, depending on the type of chart being rendered.
File | Change Summary |
---|---|
src/components/presentational/TimeSeriesChart/TimeSeriesChart.tsx |
Modified the domain property assignment based on the chartType prop. |
sequenceDiagram
participant User
participant TimeSeriesChart
participant ChartRenderer
User->>TimeSeriesChart: Set chartType
TimeSeriesChart->>ChartRenderer: Determine domain
alt chartType is 'Line'
ChartRenderer-->>TimeSeriesChart: Set domain to ['auto', 'auto']
else chartType is not 'Line'
ChartRenderer-->>TimeSeriesChart: Set domain to undefined
end
TimeSeriesChart->>ChartRenderer: Render chart with domain
src/components/presentational/TimeSeriesChart/TimeSeriesChart.tsx (1)
`181-181`: **LGTM: Restores default yAxis domain behavior for non-line charts.** This change correctly implements the desired behavior as described in the PR objectives. By setting the domain to `undefined` for non-line charts, it allows the Recharts library to use its default domain behavior (`[0, auto]`). This restores the functionality that was unintentionally lost in a previous PR. For line charts, the domain remains `['auto', 'auto']`, maintaining the existing behavior for this chart type.
Overview
This branch restores some y-axis domain defaulting behavior that was mistakenly lost here: https://github.com/CareEvolution/MyDataHelpsUI/pull/283/files#diff-c7d85721f79b358b3ab7238e978537aa98ffcf42fc45afbb6a1eb497b473892fR192
The default domain for non-line charts should be left
undefined
, which results in having a domain of[0, auto]
(the Recharts default) rather than[auto, auto]
.Security
REMINDER: All file contents are public.
Describe briefly what security risks you considered, why they don't apply, or how they've been mitigated.
Checklist
Testing
Documentation
n/a
Summary by CodeRabbit
TimeSeriesChart
component to dynamically adjust thedomain
property based on the selected chart type, improving chart rendering flexibility for users.