Dataset tag and or bar chart obj

Hello
I would use a bar chart component to shoiw two bars: TargetPieces (which is an OPC tag already present in my gateway) and ProducedPieces (which is an OPC tag already present in my gateway)

How can I do that? Should I build an expression dataset tag and bind it to the graphical obj? In this case how can I do that?

Many thanks
C.

I would use objectScript() (part of Simulation Aids) to do it in a simple expression:

objectScript("system.dataset.toDataSet(['Pieces'],[[x] for x in args])",
  {TargetPieces}, {ProducedPieces})

You can do this with runScript, too, if you encapsulate the logic above in a project script function.

thank you
I defined a shared script

def composeDS(*args):
rows = []
oneRow = [“Pz”, args[0], args[1]]
rows.append(oneRow)

headers = ["Pz", "Target", "Act"]
data = system.dataset.toDataSet(headers, rows)	
return data	

then an expression dataset tag in which the expression is a call to the previous function
runScript(“shared.project.composeDS”,0,{[.]targetPcs},{[.]actPcs})

and I attached this tag to my bar chart obj … perfect!
thank you for your help