From c8dfce07ecc5f3c6ac5f07fb9b9bc4f6dbbf75dc Mon Sep 17 00:00:00 2001
From: Jacques Lebourgeois
+ Highlight values in a series with a different colour.
+ Confine tooltip
+
+ Two colours for one series
+
+ When representing data on a bar chart, it is possible to want to + represent this data with a different colour depending on a condition + on the value. For example, green for a target achieved, red + otherwise. +
+You would then need to be able to have:
++ For this example, we have chosen to put the data in two series + depending on whether or not the objective has been achieved. In this + way, the two colours are clearly visible both on the graph and in + the legend. +
++ On the other hand, this requires us to filter the values displayed + in the tooltip so as not to display the series of a target that has + not been reached when it has been reached and vice versa. +
+
+ This filter is created using getPopupContentValue() callback of the
+ externalizePopover() feature that allow us to change the displayed
+ value, and to send back undefined if we don't want the value to be
+ displayed :
+
+
+
+ themeManager.externalizePopover(undefined, {
+ ...ODSCharts.ODSChartsPopoverManagers.NONE,
+ getPopupContentValue: ({ seriesName, itemValue }) =>
+ itemValue ? Math.round(itemValue * 100) / 100 + '$' : undefined,
+ });
+
+
diff --git a/docs/use_cases/two-colors-serie.html b/docs/use_cases/two-colors-serie.html new file mode 100644 index 00000000..3aaabcfd --- /dev/null +++ b/docs/use_cases/two-colors-serie.html @@ -0,0 +1,245 @@ + + +
+ + +
+ + + + + + + + + + + + + + +
+