# Data formats for imcs_canvas.html

Currently, imcs_canvas.html considers only boxes and lines (line labels are ignored).

## Variant 1

This is a JSON format, where each the "from" and "to" boxes are specified for each line.
In the following example, numbers 1, 2, 3, and 4 are unique identifiers for boxes and lines.

`{ "boxes": {
"1" : {"x":0,"y":0,"width":100,"height":25},
"2" : {"x":150,"y":0,"width":100,"height":25}
},
"lines": {
"3" : { "from":"1", "to":"2", "points": [ {"x":100,"y":10}, {"x":150,"y":10} ]},
"4" : { "from":"1", "to":"2", "points": [ {"x":100,"y":15}, {"x":150,"y":15} ]}
}
}
`

## Variant 2

This is a JSON format, where each lines are represented just by "points" array, without specifying the "from" and "to" boxes; these boxes will be found automatically based on the line start and end points.
In the following example, numbers 1, 2, 3, and 4 are unique identifiers for boxes and lines.

`{ "boxes": {
"1" : {"x":0,"y":0,"width":100,"height":25},
"2" : {"x":150,"y":0,"width":100,"height":25}
},
"lines": {
"3" : [ {"x":100,"y":10}, {"x":150,"y":10} ],
"4" : [ {"x":100,"y":15}, {"x":150,"y":15} ]
}
}
`

## Variant 3

You can also pass the "datafile" URL parameter as follows:
`imcs_canvas.html?datafile=<url-to-file-with-JSON-as-in-variant1-or-variant2>`