Skip to content

Conversation

@siddhant3030
Copy link
Contributor

@siddhant3030 siddhant3030 commented Nov 1, 2025

This commit fixes two issues with horizontal bar charts:

  1. Bar names not showing: The backend transform_data_for_chart function was only returning xAxisData, but horizontal bar charts need yAxisData for the category axis (bar names).
Screenshot 2025-11-01 at 4 40 53 PM
  1. Tooltip not working on hover: With missing axis data, tooltips could not properly display when hovering over bars.

Changes:

  • Added yAxisData to all bar chart data transformation return values
  • Updated raw data bar charts to include both xAxisData and yAxisData
  • Updated aggregated bar charts (with/without extra dimension) to include both axis data arrays
  • Category data is now available for both vertical (xAxis) and horizontal (yAxis) orientations

The ECharts config generator already correctly uses yAxisData for horizontal bars (line 161), so this provides the missing data.

Files modified:

  • ddpui/core/charts/charts_service.py: Added yAxisData to transform functions for bar charts (lines 708-710, 793-797, 829-834)

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Corrected axis data handling for bar, line, and pie charts in both raw and aggregated data views.
    • Enhanced consistency of axis representation when additional dimensions are present in chart configurations.
    • Improved alignment and display of chart axes across different visualization types for accurate rendering.

This commit fixes two issues with horizontal bar charts:

1. Bar names not showing: The backend transform_data_for_chart function
   was only returning xAxisData, but horizontal bar charts need yAxisData
   for the category axis (bar names).

2. Tooltip not working on hover: With missing axis data, tooltips could
   not properly display when hovering over bars.

Changes:
- Added yAxisData to all bar chart data transformation return values
- Updated raw data bar charts to include both xAxisData and yAxisData
- Updated aggregated bar charts (with/without extra dimension) to include
  both axis data arrays
- Category data is now available for both vertical (xAxis) and horizontal
  (yAxis) orientations

The ECharts config generator already correctly uses yAxisData for
horizontal bars (line 161), so this provides the missing data.

Files modified:
- ddpui/core/charts/charts_service.py: Added yAxisData to transform
  functions for bar charts (lines 708-710, 793-797, 829-834)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@coderabbitai
Copy link

coderabbitai bot commented Nov 1, 2025

Walkthrough

The chart data transformation logic in the service layer is updated to consistently populate both xAxisData and yAxisData fields across bar, line, and pie chart types. Category data derived from x_axis values now mirrors to both axes, supporting flexible chart orientation handling.

Changes

Cohort / File(s) Change Summary
Chart Axis Data Transformation
ddpui/core/charts/charts_service.py
Modified transform_data_for_chart function to populate yAxisData alongside xAxisData using category data from x_axis values for raw and aggregated bar charts, and non-bar chart types (line/pie), enabling bidirectional axis representation

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Single file with localized changes to data transformation logic
  • Consistent pattern applied across multiple chart type branches (bar, line, pie)
  • Internal dictionary key assignments without signature modifications
  • Key consideration: verify that mirrored axis data correctly supports both vertical and horizontal chart rendering orientations and doesn't introduce unintended side effects on existing chart visualizations

Suggested reviewers

  • Ishankoradia

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title Check ✅ Passed The pull request title "Fix horizontal bar chart bar names and tooltip display" directly and accurately describes the main change in the changeset. The PR addresses two specific issues with horizontal bar charts (bar names not displaying and tooltips not functioning), which the developer fixed by adding yAxisData to the chart transformation functions. The title is concise, clear, and specific without vague terminology, making it immediately apparent to a teammate scanning the commit history what this PR accomplishes.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/horizontal-bar-chart-labels-tooltip

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov
Copy link

codecov bot commented Nov 1, 2025

Codecov Report

❌ Patch coverage is 0% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 50.98%. Comparing base (f66e388) to head (1bff626).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
ddpui/core/charts/charts_service.py 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1197      +/-   ##
==========================================
- Coverage   50.98%   50.98%   -0.01%     
==========================================
  Files          97       97              
  Lines       11824    11825       +1     
==========================================
  Hits         6029     6029              
- Misses       5795     5796       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Ishankoradia Ishankoradia merged commit 2254207 into main Nov 4, 2025
3 of 5 checks passed
@Ishankoradia Ishankoradia deleted the fix/horizontal-bar-chart-labels-tooltip branch November 4, 2025 04:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants