How to display different picture inside palette?

excuse me, i want to make a planogram and i want to display different picture inside pallete based on myDiagram.model. but i’m still get the same picture

i’m following here for my planogram. If any one have an idea to help I really appreciate it because I need it so much, and thanks to all.

You’ll want to use data binding, http://gojs.net/latest/intro/usingModels.html and http://gojs.net/latest/intro/dataBinding.html.

I suggest that you understand some of the samples that show images by using Pictures. You can start with http://gojs.net/learn, but also look at the node templates in http://gojs.net/latest/samples/orgChartEditor.html and http://gojs.net/latest/samples/beatPaths.html and http://gojs.net/latest/samples/shopFloorMonitor.html

Thanks walter. now each shape have a different image but the image displayed is always cut off. I have read here and used imageStretch: go.GraphObject.Fill but my image still cut off. here is my code

$(go.Picture, { margin: 2, width: 30, height: 30, background: null, imageStretch: go.GraphObject.Fill },
new go.Binding("source")),

myPalette = $(go.Palette, "myPalette", { 
	nodeTemplate: myDiagram.nodeTemplate,
	groupTemplate: myDiagram.groupTemplate,
	layout: $(go.GridLayout)
});
	
var item = [];

	<?php while($row = db_fetch($result)) { ?>''
	      var c = {key: "g", size: "100 100", source: ""+<?php echo $row['image']?>+""}
	      item.push(c);
	<?php } ?>
		
myPalette.model = new go.GraphLinksModel(item);

It depends entirely on all of the Panels the Picture is in.
http://gojs.net/latest/intro/sizing.html

Hmm, is it possible to binding data from GraphLinksModel to nodeTemplate? Here is the picture. I want to replace width and height image by size attribut.

GraphObject.desiredSize, http://gojs.net/latest/api/symbols/GraphObject.html#desiredSize, is the same as both the GraphObject.width and GraphObject.height properties together.

So you should bind the desiredSize property instead of trying to bind both width and height.

forgive me, what i mean is the value. i’m using php to generate dynamic data and save to size atribut. and i want atribut (width & height) picture have same value with size atribut. is it possible?

i hope you understand. thanks

I suggest that you do exactly what I said: add:

    new go.Binding("desiredSize", "size")

to that Picture GraphObject that is in your Node template (Diagram.nodeTemplate).

Please read http://gojs.net/latest/intro/usingModels.html and http://gojs.net/latest/intro/dataBinding.html.