Repository navigation
Fix gap in Y axis ticks - #83323
Fix gap in Y axis ticks#83323neil-marcellini merged 8 commits into
Conversation
Codecov Report❌ Looks like you've decreased code coverage for some files. Please write tests to increase, or at least maintain, the existing level of code coverage. See our documentation here for how to interpret this table.
|
|
cc @trjExpensify @Expensify/design, maybe you can fire up a test build and let me know what you think? |
|
Will run a test build, the screenshot you posted in the issue looks good to me though 👍 |
|
🚧 @shawnborton has triggered a test Expensify/App build. You can view the workflow run here. |
This comment has been minimized.
This comment has been minimized.
| @@ -158,16 +157,48 @@ function LineChartContent({data, title, titleIcon, isLoading, yAxisUnit, yAxisUn | |||
| // - At 45° (rotated): right-align so the last character is under the point | |||
| const renderCustomXLabels = useCallback( | |||
There was a problem hiding this comment.
We could change this name, because it covers more than labels now
|
🚧 @shawnborton has triggered a test Expensify/App build. You can view the workflow run here. |
| if (!font) { | ||
| return null; | ||
| return ( | ||
| <> |
There was a problem hiding this comment.
What do you think about extracting all pieces to separate components that could be placed in Charts/components?
E.g something like this:
type ScatterPointsProps = {
points: PointsArray;
radius: number;
color: string;
};
function ScatterPoints({points, radius, color}: ScatterPointsProps) {
return (
<>
{points.map((pt) =>
typeof pt.y === 'number' ? (
<Circle
key={`point-${pt.xValue}-${pt.yValue}`}
cx={pt.x}
cy={pt.y}
r={radius}
color={color}
/>
) : null,
)}
</>
);
}type LeftFrameLineProps = {
chartBounds: ChartBounds;
yTicks: number[];
yScale: Scale;
color: Color;
};
function LeftFrameLine({chartBounds, yTicks, yScale, color}: LeftFrameLineProps) {
const minTick = yTicks.length > 0 ? Math.min(...yTicks) : null;
const bottomY = minTick !== null ? yScale(minTick) : chartBounds.bottom;
return (
<SkiaLine
p1={vec(chartBounds.left, chartBounds.top)}
p2={vec(chartBounds.left, bottomY)}
color={color}
strokeWidth={1}
/>
);
}type LineChartXLabelProps = {
label: string;
labelWidth: number;
tickX: number;
labelY: number;
angleRad: number;
correction: number;
font: SkFont;
color: string;
};
function LineChartXLabel({label, labelWidth, tickX, labelY, angleRad, correction, font, color}: LineChartXLabelProps) {
if (angleRad === 0) {
return (
<SkiaText
x={tickX - labelWidth / 2}
y={labelY}
text={label}
font={font}
color={color}
/>
);
}
return (
<Group
origin={vec(tickX, labelY)}
transform={[{translateX: correction}, {rotate: -angleRad}]}
>
<SkiaText
x={tickX - labelWidth}
y={labelY}
text={label}
font={font}
color={color}
/>
</Group>
);
}There was a problem hiding this comment.
that's a good idea! I will do it right now
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
Sweet, looks good to me 👍 |
Great, I will apply @mateuuszzzzz review comments and make the PR ready for review |
|
From my point of view the failing tests are not connected to this PR, but will try to remerge main in a moment in order to run them again, making the PR ready for review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e38a90e458
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
@ShridharGoel this is ready for C+ review! |
|
@borys3kk Can you add the issue link in the description? Also, I think step 6 of bar chart tests needs to be updated. |
Reviewer Checklist
Screenshots/Videos |
|
@trjExpensify Can you confirm if this is fine? There's a single item which is showing above the top line, should it have a different interval size here?
|
|
🎯 @ShridharGoel, thanks for reviewing and testing this PR! 🎉 An E/App issue has been created to issue payment here: #83467. |
heyjennahay
left a comment
There was a problem hiding this comment.
Product review not required
thanks for the catch, added the issue link in the description |
I think that's okay for here and the purpose of this PR. |
|
🚧 @neil-marcellini has triggered a test Expensify/App build. You can view the workflow run here. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚀 Deployed to staging by https://github.com/neil-marcellini in version: 9.3.27-0 🚀
|
|
🚀 Deployed to production by https://github.com/blimpich in version: 9.3.27-8 🚀
|














Explanation of Change
Fixed Issues
$ #82318
PROPOSAL:
Tests
In both of the following cases check with negative value being at the bottom of the chart as well as positive (or 0)
Line chart:
Bar chart:
Offline tests
QA Steps
same as tests
// TODO: These must be filled out, or the issue title must include "[No QA]."
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
Line charts:Bar charts:
