question

lancewu avatar image
0 Likes"
lancewu asked Jason Lightfoot commented

How to add a 'output bar chart' in the Dashboard using code

hi,

i am tyring to add a 'output bar chart' in the Dashboard by code ,Can code be used to achieve this command ? Thank you for your review。

FlexSim 22.1.4
dashboardscode
· 2
5 |100000

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

Julie Weller avatar image Julie Weller commented ·

Hi @lancewu! I think it would help us to know what you're trying to accomplish. Why don't you want to use the pre-defined output chart?

1 Like 1 ·
lancewu avatar image lancewu Julie Weller commented ·

I'm writing a script that can automatically generate bar charts or another chart。 I know that there are some scripts that can be automatically generated dashboard or globaltable,I want to know if have code can be automatically generate chart。

0 Likes 0 ·

1 Answer

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

Here's a start:

Object dashview=views().find("active>Documents/Dashboard/1+/~");
Object chartview=views().find("viewslibrary/Dashboard/Output/ThroughputBar");
Object chart=function_s(dashview,"createGraphWindow",chartview,1);
Group group = getvarnode(chart,"replacements").subnodes["Objects"].value;
group.addMember(Model.find("Processor1"));
Object webgraph=dashview.find("GraphPanel").last;
webgraph.location=Vec3(200,200,0);
webgraph.size=Vec3(400,200,0);
refreshview(webgraph);


· 3
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 ·
thanks! it worked!!
0 Likes 0 ·
lancewu avatar image lancewu commented ·

Hi, excuse me, I also want to have a chance to know how to set the size of the chart by code ;

Thank you for your review。

0 Likes 0 ·
Jason Lightfoot avatar image Jason Lightfoot ♦♦ lancewu commented ·
I updated the code above to adjust the size and location.
0 Likes 0 ·