Skip to content

Conversation

@anhe-odoo
Copy link
Contributor

@anhe-odoo anhe-odoo commented Oct 16, 2025

Task Description

This commit aims to add the possibility for the user to customize the axes scale (linear vs logarithmic type and mix/max values) for linear scale. We also add the possibility to show/hide major and minor gridlines (minor gridlines being only available for linear scale and line/scatter chart (for x axis), while available for bar/line/scatter/combo chart for both y axes.

Related Task

@robodoo
Copy link
Collaborator

robodoo commented Oct 16, 2025

Pull request status dashboard

@anhe-odoo anhe-odoo force-pushed the master-chart-add_scale_customization-anhe branch 2 times, most recently from 59e8688 to 5e593d6 Compare October 20, 2025 08:54
Task Description

This commit aims to add the possibility for the user to customize
the axes scale (linear vs logarithmic type and mix/max values) for
linear scale. We also add the possibility to show/hide major and
minor gridlines (minor gridlines being only available for linear
scale and line/scatter chart (for x axis), while avalaible for
bar/line/scatter/combo chart for both y axes.

Related Task

Task: 5159370
This commit extends the axis customization to date type x scale

Task: 5159370
@anhe-odoo anhe-odoo force-pushed the master-chart-add_scale_customization-anhe branch from 5e593d6 to b807af0 Compare October 21, 2025 14:23
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.

👋

Scroll scroll

Cool feature! Not what the spec was tho, so let's talk with François sometime 🙂

return undefined;
}
if (this.isTimeAxis) {
const timestamp = this.getTimestampFromInput(input);
Copy link
Contributor

Choose a reason for hiding this comment

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

You should really convert that to a spreadsheet date number (1 is 1/1/0900) - not a js timestamp. If I add a limit then remove the date format, I get an huge value that doesn't make sense (eg. 1756425600000). If you use spreadsheet date numbers, it would make sense even after removing the format.

import { LineChartDefinition, LineChartRuntime } from "./line_chart";

export interface ScatterChartDefinition
extends Omit<LineChartDefinition, "type" | "stacked" | "cumulative"> {
Copy link
Contributor

Choose a reason for hiding this comment

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

Uh ? scatter cahrts are not zoomable ? I did a fix and all for zoomable scatter charts https://www.odoo.com/odoo/2328/tasks/5143146

Why change that? And why in this task ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was discussed with FRGI. We decided to remove the zoom of the scatter chart because in a scatter it's strange to be able to zoom on the x axis but not on the y-axis, and therefore this task to set the min and max value of the scatter chart axes make the zoom slicer useless ...
We can discuss this once again but it's not something I decided "dans mon coin" :/

Copy link
Contributor

Choose a reason for hiding this comment

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

That's fine then, but do it in a separate task :) And maybe in 19.0 where the zoom was introduced ?

readonly min?: number;
readonly max?: number;
readonly scaleType?: AxisScaleType;
readonly grid?: AxisGridDesign;
Copy link
Contributor

Choose a reason for hiding this comment

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

nitpick: probably more clear to have a boolean showMajor/minorGridLine rather than design.grid.major

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Then what about a showGrid that can be "major", "minor", "none" or "both" ?

Copy link
Contributor

Choose a reason for hiding this comment

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

I'd put something more explicit for both like minorAndMajor, but yeah that sounds good :)

@@ -0,0 +1,69 @@
import { Chart } from "chart.js";
Copy link
Contributor

Choose a reason for hiding this comment

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

Are minor grid line really not a default chartjs option ? Idk if it's worth doing a plugin for that, IMO minor grid lines are kinda useless

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Minor gridline is really usefull in a scatter chart and is a features GSheet and Excell both have ... Anyway, we can make it in another way with more ticks and some tikslabel being undefined/empty if you dont want the plugin.

Copy link
Contributor

Choose a reason for hiding this comment

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

If Francois thinks it's interesting let's do it 🤷

Side note (not sure if I already mentioned it) but the color you chose for minor grid lines is barely visible on my low-luminosity/contrast screen

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