question

lancewu avatar image
0 Likes"
lancewu asked lancewu commented

Add a 'state pie chart' in the Dashboard using code

Hi,guys

I'm writing a script that can automatically generate bar charts or another chart。When I use the following code to create a processor state pie chart, the state table will not be created on time and will be linked to the state pie chart,. How do I need to modify the code?

  1. Object dashview=views().find("active>Documents/Dashboard/1+/~");
  2. Object chartview=views().find("viewslibrary/Dashboard/State/StatePie");
  3. treenode chart=function_s(dashview,"createGraphWindow",chartview,1);
  4. Group group = getvarnode(chart,"replacements").subnodes["Objects"].value;
  5. Object pro = Model.find("Processor1");
  6. group.addMember(pro);
FlexSim 22.1.4
code
· 1
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

lancewu avatar image lancewu commented ·

I use code to create a processor status pie chart, which is blank when running

0 Likes 0 ·

1 Answer

Jason Lightfoot avatar image
0 Likes"
Jason Lightfoot answered lancewu commented

You need a valid state table reference in order to then additionally run:

getvarnode(chart,"replacements").subnodes["StateTable"].value = stateTable;
function_s(stateTable,"BuildFromProfile",pro.stats.state(0));
function_s(chart,"onApply");

If one doesn't exist already you can add one using:

Object stateTable = applicationcommand("addstatetable", 1);
· 1
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

lancewu avatar image lancewu commented ·
it worked!

thank u very much !!

0 Likes 0 ·