Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[IMP] chart: improve pie chart #3545

Closed
wants to merge 1 commit into from

Conversation

anhe-odoo
Copy link
Contributor

@anhe-odoo anhe-odoo commented Jan 29, 2024

Task Description

The aims of this task is to improve the user experience when creating a pie chart :

  1. User can now plot a chart only based on the count of string occurrences
  2. When hovering a pie part, the corresponding dataset are highlighted
  3. When hovering a legend item, the corresponding pie part are highlighted

Related Task:

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 Jan 29, 2024

@anhe-odoo anhe-odoo force-pushed the master-chart-improvements-anhe branch 4 times, most recently from 949e009 to 7029aaf Compare February 1, 2024 12:59
@anhe-odoo anhe-odoo changed the title wip [IMP] chart: improve pie chart Feb 1, 2024
@anhe-odoo anhe-odoo force-pushed the master-chart-improvements-anhe branch from 7029aaf to 48e60fd Compare February 1, 2024 13:27
Copy link
Contributor

@hokolomopo hokolomopo left a comment

Choose a reason for hiding this comment

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

ChartJS sounds like black magic 🧙

Do you think it would simplify things if instead of highlighting the hovered pie part by making every other part transparent, you would use "easier" chartJs features to make the hovered items darker/add a border/make in bigger (this ) ?

You'd still need to do magic when hovering the legend tho...

src/components/side_panel/components/checkbox/checkbox.xml Outdated Show resolved Hide resolved
src/helpers/figures/charts/chart_factory.ts Outdated Show resolved Hide resolved
src/helpers/figures/charts/pie_chart.ts Outdated Show resolved Hide resolved
src/helpers/figures/charts/pie_chart.ts Outdated Show resolved Hide resolved
src/helpers/figures/charts/pie_chart.ts Outdated Show resolved Hide resolved
@anhe-odoo anhe-odoo force-pushed the master-chart-improvements-anhe branch 2 times, most recently from 33365e8 to 65708b2 Compare February 6, 2024 15:19
src/helpers/color.ts Outdated Show resolved Hide resolved
@anhe-odoo anhe-odoo force-pushed the master-chart-improvements-anhe branch from 65708b2 to bb60e10 Compare February 9, 2024 16:25
Copy link
Collaborator

@LucasLefevre LucasLefevre left a comment

Choose a reason for hiding this comment

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

would it be possible to split the 3 points in 3 different commits ?
It's easier to review now and for the future as well in case we need to dig in the history

src/helpers/figures/charts/bar_chart.ts Show resolved Hide resolved
src/helpers/figures/charts/chart_ui_common.ts Outdated Show resolved Hide resolved
@@ -197,6 +204,56 @@ export class PieChart extends AbstractChart {
const definition = this.getDefinitionWithSpecificDataSets(dataSets, labelRange);
return new PieChart(definition, this.sheetId, this.getters);
}

highlightItem(index: number, dataSets) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

can dataset be typed?

Copy link
Collaborator

@LucasLefevre LucasLefevre left a comment

Choose a reason for hiding this comment

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

Some comments/suggestions on the first commit :)

The second commit looks like a lot of code for a limited value. I also don't really understand why the datasets should be highlighted for pie charts but not other charts.
I think I'd cancel this part (see message in the task chatter)

src/helpers/figures/charts/chart_factory.ts Outdated Show resolved Hide resolved
src/helpers/figures/charts/chart_factory.ts Outdated Show resolved Hide resolved
src/helpers/figures/charts/chart_factory.ts Show resolved Hide resolved
src/helpers/figures/charts/chart_ui_common.ts Outdated Show resolved Hide resolved
src/helpers/figures/charts/chart_ui_common.ts Outdated Show resolved Hide resolved
src/helpers/figures/charts/chart_ui_common.ts Outdated Show resolved Hide resolved
src/helpers/figures/charts/chart_ui_common.ts Outdated Show resolved Hide resolved
@anhe-odoo anhe-odoo force-pushed the master-chart-improvements-anhe branch 2 times, most recently from 7152909 to 95f249b Compare March 4, 2024 11:51
src/helpers/figures/charts/chart_ui_common.ts Outdated Show resolved Hide resolved
src/helpers/figures/charts/chart_ui_common.ts Outdated Show resolved Hide resolved
src/helpers/figures/charts/chart_factory.ts Outdated Show resolved Hide resolved
@anhe-odoo anhe-odoo force-pushed the master-chart-improvements-anhe branch from 95f249b to a1af3af Compare March 7, 2024 09:12
Comment on lines 100 to 105
const zone = toUnboundedZone(this.dataSeriesRanges[0]);
disabled =
zone.left !== undefined &&
zone.right !== undefined &&
zone.left === zone.right &&
this.labelRange === this.dataSeriesRanges[0];
Copy link
Collaborator

Choose a reason for hiding this comment

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

actually, I'm not sure why we should prevent the user to uncheck the aggregate.

Task Description

This commit implements the ability for the user to plot a
pie chart only based on the count of strings in the datasets. The
bar and scatter chart has also been updated to take into account
the aggregated options when changing chart type, so that the string
occurence is kept when switching chart type from the side pannel.

Related Task:

Task: 3370683
@anhe-odoo anhe-odoo force-pushed the master-chart-improvements-anhe branch from a1af3af to 5bc91df Compare March 7, 2024 10:36
Copy link
Collaborator

@LucasLefevre LucasLefevre 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+

robodoo pushed a commit that referenced this pull request Mar 7, 2024
Task Description

This commit implements the ability for the user to plot a
pie chart only based on the count of strings in the datasets. The
bar and scatter chart has also been updated to take into account
the aggregated options when changing chart type, so that the string
occurence is kept when switching chart type from the side pannel.

Related Task:

closes #3545

Task: 3370683
Signed-off-by: Lucas Lefèvre (lul) <lul@odoo.com>
@robodoo robodoo closed this Mar 7, 2024
@robodoo robodoo added the 17.2 label Mar 7, 2024
@fw-bot fw-bot deleted the master-chart-improvements-anhe branch March 21, 2024 12:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants