-
Notifications
You must be signed in to change notification settings - Fork 47
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
[REF] charts: revamp chart management #1373
Conversation
54f78c0
to
1633074
Compare
9de8fa1
to
d49c165
Compare
d49c165
to
e2bb14e
Compare
Some work to do in Odoo:
|
e2bb14e
to
1c6f829
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Coucou first review :)
Really nice split
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fast-ish review, I didn't really check the tests
src/components/side_panel/chart/main_chart_panel/main_chart_panel.ts
Outdated
Show resolved
Hide resolved
eed9c64
to
0a58519
Compare
38bef89
to
895f021
Compare
0a58519
to
e159fd7
Compare
895f021
to
b544dfe
Compare
e159fd7
to
4dffb5d
Compare
Add task id |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
going to miam miam 🍔
The CSS to transform text overflow in menus to ellipsis wasn't working. The sub-menu arrow was also not displayed if the name of the menu was too long Odoo task 2877337 closes #1403 Signed-off-by: Lucas Lefèvre (lul) <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My current remaining comments - lul pointed out some of them. Don't want him to negate my review completely :p
get chartRuntime(): ChartJSRuntime { | ||
const runtime = this.env.model.getters.getChartRuntime(this.props.figureId); | ||
if (!("type" in runtime)) { | ||
throw new Error("Unsupported chart runtime"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't have a suggetion but I don't like that we rely on the presence of a key to decide that, specifically this key. This means taht type exists on all ChartDefinition and all ChartConfiguration but the one of gauge (and potentially the ones from Odoo but I think they'll be chartJs as well)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not have a better solution, actually this chart is instantiate based on a matching so...
} | ||
|
||
const GraphColors = [ | ||
// the same colors as those used in odoo reporting |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unrelated but I am again surprised that a graph color does not match its range in the seletction input).
src/components/side_panel/chart/main_chart_panel/main_chart_panel.xml
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some useless key checks and useless if
statements
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good opportunity to add readonly
everywhere for new/moved types
src/types/chart/gauge_chart.ts
Outdated
rangeMin: string; | ||
rangeMax: string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could they be parsed to numbers earlier to avoid casting to number basically everywhere they are used ?
No need to pass the array of ranges and the index, just give the range. Also, sheetId is useless since it's already in the range closes #1402 Signed-off-by: Pierre Rousseau (pro) <[email protected]>
29c01a4
to
edfcee6
Compare
Add scorecard chart ------------------- Add "Scorecard" chart type. Create new getters in chart.ts and evaluation_chart.ts specific for this type of chart. The chart itself is not a ChartJS chart, but is a standard Component with hand-written logic for scaling the font sizes. Some work should be done at a latter date in the chart plugins to better handle all types of chart and avoid the repeated if/else. Add gauge chart --------------- Gauge chart based on "chartjs-gauge" library Revamp chart management ----------------------- Since the addition of scorecard and gauge chart, it becomes a mess to manage different types of charts. There is a duplication of many concepts, like getters (getBasicChartDefinition, getGaugeChartDefinition, ...), local state (charts, scorecard, gauge), ... In addition, it was not possible to add a new type of chart from outside o-spreadsheet (for example add Odoo charts). This commit introduce something similar to cellFactory => a chart Factory. Based on the type of the chart in the definition of a chart, an instance of a Chart is created and stored in the local state of chart core plugin. A Chart is an instance of a class (which inherits from AbstractChart), which implements some functions that will be called from the plugin. For each Chart class, a Chart Runtime class should be created to compute the runtime data needed by the components. A Side panel should also be created (a config panel and a design panel). Odoo task 2796685 Co-authored-by: Adrien Minne <[email protected]> Co-authored-by: Alexis Lacroix <[email protected]>
edfcee6
to
503c0a9
Compare
Will be done here: #1393 |
Description:
Since the addition of scorecard and gauge chart, it becomes a mess to
manage different types of charts. There is a duplication of many concepts,
like getters (getBasicChartDefinition, getGaugeChartDefinition, ...),
local state (charts, scorecard, gauge), ...
In addition, it was not possible to add a new type of chart from outside
o-spreadsheet (for example add Odoo charts).
This commit introduce something similar to cellFactory => a chart Factory.
Based on the type of the chart in the definition of a chart, an instance of
a Chart is created and stored in the local state of chart core plugin.
A Chart is an instance of a class (which inherits from AbstractChart),
which implements some functions that will be called by the plugin.
For each Chart class, a Chart Runtime class should be created to
compute the runtime data needed by the components.
A Side panel should also be created (a config panel and a design panel).
review checklist