From 6f601d31b0ccd68c06e2c32b6eb5c8f37ca367cc Mon Sep 17 00:00:00 2001 From: Nick Amantia <92755007+nickamantia@users.noreply.github.com> Date: Wed, 1 May 2024 10:54:08 -0400 Subject: [PATCH] [PBNTR-277] fix Bar Graph axisTitle requirement (#3372) [PBNTR-277](https://nitro.powerhrg.com/runway/backlog_items/PBNTR-277) This PR allows devs to not have to pass in the `axisTitle` prop. **How to test?** Steps to confirm the desired behavior: Pull to your local and removed a `axisTitle` prop and see if the graph still loads #### Checklist: - [x] **LABELS** Add a label: `enhancement`, `bug`, `improvement`, `new kit`, `deprecated`, or `breaking`. See [Changelog & Labels](https://github.com/powerhome/playbook/wiki/Changelog-&-Labels) for details. - [x] **DEPLOY** I have added the `milano` label to show I'm ready for a review. - [ ] **TESTS** I have added test coverage to my code. --- playbook/app/pb_kits/playbook/pb_bar_graph/_bar_graph.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/playbook/app/pb_kits/playbook/pb_bar_graph/_bar_graph.tsx b/playbook/app/pb_kits/playbook/pb_bar_graph/_bar_graph.tsx index 29d62601bd..b31e1e3aff 100644 --- a/playbook/app/pb_kits/playbook/pb_bar_graph/_bar_graph.tsx +++ b/playbook/app/pb_kits/playbook/pb_bar_graph/_bar_graph.tsx @@ -102,7 +102,7 @@ const BarGraph = ({ max: yAxisMax, opposite: false, title: { - text: typeof axisTitle === 'string' ? axisTitle : axisTitle[0].name, + text: Array.isArray(axisTitle) ? (axisTitle.length > 0 ? axisTitle[0].name : null) : axisTitle, }, plotLines: typeof yAxisMin !== 'undefined' && yAxisMin !== null ? [] : [{ value: 0,