Skip to content

[IMP] chart: add zoom interactivity #6046

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

anhe-odoo
Copy link
Contributor

@anhe-odoo anhe-odoo commented Mar 27, 2025

Task Description

This PR aims to add the possibility to zoom/pan in a chart. Two
ways of manipulating the chart have been add :

  1. By ctrl+scrolling on a chart and then ctrl+click+move
  2. With the dedicated component

The zoom interactivity can be enabled by the config panel on line,
scatter, bar and combo chart. The dedicated component should be
activated with the "zoom" icon on the chart, next to the menu icon,
which is only visible if the "zoom" option is activated in the
config menu.

Related Task

  • Task: 4609219

@robodoo
Copy link
Collaborator

robodoo commented Mar 27, 2025

Pull request status dashboard

@anhe-odoo anhe-odoo force-pushed the master-chart-add_zoom_slider-anhe branch 3 times, most recently from 9a3134f to 00a838f Compare April 2, 2025 08:50
@anhe-odoo anhe-odoo force-pushed the master-chart-add_zoom_slider-anhe branch from 00a838f to 7b6524f Compare April 4, 2025 08:07
@anhe-odoo anhe-odoo force-pushed the master-chart-add_zoom_slider-anhe branch 2 times, most recently from 761856b to 2ebab79 Compare April 23, 2025 09:18
@anhe-odoo anhe-odoo force-pushed the master-chart-add_zoom_slider-anhe branch from 2ebab79 to 0664fd5 Compare April 28, 2025 12:55
style="margin-right:2.5rem!important">
<div class="d-flex">
<div class="o-figure-menu-item mx-1" t-on-click="resetZoom">
<t t-call="o-spreadsheet-Icon.HOME"/>
Copy link
Collaborator

Choose a reason for hiding this comment

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

I would display this icon only if the chart is zoomed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I totally agree, but (at the moment) the "is zoomed" state is something that is only known in the ZoomableChartJs component, and there is no ways to get the information in the figure as it's not stored in any definition or runtime :/
I can add something to get the information, but I'm not sure it will be clean :/

@@ -50,7 +51,7 @@ chartSidePanelComponentRegistry
design: ChartWithAxisDesignPanel,
})
.add("combo", {
configuration: GenericChartConfigPanel,
configuration: ComboConfigPanel,
Copy link
Collaborator

Choose a reason for hiding this comment

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

would it be worth introducing a GenericZoomableChartConfigPanel?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure, as the only "new" config panel is for the ComboBox, so it will be introducing this one only for one chart type. What do you think ?

@anhe-odoo anhe-odoo force-pushed the master-chart-add_zoom_slider-anhe branch 3 times, most recently from 57d68ed to 6810f8e Compare May 12, 2025 15:21
@anhe-odoo anhe-odoo force-pushed the master-chart-add_zoom_slider-anhe branch 5 times, most recently from b872295 to 1a4da18 Compare May 19, 2025 11:41
@anhe-odoo anhe-odoo force-pushed the master-chart-add_zoom_slider-anhe branch 2 times, most recently from 922fea0 to 347b6f2 Compare June 17, 2025 09:22
@anhe-odoo anhe-odoo force-pushed the master-chart-add_zoom_slider-anhe branch 4 times, most recently from ec29382 to 918ec52 Compare June 23, 2025 08:22
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.

Heyo 👋

didn't read the test 🙃

Comment on lines 42 to 43
for (const axisId of __ZOOMABLE_AXIS_IDS__) {
if (limits[axisId]) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
for (const axisId of __ZOOMABLE_AXIS_IDS__) {
if (limits[axisId]) {
for (const axisId in limits) {

no ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated with an else clause no that limits can be undefined too :)

Comment on lines 22 to 28
const zoom = {
...definition.zoom,
enabled,
};
if (enabled) {
zoom.sliceable = true;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

ther's no need for both zoom.sliceable and zoom.enable no ? And if there's a need for both, why is there a single checkbox to handle two booleans ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because the idea of the zoom.enable if that the dashboard maker decide that this chart should be zoomable or not in the dashboard. The zoom.sliceable is there when the dashboard/spreadsheet decide to show the slicer. So there is one checkbox to handle zoom.enable, and one button on the chart to show the slicer

isInvalid="isLabelInvalid"
onSelectionChanged.bind="onLabelRangeChanged"
onSelectionConfirmed.bind="onLabelRangeConfirmed"
options="this.getLabelRangeOptions()"
Copy link
Contributor

Choose a reason for hiding this comment

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

shouldn't the checkbox be with the other label range options ? Or in the design panel ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

TBC but this has been discussed with FRGI

@anhe-odoo anhe-odoo force-pushed the master-chart-add_zoom_slider-anhe branch 5 times, most recently from 3f0bcf0 to 80afaa2 Compare July 3, 2025 10:48
@anhe-odoo anhe-odoo force-pushed the master-chart-add_zoom_slider-anhe branch from 80afaa2 to aef12da Compare July 22, 2025 07:07
@anhe-odoo anhe-odoo force-pushed the master-chart-add_zoom_slider-anhe branch from aef12da to 972bc19 Compare July 24, 2025 11:49
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.

partial review because I have a question 😉

I don't really see why we couldn't move all the configuration changes (getDetailChartConfiguration, etc.) and the slicer config to the plugins (within and along side getChartRuntime), with a few UI commands to update the limits.
Is there something based on something chartJs computes that we couldn't give to the plugins ?

@anhe-odoo anhe-odoo force-pushed the master-chart-add_zoom_slider-anhe branch 7 times, most recently from 9006818 to a728b19 Compare July 31, 2025 13:38
Task Description

This PR aims to add the possibility to zoom/pan in a chart, within
a dedicated component, in the form of a Master/Detail chart.

The zoom interactivity can be enabled in the design panel on line,
scatter, bar and combo chart.

Related Task

Task: 4609219
@anhe-odoo anhe-odoo force-pushed the master-chart-add_zoom_slider-anhe branch from a728b19 to 1ff1184 Compare August 1, 2025 12:20
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.

4 participants