Call slicer in OnGraphDraw
Hello,
How should I call my variable's slicer in the OnGraphDraw?
You won't be changing the slicers in OnGraphDraw, but your OnGraphDraw logic might reading the slicer values.
The slider positions are contained in there three collections:
info[OnGraphDrawItem='SlicerPositions'] info[OnGraphDrawItem='SlicersAtTotal'] info[OnGraphDrawItem='SlicersAtAll']
A helpful trick when figuring this stuff out is to print the contents inside the OnGraphDraw using, e.g.,
ConsolePrint( info[OnGraphDrawItem='SlicerPositions'] )
Let's suppose you already know with certainty that the Country index is a slicer, and that it is not set to ALL or Total (so it will appear in info[OnGraphDrawItem='SlicerPositions']). The selected country position is
(#info[OnGraphDrawItem='SlicerPositions']) [.Slicer=Handle(Country)]
We could print the country name on the graph using:
Local pos:=(#info[OnGraphDrawItem='SlicerPositions'])[.Slicer=Handle(Country)]; Local name := Country[@Country=pos]; CanvasDrawText(canv, name, 100, 20, bold:true)
You would probably want somewhat smarter positioning of the label.
I attach an image of the resulting graph. The forum isn't allowing me to paste in an image right now, so I had to attach it as a file.
-
canvas Y-coordinate of labels
2 years ago
Currently viewing this topic 1 guest.
- 4 Forums
- 87 Topics
- 286 Posts
- 2 Online
- 1,887 Members