Skip to content
Call slicer in OnGr...
 
Notifications
Clear all

Call slicer in OnGraphDraw

2 Posts
2 Users
0 Likes
952 Views
Hadi Eshraghi
Posts: 6
Customer
Topic starter
(@ftnsbonl38owc63xjps05ixlkbt2)
Active Member
Joined: 3 years ago

Hello,

How should I call my variable's slicer in the OnGraphDraw?

Topic Tags
1 Reply
Lonnie Chrisman
Posts: 39
Admin
(@lchrisman)
Member
Joined: 13 years ago

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.

Reply
Share: