Feature #3137

Improve CAStyle macro (previously AFCWithStyles) for styling CA chart entities according to an ODS parameters file

Added by Sebastien Jacquot 2 months ago. Updated about 1 month ago.

Status:New Start date:07/20/2021
Priority:Normal Due date:
Assignee:- % Done:

0%

Category:Macros Spent time: -
Target version:TXM 0.8.3

Description

SJ: WIP issue.

Improve AFCWithStyles/CAStyle macro for styling CA chart entities according to an ODS parameters file.

Doc and Specs: https://groupes.renater.fr/wiki/txm-info/public/specs_afc#stylage_des_points
Src local Location: /src/groovy/org/txm/macro/prototypes/stats/AFCWithStylesMacro.groovy
SVN Location: https://forge.cbp.ens-lyon.fr/redmine/projects/txm/repository/changes/tmp/org.txm.groovy.core/src/groovy/org/txm/macro/prototypes/stats/CAStyleMacro.groovy

Current state (2021-07-20)

Notes:
The macro has been updated to work with the jfreechart lib update done in TXM 0.8.0.
Some styling parameters have been added.
The macro has been renamed from "AFCWithStyles" to "CAStyle".

The selections and replacements are sequential. A replacement parameter defined in a previous table row is overridden.

Filtering/selection by label

label-pattern

REGEX pattern to apply the styling

Filtering/selection threshold

Properties list: label, q12, q13, q23, mass, dist, cont1, cos2-1, cont2, cos2-2, cont3, cos2-3, c1, c2, c3

Mentioned set selection:
- whole set selection
- user defined min/max selection

Domain selection => Range styling:
- linear interpolation
- logistic
- other interpolations?
- simple value by range, eg. "0 to 10 => color = red", "11 to 200, color = blue"

// WIP
Need to report here the mails discussion.
Need to discuss about:
- simple combined selection or not (eg. label-pattern + one value, eg. q12)
- advanced combined selection or not (eg. label-pattern + one value, eg. q12 and some other eg. mass)
=> combining additional thresholds may be done with multiple ODS table rows
- selection by range
- selection by
Need to see what is doing CAFilter.groovy

Styling

The next properties can be applied to the entities that are selected by the label-pattern or by thresholds.

label-replacement

Replaces the matched label-pattern by the specified text.

hidden

If "t" or "T" (for "true"), the label and the shape will be hidden.

label-font-family

Replaces the default font by the specified font family.
// TODO: need to check what happens if the font family doesn't exist.

label-size

Applies a scaling transformation to the default font size : eg. "2 = 2 * original size" or "0.5 = half of the original size".

label-color

Replaces the default label color by the specified one in RGB or RGBA format from 0 to 255 for each channel, eg. "255 0 0 = red", "255 0 0 128 = red with mid-opacity".

label-style

Replaces the font style by the specified ones : "1 = bold", "2 = italic", "3 = bold + italic".
Some fonts may not implement all three styles.

// TODO: add a warning if a font doesn't implement the selected style.

shape-size

Applies a scaling transformation to the default shapes dimensions : eg. "3.5 = 3.5 * original dimensions" or "0.5 = half of the original dimensions"

Note, SJ: need to check the unit of the default dimensions to be more precise in the doc.

shape-color

Replaces the default shape color by the specified one in RGB or RGBA format from 0 to 255 for each channel, eg. "255 0 0 = red", "255 0 0 128 = red with mid-opacity".

shape-replacement

Replaces the default shape by the specified one from the following list: diamond, disk, square, triangle.

Improvments

label-color/shape-color

FR NOTE:
suggestion d'amélioration, combiner 2 encodages :
- si la valeur commence par '#' utiliser l'encodage hexa de la couleur (équivalent de l'actuel mais en hexa : #FF0000)
- sinon la valeur est un entier qui indexe une des couleurs de la palette à 16 couleurs de TXM définie ici https://groupes.renater.fr/wiki/txm-info/public/specs_graphics_colors

label-size

FR NOTE:
ce serait pas mieux d'utiliser les tailles xx-small, x-small, small, medium, large, x-large, xx-large de CSS ou des 'mm' ? (la taille du point étant une notion papier)
FR NOTE, SJ:
préférence pour un scalaire, qui permet d'être plus précis, ex. doubler des dimensions ou encore s'ajuster sur une valeur de seuil

shape-size

FR NOTE:
homogénéiser avec les valeurs de label-size ? (xx-small, x-small, small, medium...)
FR NOTE, SJ:
préférence pour un scalaire, qui permet d'être plus précis, ex. doubler des dimensions ou encore s'ajuster sur une valeur de seuil

shape-replacement

Could add some other shapes.

Current state bugs

- Using shape-size breaks the selection and rollover bounding box
- Using label-replacement breaks the selection and rollover bounding box
- Using shape-replacement breaks the selection and rollover bounding box

TODO

//TODO: Update the TXM users doc.

History

#1 Updated by Sebastien Jacquot 2 months ago

  • Subject changed from Improve AFCWithStyles/CAStyle macro for styling CA chart entities according to an ODS parameters file to Improve CAStyle macro (previously AFCWithStyles) for styling CA chart entities according to an ODS parameters file
  • Description updated (diff)

#2 Updated by Sebastien Jacquot 2 months ago

  • Description updated (diff)

#3 Updated by Sebastien Jacquot 2 months ago

  • Description updated (diff)

#4 Updated by Sebastien Jacquot about 1 month ago

  • Description updated (diff)

#5 Updated by Sebastien Jacquot about 1 month ago

  • Description updated (diff)

#6 Updated by Sebastien Jacquot about 1 month ago

  • Description updated (diff)

Also available in: Atom PDF