@teachinglab/omd
Version:
omd
110 lines (100 loc) • 3.08 kB
Markdown
"omdType": "tapeDiagram",
"values": [number|string, ...], //any numbers should be inputted as NUMBERS, e.g 4 not '4'
"colors": [string, ...],
"labelSet": [
{
"omdType": "omdTapeLabel",
"startIndex": number, //inclusive
"endIndex": number, //exclusive
"label": string,
"showBelow": boolean
}
],
"unitWidth": number,
"showValues": boolean
}
```
- values: segment magnitudes or expressions (strings allowed).
- colors: per-segment fills (optional; falls back to lightGray).
- labelSet: range labels either by indices (startIndex/endIndex) or by absolute values (startValue/endValue).
- unitWidth: pixel width per numeric unit.
## balanceHanger
```json
{
"omdType": "balanceHanger",
"leftValues": [number|string, ...],
"rightValues": [number|string, ...],
"tilt": "left" | "right" | "none",
"fontFamily": string,
"fontSize": number
}
```
- leftValues/rightValues: stacks rendered on each side.
- tilt: beam visual tilt.
```json
{
"omdType": "coordinatePlane",
"xMin": number,
"xMax": number,
"yMin": number,
"yMax": number,
"xLabel": string,
"yLabel": string,
"axisLabelOffsetPx": number,
"size": "small" | "medium" | "large",
"tickInterval": number,
"tickLabelOffsetPx": number,
"forceAllTickLabels": boolean,
"graphEquations": [
{
"equation": string, // supports 'y = ...' or expression in x
"domain": { "min": number, "max": number },
"color": string,
"strokeWidth": number,
"label": string,
"labelAtX": number,
"labelPosition": "above" | "below" | "left" | "right"
}
],
"lineSegments": [
{ "point1": [number, number], "point2": [number, number], "color": string, "strokeWidth": number }
],
"dotValues": [ [number, number, string?], ... ],
"shapeSet": [
{ "omdType": "rightTriangle" | "isoscelesTriangle" | "rectangle" | "ellipse" | "circle" | "regularPolygon", /* shape-specific fields */ }
]
}
```
- graphEquations: each equation plotted within its domain.
- lineSegments: raw segment overlays.
- dotValues: points as [x, y, optionalColor].
- shapeSet: geometric overlays rendered in plane units.
```json
{
"omdType": "table",
"title": string,
"headers": [string, ...],
"data": [ [any, ...], ... ], // array-of-arrays; columns align with headers
"equation": string, // optional; generates rows from y=f(x) takes precendence over any data provided
"xMin": number,
"xMax": number,
"stepSize": number,
"fontFamily": string,
"headerFontFamily": string,
"fontSize": number,
"headerFontSize": number,
"cellHeight": number,
"headerHeight": number,
"minCellWidth": number,
"maxCellWidth": number,
"padding": number
}
```
- If equation is provided, rows are generated in range [xMin, xMax] with stepSize.
- When autoSizeCells is true, widths are inferred from content.
```json
{