My source is generating an agent called Sitz
with several parameters which get their value out of a database. One of the parameters is product_type
.
Now I would like to count and illustrate the number of Sitz
for each product_type
in bar chart.
I am thinking of a bar chart which shows 2 bars, one with Sitz product_type = A400S and one with Sitz product_type = A660.
My idea is to write something like sink.count(agent.product_type = "A400S")
as value in the bar charts data section, but this is not the right way. What would be the right code?
There are a ton of ways, here is one:
First, create a variable countA440S
. Then, in the sink, write
if (agent.product_type.equals("A400S")) {
countA440S++;
}
In your bar chart, link it to the variable as below:
PS: Best always check the example models first, many show how to apply these basic techniques