diff --git a/.changeset/sour-pens-tan.md b/.changeset/sour-pens-tan.md new file mode 100644 index 0000000000..20c8f6ed6a --- /dev/null +++ b/.changeset/sour-pens-tan.md @@ -0,0 +1,11 @@ +--- +'@evidence-dev/core-components': minor +--- + +Add RadarChart component for spider/radar visualizations + +- New RadarChart component for displaying multivariate data on radar/spider charts +- Supports single series and multi-series comparisons +- Configurable shape (polygon or circle), fill opacity, line width, markers, and data labels +- Custom max value support for consistent axis scaling +- Custom color palette support for multi-series charts diff --git a/packages/ui/core-components/src/lib/unsorted/viz/index.js b/packages/ui/core-components/src/lib/unsorted/viz/index.js index 2759ded702..6f03b9f992 100644 --- a/packages/ui/core-components/src/lib/unsorted/viz/index.js +++ b/packages/ui/core-components/src/lib/unsorted/viz/index.js @@ -24,6 +24,7 @@ export { default as Histogram } from './histogram/Histogram.svelte'; export { default as Hist } from './histogram/Hist.svelte'; export { default as LineChart } from './line/LineChart.svelte'; export { default as Line } from './line/Line.svelte'; +export { default as RadarChart } from './radar/RadarChart.svelte'; export { default as BaseMap } from './map/BaseMap.svelte'; export { default as AreaMap } from './map/AreaMap.svelte'; export { default as PointMap } from './map/PointMap.svelte'; diff --git a/packages/ui/core-components/src/lib/unsorted/viz/radar/InnerRadarChart.svelte b/packages/ui/core-components/src/lib/unsorted/viz/radar/InnerRadarChart.svelte new file mode 100644 index 0000000000..0fcea6add0 --- /dev/null +++ b/packages/ui/core-components/src/lib/unsorted/viz/radar/InnerRadarChart.svelte @@ -0,0 +1,362 @@ + + + + +{#if error} + +{:else} + +{/if} diff --git a/packages/ui/core-components/src/lib/unsorted/viz/radar/RadarChart.svelte b/packages/ui/core-components/src/lib/unsorted/viz/radar/RadarChart.svelte new file mode 100644 index 0000000000..02c99ac4d1 --- /dev/null +++ b/packages/ui/core-components/src/lib/unsorted/viz/radar/RadarChart.svelte @@ -0,0 +1,40 @@ + + + + + + + + + + + + diff --git a/sites/example-project/src/pages/charts/radar-chart/+page.md b/sites/example-project/src/pages/charts/radar-chart/+page.md new file mode 100644 index 0000000000..f39fabdef8 --- /dev/null +++ b/sites/example-project/src/pages/charts/radar-chart/+page.md @@ -0,0 +1,221 @@ +--- +title: Radar Chart +--- + +```sql skills_data +select 'JavaScript' as skill, 90 as proficiency +union all select 'Python' as skill, 85 as proficiency +union all select 'SQL' as skill, 95 as proficiency +union all select 'React' as skill, 80 as proficiency +union all select 'Node.js' as skill, 75 as proficiency +union all select 'TypeScript' as skill, 70 as proficiency +``` + +```sql team_comparison +select 'Speed' as metric, 85 as value, 'Team A' as team +union all select 'Quality' as metric, 90 as value, 'Team A' as team +union all select 'Communication' as metric, 75 as value, 'Team A' as team +union all select 'Innovation' as metric, 80 as value, 'Team A' as team +union all select 'Reliability' as metric, 95 as value, 'Team A' as team +union all select 'Speed' as metric, 70 as value, 'Team B' as team +union all select 'Quality' as metric, 85 as value, 'Team B' as team +union all select 'Communication' as metric, 90 as value, 'Team B' as team +union all select 'Innovation' as metric, 95 as value, 'Team B' as team +union all select 'Reliability' as metric, 80 as value, 'Team B' as team +``` + +```sql product_ratings +select 'Design' as category, 4.5 as rating, 'Product X' as product +union all select 'Performance' as category, 4.2 as rating, 'Product X' as product +union all select 'Price' as category, 3.8 as rating, 'Product X' as product +union all select 'Support' as category, 4.0 as rating, 'Product X' as product +union all select 'Features' as category, 4.7 as rating, 'Product X' as product +union all select 'Design' as category, 3.9 as rating, 'Product Y' as product +union all select 'Performance' as category, 4.8 as rating, 'Product Y' as product +union all select 'Price' as category, 4.5 as rating, 'Product Y' as product +union all select 'Support' as category, 3.5 as rating, 'Product Y' as product +union all select 'Features' as category, 4.0 as rating, 'Product Y' as product +union all select 'Design' as category, 4.2 as rating, 'Product Z' as product +union all select 'Performance' as category, 3.5 as rating, 'Product Z' as product +union all select 'Price' as category, 4.8 as rating, 'Product Z' as product +union all select 'Support' as category, 4.6 as rating, 'Product Z' as product +union all select 'Features' as category, 3.8 as rating, 'Product Z' as product +``` + +Radar charts (also known as spider charts or web charts) display multivariate data on a two-dimensional chart with three or more quantitative variables represented on axes starting from the same point. + +## Basic Radar Chart + +A simple radar chart showing a single data series. Each axis represents a different metric, and the values are plotted as points connected by lines. + + + +## Multi-Series Radar Chart + +Compare multiple entities across the same metrics. Each series is shown with a different color and appears in the legend. + + + +## Three-Way Comparison + +Radar charts are excellent for comparing three or more items across multiple dimensions. + + + +## Circle Shape + +By default, radar charts use a polygon shape. Set `shape="circle"` to use circular gridlines instead. + + + +## Custom Max Value + +By default, the max value for each axis is calculated as 1.1x the maximum data value. Use the `max` prop to set a fixed maximum for all axes - useful when you want consistent scaling (e.g., percentages out of 100). + + + +## Fill Opacity + +Control the transparency of the filled area with `fillOpacity`. Values range from 0 (transparent) to 1 (opaque). + +### High Opacity (0.7) + + + +### Low Opacity (0.1) + + + +## Line Width + +Adjust the thickness of the connecting lines with `lineWidth`. + + + +## Markers + +Show data point markers on the chart with `markers=true`. Customize the marker appearance with `markerShape` and `markerSize`. + + + +## Data Labels + +Display the actual values on the chart with `labels=true`. + + + +## Custom Colors + +Use `fillColor` and `lineColor` to customize the appearance of a single-series radar chart. + + + +## Color Palette for Multi-Series + +Use `colorPalette` to define custom colors for multi-series charts. + + + +## Combined Styling + +Combine multiple styling options for a polished look. + + + +## Chart Height + +Control the chart height with `chartAreaHeight`. + +