Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for big number in the card and chart components #85

Open
wants to merge 21 commits into
base: main
Choose a base branch
from

Conversation

OrlandoP97
Copy link

Use gxBigNumber for charts and card data manipulation

@ncamera ncamera self-requested a review May 2, 2024 20:21
Copy link
Collaborator

@ncamera ncamera left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the improvements! In addition to the requested changes, did you test this change in GeneXus using the Angular Generator with some queries? It would be good to check the new behavior in a e2e case.

package.json Outdated
@@ -67,6 +67,7 @@
"dependencies": {
"@genexus/reporting-api": "~3.1.0",
"@genexus/web-controls-library": "2.3.0",
"@genexus/web-standard-functions": "file:///C:/PROJECTS/genexus/web-standard-functions/dist/lib-esm",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be a peer dependency to not force the version in this repo. Also, this should point to @genexus/web-standard-functions

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great! I did this because I understood that could be necesary to modify some web-standard-function code before start working, but actually it wasn't so I will remove that. Thanks!

@@ -302,13 +306,15 @@ const showDataAsMapping: {
// @todo Complete the implementation of this function by comparing it to the Web implementation
export function valueOrPercentage(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[valueOrPercentage] It would be nice to add some tests using this utility with different values to validates the new behavior.

@@ -1524,7 +1524,7 @@ function groupPoints(
dateStr: null,
name: null
};
let pointAdd: { x: string; y: number; name: string };
let pointAdd: { x: string; y: GxBigNumber; name: string };
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[groupPoints] It would be nice to add some tests using this utility with different values to validates the new behavior.

@@ -512,7 +513,7 @@ function aggregatePoints(chartSerie: QueryViewerChartSerie) {
});
const value = aggregate(
chartSerie.Aggregation,
currentYValues,
currentYValues.map(val => new GxBigNumber(val)),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[aggregatePoints] It would be nice to add some tests using this utility with different values to validates the new behavior.

@@ -122,76 +125,94 @@ function evaluate(

const aggregateMap: {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[aggregateMap] It would be nice to add some tests using this utility with different values to validates the new behavior.

Comment on lines +198 to +203
) => {
return aggregateMap[aggregation || QueryViewerAggregationType.Sum](
values,
quantities
);
};
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
) => {
return aggregateMap[aggregation || QueryViewerAggregationType.Sum](
values,
quantities
);
};
) =>
aggregateMap[aggregation || QueryViewerAggregationType.Sum](
values,
quantities
);

Comment on lines 169 to 171
) => {
return new GxBigNumber(quantities.reduce((a, b) => a + b, 0));
},
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
) => {
return new GxBigNumber(quantities.reduce((a, b) => a + b, 0));
},
) => new GxBigNumber(quantities.reduce((a, b) => a + b, 0));

values,
quantities
);
};

function aggregateDatum(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[aggregateDatum] It would be nice to add some tests using this utility with different values to validates the new behavior.

Comment on lines 169 to 171
) => {
return new GxBigNumber(quantities.reduce((a, b) => a + b, 0));
},
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
) => {
return new GxBigNumber(quantities.reduce((a, b) => a + b, 0));
},
) =>
new GxBigNumber(quantities.reduce((a, b) => a + b, 0));

Copy link
Author

@OrlandoP97 OrlandoP97 May 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Nico, thanks for the review!, I was actually tryng to upload a created branch, so this way to be able to collaborate in the feature, but I couldn't do it. Maybe I need some permissions?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've sent you an invitation.

@ncamera ncamera added feature Feature implementation pull request risky Identifies a PR that has a level of risk to merging target: minor This PR is targeted for the next minor release refactoring Issue that involves refactoring or code-cleanup labels May 2, 2024
@ncamera ncamera changed the title Feature/gx big number Add support for big number in the card and chart components May 2, 2024
OrlandoP97 and others added 18 commits May 3, 2024 16:33
Labels and tooltips of the charts now show data as string wihout parsing, showing more precision
- aggregateMap
- aggregateDatum
- groupPoints
- aggregatePoints
- valueOrPercentage
- Update calculate function, to handle operator precedence with custom BigNumber operations
- Add Test for calculate function
- Add aggregateDatum tests when isFormula and Sum
- Add aggregateDatum tests when isFormula and Count
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Feature implementation pull request refactoring Issue that involves refactoring or code-cleanup risky Identifies a PR that has a level of risk to merging target: minor This PR is targeted for the next minor release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants