INNER CODE UNIT · TypeScript
axisProps
f5/unovis · packages/mcp/src/codegen/index.ts:177
function axisProps (spec: ChartSpec, axis: 'x' | 'y', emit: Emit): Prop[] | undefined {
const config = axis === 'x' ? spec.xAxis : spec.yAxis
if (!config) return undefined
const props: Prop[] = [{ name: 'type', expr: `'${axis}'` }]
for (const [name, value] of Object.entries(config)) {
const expr = valueExpression(value, emit)
if (expr !== undefined) props.push({ name, expr })
}
return props
}
// ── emitters ────────────────────────────────────────────────────────────────
const containerName = (spec: ChartSpec): string => spec.container === 'xy' ? 'XYContainer' : 'SingleContainer'
const preamble = (emit: Emit, dataLiteral: string, includeEnumImport = false): string => {
const blocks: string[] = []
// Enums live in the core package even when components come from a wrapper