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

Call slicer in OnGraphDraw

2 Posts
2 Users
0 Reactions
1,772 Views
Hadi Eshraghi
Posts: 6
Topic starter
(@ftnsbonl38owc63xjps05ixlkbt2)
Active Member
Joined: 4 years ago

Hello,

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

Topic Tags
1 Reply
Lonnie Chrisman
Posts: 43
Admin
(@lchrisman)
Member
Joined: 14 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:

Download Free Analytica


    We hate spam as much as you. We won't share your email with third parties.
    The free edition of Analytica includes these key Analytica features:
    Free Analytica has no time limit. The only constraint is it won’t let you create more than 100 variables or other objects. But your model can be quite substantial since each variable can be a multidimensional array. It also lets you explore, change inputs, and run existing models of any size (excluding features unique to the Enterprise or Optimizer editions).

    Download the free edition of Analytica

    The free edition of Analytica includes these key Analytica features: 

    Free Analytica has no time limit. The only constraint is it won’t let you create more than 100 variables or other objects. But your model can be quite substantial since each variable can be a multidimensional array.  It also lets you explore, change inputs, and run existing models of any size (excluding features unique to the Enterprise or Optimizer editions).

    Analytica runs on any Windows computer, or on a Macintosh using Parallels or VMWare.


      Analytica Cubes Pattern