Hi,
I thought I could change the "label" of a bar chart (e.g.) diagramm by working on the 'categories' field of the a!columnChartField() function.
But it seems , I can not.
My diagram: ("Monat" = "Month"):
My requirement was....
....to have the category labels not displayed as "1,2,3..." but as "Jan, Feb, Mar..."
My approach was...
...to wrap the "categories" field of the a!columnChartField() function with a text(x,"mmm") function, as follows,
a!columnChartField( categories: { text(index( local!datasubset.data, "MonatAbreise", null ),"mmm")
But I get...
...only "Jan, Jan, Jan..." in the chart as displayed here:
What is my mistake?
Thx for your ideas...
Discussion posts and replies are publicly visible
The numbers {1,2,3} are not dates but integers. The text() function does not know how to turn that into a date. Check my code below
a!forEach( items: {1,2,3}, expression: text(date(2020, fv!item, 1), "mmm") )
Hmmm...interesting because the following test rule works without a date but with an integer:
True, as long as the only month you need is January. text(5, "mmm") evaluates to "Jan" as well. BTW, following code would work as well
index( {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}, {3,7,12,4,9,5,3}, {} )
oouch!
;)
OK. But what to do?
I like the categories to be displayed as month and the db delivers not a date but an integer...
Any idea?
(..and btw "Huhu" (Wink) :))
WORKS!
a!columnChartField( categories: { text(date(2020, index( local!datasubset.data, "MonatAbreise", null ),1),"mmm") },
THX!!