Skip to content

Variable: chartPlanSchema

const chartPlanSchema: ZodObject<{ categories: ZodDefault<ZodNullable<ZodArray<ZodString>>>; chartType: ZodUnion<readonly [ZodLiteral<"bar">, ZodLiteral<"horizontalBar">, ZodLiteral<"line">, ZodLiteral<"area">, ZodLiteral<"combo">, ZodLiteral<"waterfall">, ZodLiteral<"scatter">, ZodLiteral<"heatmap">, ZodLiteral<"radar">, ZodLiteral<"pie">, ZodLiteral<"funnel">, ZodLiteral<"treemap">, ZodLiteral<"custom">]>; option: ZodDefault<ZodNullable<ZodString>>; series: ZodDefault<ZodArray<ZodObject<{ data: ZodArray<ZodCatch<ZodPipe<ZodTransform<… | … | … | …, unknown>, ZodUnion<readonly […, …, …, …]>>>>; name: ZodString; type: ZodDefault<ZodNullable<ZodUnion<readonly [ZodLiteral<…>, ZodLiteral<…>, ZodLiteral<…>]>>>; yAxisIndex: ZodDefault<ZodNullable<ZodUnion<readonly [ZodLiteral<…>, ZodLiteral<…>]>>>; }, $strip>>>; title: ZodDefault<ZodNullable<ZodString>>; xAxisLabel: ZodDefault<ZodNullable<ZodString>>; yAxisLabel: ZodDefault<ZodNullable<ZodString>>; yCategories: ZodDefault<ZodNullable<ZodArray<ZodString>>>; }, $strip>

Compact, model-friendly representation of an Echarts spec. The planner agent emits this; planToEchartsOption expands it into a real EChartsOption JSON. Two layers because letting the model fill in a fully-typed EChartsOption is brittle (hundreds of optional fields, deep unions, version-dependent shapes). A small “chart plan” schema is much more reliable for a fast model and keeps animation / tooltip / styling defaults consistent across charts.

  • chartType: The chart shape that best matches the data and intent.
  • title (optional): Short title shown above the chart. Use null to fall back to the title argument the caller passed in.
  • xAxisLabel (optional): Axis label for the primary (usually bottom / value) axis. Used for bar / horizontalBar / line / area / combo / waterfall / scatter / heatmap; use null for pie / funnel / treemap / radar.
  • yAxisLabel (optional): Axis label for the secondary (usually left) axis. Used for bar / horizontalBar / line / area / combo / waterfall / scatter / heatmap; use null for pie / funnel / treemap / radar.
  • categories (optional): Primary category labels. For bar / horizontalBar / line / area / combo / waterfall: one label per data point. For heatmap: x-axis categories. For radar: indicator names. Use null for scatter ([x, y] tuples) and slice charts (pie / funnel / treemap, each slice carries its own name).
  • yCategories (optional): Y-axis (row) labels for heatmap. Use null when the row labels come from the series names, which is the preferred way to build a heatmap. Use null for every other chart type.
  • series (optional): One or more series to plot. Required for every chart type except custom, which carries its series inside option. Slice charts (pie / funnel / treemap) and waterfall / heatmap use exactly one series; bar / line / area / combo / radar / scatter can carry multiple series.
  • option (optional): Required for custom; use null for every other chart type. A COMPLETE Echarts option, as a JSON object encoded in a string: series (each with its own type and that series’ own data shape) plus whatever else the chart needs - a coordinate system, visualMap, axes. Plain JSON values only, never a JavaScript function. A centered title is filled in when the object omits one.