From 36adc6869d8c4a1edb4f4f317191c3e1f325faf5 Mon Sep 17 00:00:00 2001 From: Jordan <51442161+JordanSh@users.noreply.github.com> Date: Mon, 6 Dec 2021 13:26:00 +0200 Subject: [PATCH] Fixing top resources at risk chart (#36) --- .../compliance_charts/resources_at_risk_chart.tsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/x-pack/plugins/security_solution/public/cloud_posture/pages/compliance_dashboard/compliance_charts/resources_at_risk_chart.tsx b/x-pack/plugins/security_solution/public/cloud_posture/pages/compliance_dashboard/compliance_charts/resources_at_risk_chart.tsx index 95a191a97b963..80402ce3594d3 100644 --- a/x-pack/plugins/security_solution/public/cloud_posture/pages/compliance_dashboard/compliance_charts/resources_at_risk_chart.tsx +++ b/x-pack/plugins/security_solution/public/cloud_posture/pages/compliance_dashboard/compliance_charts/resources_at_risk_chart.tsx @@ -41,6 +41,8 @@ export const ResourcesAtRiskChart = () => { ); }; + const top5 = resources.length > 5 ? resources.slice(0, 5) : resources; + return ( { `${Number(d * 100).toFixed(0)} %`, }} - id="bars" - name="0" - data={resources} - xAccessor={'name'} + id="resources-at-risk-bars" + data={top5} + xAccessor={'resource'} yAccessors={['value']} splitSeriesAccessors={['evaluation']} stackAccessors={['evaluation']}