Plugins
Charts

Charts & Data Visualization

The DataVisualization component provides chart rendering for dashboards and analytics views.

DataVisualization Component

import { DataVisualization } from '@gtcx/ui';
 
<DataVisualization
  type="bar"
  data={[
    { label: 'Q1', value: 120 },
    { label: 'Q2', value: 340 },
    { label: 'Q3', value: 220 },
    { label: 'Q4', value: 480 },
  ]}
  height={300}
/>

Chart Types

TypeDescriptionUse Case
barVertical bar chartComparing categories
lineLine chart with pointsTrends over time
areaFilled area chartVolume over time
piePie/donut chartPart-of-whole

Props

PropTypeDefaultDescription
type'bar' | 'line' | 'area' | 'pie''bar'Chart type
dataArray<{ label: string; value: number }>Data points
heightnumber300Chart height in pixels
colorsstring[]Theme colorsCustom color palette
showLegendbooleantrueShow legend
showGridbooleantrueShow grid lines

Dashboard Integration

Use with DashboardTemplate for KPI displays:

import { DashboardTemplate, KpiCard } from '@gtcx/templates';
import { DataVisualization } from '@gtcx/ui';
 
<DashboardTemplate
  kpis={[
    <KpiCard title="Revenue" value="$1.2M" trend={12} />,
    <KpiCard title="Users" value="8,432" trend={-3} />,
  ]}
>
  <DataVisualization
    type="line"
    data={monthlyRevenue}
    height={400}
  />
</DashboardTemplate>

Theming

Charts inherit colors from the active theme. Override with the colors prop or by customizing the colorPrimary token in GtcxConfigProvider.

Accessibility

  • Color combinations meet WCAG AA contrast ratios
  • Data tables available as alternative to visual charts
  • Tooltips provide exact values on hover/focus