Skip to content

Commit

Permalink
types: add some types to generateCategoricalChart (#4535)
Browse files Browse the repository at this point in the history
<!--- Provide a general summary of your changes in the Title above -->

## Description

<!--- Describe your changes in detail -->
silly PR with a few type additions in the generate function

## Related Issue

<!--- This project only accepts pull requests related to open issues -->
<!--- If suggesting a new feature or change, please discuss it in an
issue first -->
<!--- If fixing a bug, there should be an issue describing it with steps
to reproduce -->
<!--- Please link to the issue here: -->

## Motivation and Context

<!--- Why is this change required? What problem does it solve? -->
I can't do anything else helpful!

## How Has This Been Tested?

<!--- Please describe in detail how you tested your changes. -->
<!--- Include details of your testing environment, and the tests you ran
to -->
<!--- see how your change affects other areas of the code, etc. -->

## Screenshots (if appropriate):

## Types of changes

<!--- What types of changes does your code introduce? Put an `x` in all
the boxes that apply: -->

- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to change)

## Checklist:

<!--- Go over all the following points, and put an `x` in all the boxes
that apply. -->
<!--- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->

- [ ] My change requires a change to the documentation.
- [ ] I have updated the documentation accordingly.
- [ ] I have added tests to cover my changes.
- [ ] I have added a storybook story or extended an existing story to
show my changes

Co-authored-by: Coltin Kifer <ckifer@amazon.com>
  • Loading branch information
ckifer and Coltin Kifer committed May 16, 2024
1 parent 85b29df commit 9e8f254
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/chart/generateCategoricalChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -853,7 +853,7 @@ export const generateCategoricalChart = ({
const { numericAxisName, cateAxisName } = getAxisNameByLayout(layout);
const hasBar = hasGraphicalBarItem(graphicalItems);

const formattedItems = [] as any[];
const formattedItems: any[] = [];

graphicalItems.forEach((item: ReactElement, index: number) => {
const displayedData = getDisplayedData(props.data, { graphicalItems: [item], dataStartIndex, dataEndIndex });
Expand Down Expand Up @@ -968,7 +968,17 @@ export const generateCategoricalChart = ({
* @return {Object} state New state to set
*/
const updateStateOfAxisMapsOffsetAndStackGroups = (
{ props, dataStartIndex, dataEndIndex, updateId }: any,
{
props,
dataStartIndex,
dataEndIndex,
updateId,
}: {
props: CategoricalChartProps;
dataStartIndex?: number;
dataEndIndex?: number;
updateId: number;
},
prevState?: CategoricalChartState,
): any => {
if (!validateWidthHeight({ props })) {
Expand Down Expand Up @@ -1047,7 +1057,7 @@ export const generateCategoricalChart = ({
stackOffset: 'none',
barCategoryGap: '10%',
barGap: 4,
margin: { top: 5, right: 5, bottom: 5, left: 5 } as Margin,
margin: { top: 5, right: 5, bottom: 5, left: 5 },
reverseStackOrder: false,
syncMethod: 'index',
...defaultProps,
Expand Down

0 comments on commit 9e8f254

Please sign in to comment.