Skip to content

Conversation

hokolomopo
Copy link
Contributor

Description

We have a "Smart chart engine" that automatically suggests a chart type and configuration based on the selected data. There were a bunch of issues with it:

  • some selected columns were sometime missing from the chart definition
  • the chart created was sometime empty
  • the order of the selected columns has totally ignored, leading to some strange definitions with a dataset [col1, col3] and labels on col2
  • we used a createBaseChart helper that casted an object into a ChartDefinition, skipping the typing and leading to wrong chart definitions with missing properties.
  • some rules were strange or inconsistent

This commit fixes those issues, making the rules simpler and more consistent, while adding some docstring to explain the desired behavior.

Task: 5079093

review checklist

  • feature is organized in plugin, or UI components
  • support of duplicate sheet (deep copy)
  • in model/core: ranges are Range object, and can be adapted (adaptRanges)
  • in model/UI: ranges are strings (to show the user)
  • undo-able commands (uses this.history.update)
  • multiuser-able commands (has inverse commands and transformations where needed)
  • new/updated/removed commands are documented
  • exportable in excel
  • translations (_t("qmsdf %s", abc))
  • unit tested
  • clean commented code
  • track breaking changes
  • doc is rebuild (npm run doc)
  • status is correct in Odoo

@robodoo
Copy link
Collaborator

robodoo commented Oct 3, 2025

Pull request status dashboard

We have a "Smart chart engine" that automatically suggests a chart
type and configuration based on the selected data. There were a bunch
of issues with it:

- some selected columns were sometime missing from the chart definition
- the chart created was sometime empty
- the order of the selected columns has totally ignored, leading to some
strange definitions with a dataset [col1, col3] and labels on col2
- we used a `createBaseChart` helper that casted an object into a
`ChartDefinition`, skipping the typing and leading to wrong chart
definitions with missing properties.
- some rules were strange or inconsistent

This commit fixes those issues, making the rules simpler and more
consistent, while adding some docstring to explain the desired
behavior.

Task: 5079093
@hokolomopo hokolomopo force-pushed the 19.0-fix-smart-chart-engine-adrm branch from c3d8484 to 92d88a7 Compare October 10, 2025 10:14
Copy link
Collaborator

@pro-odoo pro-odoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

robodoo r+

Comment on lines +100 to +107
/**
* Builds a chart definition for a single column selection. The logic to detect the chart type is as follows:
* - If the column contains a single cell, create a scorecard.
* - If the column type is "percentage", create a pie chart.
* - If the column type is "text", create a pie chart
* - If the column type is "date", create a line chart.
* - Otherwise, create a bar chart.
*/
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice !

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