Skip to content

@maxhealth.tech/prefab / auto / autoChart

Function: autoChart()

ts
function autoChart(
   data, 
   series, 
   options?): ContainerComponent;

Defined in: auto/chart.ts:43

Auto-generate a chart Card from data and series definitions.

Parameters

ParameterType
dataRecord<string, unknown>[]
seriesChartSeries[]
options?AutoChartOptions

Returns

ContainerComponent

Example

ts
autoChart(
  [{ month: 'Jan', revenue: 42000, cost: 31000 }],
  [{ dataKey: 'revenue', label: 'Revenue' }, { dataKey: 'cost', label: 'Cost' }],
  { title: 'Monthly Revenue', xAxis: 'month', chartType: 'bar' },
)

Released under the MIT License.