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

Call slicer in OnGraphDraw

2 Posts
2 Users
0 Reactions
1,487 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: 42
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 the free edition of Analytica

The free version of Analytica lets you create and edit models with up to 101 variables, which is pretty substantial since each variable can be a multidimensional array. It also lets you run larger modes in ‘browse mode.’ Learn more about the free edition.

While Analytica doesn’t run on macOS, it does work with Parallels or VMWare through Windows.


    Analytica Cubes Pattern

    Download the free edition of Analytica

    The free version of Analytica lets you create and edit models with up to 101 variables, which is pretty substantial since each variable can be a multidimensional array. It also lets you run larger modes in ‘browse mode.’ Learn more about the free edition.

    While Analytica doesn’t run on macOS, it does work with Parallels or VMWare through Windows.


      Analytica Cubes Pattern