rfellows opened a new pull request, #10148: URL: https://github.com/apache/nifi/pull/10148
<!-- Licensed to the Apache Software Foundation (ASF) under one or more --> <!-- contributor license agreements. See the NOTICE file distributed with --> <!-- this work for additional information regarding copyright ownership. --> <!-- The ASF licenses this file to You under the Apache License, Version 2.0 --> <!-- (the "License"); you may not use this file except in compliance with --> <!-- the License. You may obtain a copy of the License at --> <!-- http://www.apache.org/licenses/LICENSE-2.0 --> <!-- Unless required by applicable law or agreed to in writing, software --> <!-- distributed under the License is distributed on an "AS IS" BASIS, --> <!-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --> <!-- See the License for the specific language governing permissions and --> <!-- limitations under the License. --> # Summary [NIFI-14800](https://issues.apache.org/jira/browse/NIFI-14800) ### Changes Made: **1. Enhanced `formatInteger` method in `NiFiCommon` service:** - **Purpose:** Solve y-axis label clipping issues in charts when displaying large numbers - **Implementation:** - Numbers ≥ 100,000 now use compact notation via `Intl.NumberFormat` with `notation: 'compact'` - Shows up to 2 decimal places for precision (`maximumFractionDigits: 2`) - Numbers < 100,000 continue using existing comma formatting - Examples: `100000` → `"100K"`, `1250000` → `"1.25M"`, `2750000000` → `"2.75B"` **2. Comprehensive test coverage:** - **Added:** new test cases covering: - Small numbers with comma formatting (0 to 99,999) - Large numbers with compact notation (≥ 100,000) - Negative number handling - Edge cases around the 100,000 threshold - Very large numbers (billions, trillions) ### Impact: This change directly addresses chart label clipping issues by making large integer labels significantly shorter while maintaining readability. The status history chart component will automatically benefit from this improvement since it uses the `formatInteger` method through its formatters. #### Before (labels aren't quite long enough to force clipping, but big enough to convey the idea) <img width="895" height="741" alt="Screenshot 2025-07-29 at 13 17 23" src="https://github.com/user-attachments/assets/b04df586-e7f1-482f-8295-5b488fb2238a" /> #### After abbreviating the y axis labels <img width="897" height="740" alt="Screenshot 2025-07-29 at 13 17 14" src="https://github.com/user-attachments/assets/7c8906bf-7cd1-4c1f-87bc-a0a025e9624c" /> -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
