Charts, Export, add some preferences to define the bitmap image files export dimensions in pixels
Add some user global preferences to manage the printing or displaying dimensions/Megapixels of the bitmap files produced by the commands “Export\Chart…” and “Export view”.
The UI should shows to the user what dimensions in centimeters will be optimum according to user selected width in pixels and DPI.
See: https://pixelcalculator.com/fr
Solution 1
Store some user preferences “charts_export_pixels_width” and “charts_export_dpi_resolution” at ChartsEngine level.
In RCP preference page
Set these writable fields:
Pixels Width
integer field, default value: based on user screen?, max value: 8K = 7680 px?DPI
list of values: 72, 96, 150, 300, 400, 600
[SLH suggestions (less technical terminology)]
name “Pixels Width” ->“Image Width” + tooltip “Image Width in Pixels”name “DPI” ->“Display Density” + tooltip “Image Display Pixels Density in DPI”
Set these read-only fields:
Width in centimetersHeight in centimeters
[SLH suggestions]
name “Width” ->“Image Display Width” + tooltip “Image Display Width in centimeters”name “Height” ->“Image Display Height” + tooltip “Image Display Height in centimeters”
When changing value of the “Pixels Width” field, compute width and height according to the width and the selected DPI and fill the fields “Width in centimeters” and “Height in centimeters”.
[SLH suggestion]
-
name the writable/readable fields groups:-
InputImage WidthDisplay Density
-
OutputImage Display WidthImage Display Height
-
Solution 2
Since the export purpose is to display a chart on a screen or to print it, it may be better to permit to set the final width in centimeters according to the selected DPI resolution.
Store some user preferences “charts_export_width_in_centimeters” and “charts_export_dpi_resolution” at ChartsEngine level.
Therefore the fields may become:
- Display or print width from DPI (writable)
- DPI Resolution (writable)
and the field “Pixels Width” will become readable only and computed from the 2 others fields, to inform the user.
Unfortunately, it’s not possible to automatically retrieve the DPI screen resolution.
French example:
Propriétés des graphiques exportés
Résolution (en DPI) : 72, 96, 150, 300, 400, 600
Largeur d’affichage ou d’impression souhaitée (en centimètres) : 13
Largeur de l’image exportée en pixels : 1 535
[SLH suggestion]
- Input
- Image Display Width
- Display Density
- Output
- Image Display Height
- Image Width
[Update 2024-07-05, Chosen labels, tooltips, default values and min/max values]
- Preferences group label:
- Exported charts properties / Propriétés des graphiques exportés
- Width (cm) / Largeur (cm)
- default: 11
- min/max: 1 / 300
- tooltip: Display or print width in centimeters / Largeur d'affichage ou d'impression souhaitée en centimètres
- Resolution (DPI) / Résolution (DPI)
- default: 300
- list: 72, 96, 150, 300, 400, 600, 1200
- tooltip: Output resolution in DPI / Résolution de sortie en DPI
- Exported width (pixels) / Largeur exportée (pixels)
- Exported image width in pixels / Largeur de l'image exportée en pixels
Notes
For command “Export view”
The current behavior is to produced a file with the same dimensions of pixels than the chart windows pixels dimensions that is displayed on the screen.
The height must be computed according to “Pixels Width” preference and the original chart windows aspect ratio.
For command “Export\Chart…”
The current behavior is to produced a file with pixels dimensions of 1024 x 576.
We can use the “Pixels Width” preference to manage the width exported file width but since we do not have a chart windows we can not compute a height based on the viewed chart.
Need to specify how to compute the height.
Using a “Pixels Height” preference doesn’t seems to be the best solution.
A better solution may be to use the aspect ratio of the user screen resolution to compute the height.
[SLH]
+1 for ‘Aspect Ratio’ preference but the aspect ratio may change between results:
16/9 for Progression4/3 or 1/1 for AFC (planes)etc.
Provide several aspect ratio preferences for results groups?
Popular aspect ratios: and Widescreen.org.Wikipedia
NOTE: the behavior seems to have changed using JFC Charts Engine since we store now the chart object (maybe since 0.8.0). Therefore, if the chart has been zoomed, etc., “Export\Chart…” will export the chart as is.
Mixed preference"
If we use the same fields and preference page for the 2 commands, it may confuse the user.
Especially if we use a “Pixels Height” preference that should not be used by “Export view”. The purpose of the “Pixels width” value when using this command is only to scale the entire image but not to change its aspect ratio.
[SJ, 2024-06-21]
The "Export chart" command and aspect ratio concerns have been moved to this issue: #4004.
(from redmine: issue id 3483, created on 2023/10/27 by Sebastien Jacquot)
Implemented solution (2024-06-21)
NOTE: Finally, it appeared very more useful to define some DPI + Width in centimeters rather than DPI + Width in pixels. Actually, it seems more interesting that the user defines a quality value (DPI) according to some real world dimension values: expected centimeters on a sheet or on a screen. The solution 2 has been implemented.
The export preferences "DPI", "Width in centimeters" and "Width in pixels" have been implemented. The behavior of the command chain is:
- get the user definition of "DPI" and "Width in centimeters" values (or default values)
- compute the "Width in pixels" values according to the DPI and centimeters (DPI * centimeters / 1 inch)
- scale the chart according to the computed "Width in pixels" value keeping the user chart window/editor aspect ratio