JRose
JRose

Reputation: 35

AnyLogic: Populate Time Color Plot with one row per agent

In AnyLogic 8, how do I create a Time Color Plot which has one row for each agent in a pool of agents?

As explained in an answer to this question, I can create a separate dataset for each row, and then have the Time Color Plot display one row for each dataset. But this requires hardcoding the number of datasets (and thus the number of agents), whereas I want to create a model with a variable number of agents and thus a variable number of rows in the Time Color Plot.

This AnyLogic cloud model includes a Time Color Plot where each forklift in a pool of agents has its own row in a Time Color Plot. Unfortunately, because it is a cloud model, I cannot download the model to investigate how it is built.

How do I create a Time Color Plot where each row corresponds to an agent in a pool of agents (like in that linked cloud model)?

Upvotes: 1

Views: 177

Answers (1)

Jaco-Ben Vosloo
Jaco-Ben Vosloo

Reputation: 3975

You can simply add the datasets programmatically using chart.addDataSet();

enter image description here

Here is the code for the model you referenced where the chart starts off empty (except for the color setup) and you simply add the bars during run time.

enter image description here

You can also remove them as needed.

enter image description here

Upvotes: 1

Related Questions