
3D Extruded Buildings & Urban Footprints
Real-world 3D building extrusions with dynamic sunlight shadows, terrain DEM elevations, and pitch/bearing camera controls.
liquid-fill-chartuiReact mirror of @uipkge/liquid-fill-chart — see the Vue registry item for the canonical description.
Also available for Vue ->$pnpm dlx shadcn@latest add https://uipkge.dev/r/react/liquid-fill-chart.json$npx shadcn@latest add https://uipkge.dev/r/react/liquid-fill-chart.json$yarn dlx shadcn@latest add https://uipkge.dev/r/react/liquid-fill-chart.json$bunx shadcn@latest add https://uipkge.dev/r/react/liquid-fill-chart.jsonnpx shadcn@latest add @uipkge-react/liquid-fill-chartInstalls to:components/ui/charts/liquid-fill-chart/| Name | Type / Values | Default | Required |
|---|---|---|---|
valueFill 0..100. | number | — | required |
height | number | string | 220 | optional |
colorWave colour. Defaults to chart-1 token. | string | var(--chart-1) | optional |
showLabelShow the % label in the centre. Default true. | boolean | true | optional |
unit | string | % | optional |
className | string | — | optional |
ariaLabelAccessible name announced for the chart image. Defaults to "Chart". | string | — | optional |
'use client'
import * as React from 'react'
import { cn } from '@/lib/utils'
import { ChartFrame } from '../shared'
// LiquidFillChart — dependency-free SVG gauge
// ─────────────────────────────────────────────────────────────────────────
export interface LiquidFillChartProps {
/** Fill 0..100. */
value: number
height?: number | string
/** Wave colour. Defaults to chart-1 token. */
color?: string
/** Show the % label in the centre. Default true. */
showLabel?: boolean
unit?: string
className?: string
/** Accessible name announced for the chart image. Defaults to "Chart". */
ariaLabel?: string
}
export const LiquidFillChart = React.forwardRef<HTMLDivElement, LiquidFillChartProps>(
({ value, height = 220, color = 'var(--chart-1)', showLabel = true, unit = '%', className, ariaLabel }, ref) => {
const pct = Math.max(0, Math.min(100, value))
const level = 100 - pct * 0.72
const uid = React.useId().replace(/[^a-zA-Z0-9]/g, '')
return (
<ChartFrame
ref={ref}
height={height}
className={cn('flex items-center justify-center', className)}
ariaLabel={ariaLabel || `Liquid fill chart at ${Math.round(pct)}${unit}`}
>
<svg viewBox="0 0 200 200" className="aspect-square h-full max-h-full" role="presentation">
<defs>
<clipPath id={uid}>
<circle cx="100" cy="100" r="84" />
</clipPath>
</defs>
<circle cx="100" cy="100" r="88" fill="none" stroke="currentColor" strokeWidth="3" className="text-border" />
<g clipPath={`url(#${uid})`}>
<rect x="0" y="0" width="200" height="200" className="fill-muted/40" />
<path
d={`M 0 ${level} Q 25 ${level - 10}, 50 ${level} T 100 ${level} T 150 ${level} T 200 ${level} V 200 H 0 Z`}
fill={color}
opacity="0.55"
>
<animateTransform
attributeName="transform"
type="translate"
from="0 0"
to="-100 0"
dur="6s"
repeatCount="indefinite"
/>
</path>
<path
d={`M 0 ${level + 6} Q 25 ${level - 4}, 50 ${level + 6} T 100 ${level + 6} T 150 ${level + 6} T 200 ${level + 6} V 200 H 0 Z`}
fill={color}
opacity="0.85"
>
<animateTransform
attributeName="transform"
type="translate"
from="-100 0"
to="0 0"
dur="4s"
repeatCount="indefinite"
/>
</path>
</g>
{showLabel && (
<text
x="100"
y="104"
textAnchor="middle"
dominantBaseline="middle"
className="fill-foreground"
fontSize="30"
fontWeight="700"
>
{Math.round(pct)}
{unit}
</text>
)}
</svg>
</ChartFrame>
)
},
)
LiquidFillChart.displayName = 'LiquidFillChart'
export { LiquidFillChart, type LiquidFillChartProps } from './LiquidFillChart'
'use client'
import * as React from 'react'
import * as echartsCore from 'echarts/core'
import { use } from 'echarts/core'
import { CanvasRenderer } from 'echarts/renderers'
import {
LineChart as EChartsLineChart,
BarChart as EChartsBarChart,
PieChart as EChartsPieChart,
ScatterChart as EChartsScatterChart,
EffectScatterChart as EChartsEffectScatter,
PictorialBarChart as EChartsPictorialBar,
RadarChart as EChartsRadarChart,
GaugeChart as EChartsGaugeChart,
HeatmapChart as EChartsHeatmap,
TreemapChart as EChartsTreemapChart,
FunnelChart as EChartsFunnelChart,
BoxplotChart as EChartsBoxplotChart,
CandlestickChart as EChartsCandlestickChart,
CustomChart as EChartsCustomChart,
ChordChart as EChartsChordChart,
MapChart as EChartsMapChart,
GraphChart as EChartsGraphChart,
ParallelChart as EChartsParallelChart,
SankeyChart as EChartsSankeyChart,
SunburstChart as EChartsSunburstChart,
ThemeRiverChart,
TreeChart as EChartsTreeChart,
} from 'echarts/charts'
import {
GridComponent,
PolarComponent,
TooltipComponent,
LegendComponent,
MarkLineComponent,
MarkAreaComponent,
MarkPointComponent,
GraphicComponent,
RadarComponent,
VisualMapComponent,
CalendarComponent,
DataZoomComponent,
ParallelComponent,
SingleAxisComponent,
TitleComponent,
} from 'echarts/components'
import ReactECharts from 'echarts-for-react/esm/core'
import { cn } from '@/lib/utils'
export function heightToStyle(height: number | string): string {
return /^\d+$/.test(String(height)) ? `${height}px` : String(height)
}
interface ChartFrameProps {
height: number | string
className?: string
/** Apply the accessible role/tabindex/focus-ring chrome. Some chart
* wrappers ship a bare `w-full` frame -- pass `false` for those. */
focusable?: boolean
/** Accessible name for role="img". Defaults to "Chart". */
ariaLabel?: string
}
/** Shared `<div>` wrapper around the ECharts canvas. */
export const ChartFrame = React.forwardRef<HTMLDivElement, ChartFrameProps & { children: React.ReactNode }>(
({ height, className, focusable = true, ariaLabel, children }, ref) => (
<div
ref={ref}
role="img"
aria-label={ariaLabel || 'Chart'}
tabIndex={focusable ? 0 : undefined}
style={{ height: heightToStyle(height) }}
className={
focusable
? cn('focus-visible:ring-ring w-full focus-visible:ring-2 focus-visible:outline-none', className)
: cn('w-full', className)
}
>
{children}
</div>
),
)
ChartFrame.displayName = 'ChartFrame'
/** ECharts canvas filling its parent frame. */
export function EChart({ option }: { option: any }) {
return (
<ReactECharts
echarts={echartsCore as any}
option={option}
notMerge
lazyUpdate
style={{ width: '100%', height: '100%' }}
/>
)
}
export const echartsCoreModule = echartsCore
// Register every chart type the wrappers need once at module load.
use([
CanvasRenderer,
EChartsLineChart,
EChartsBarChart,
EChartsPieChart,
EChartsScatterChart,
EChartsEffectScatter,
EChartsPictorialBar,
EChartsRadarChart,
EChartsGaugeChart,
EChartsHeatmap,
EChartsTreemapChart,
EChartsFunnelChart,
EChartsBoxplotChart,
EChartsCandlestickChart,
EChartsCustomChart,
EChartsChordChart,
EChartsMapChart,
EChartsGraphChart,
EChartsParallelChart,
EChartsSankeyChart,
EChartsSunburstChart,
ThemeRiverChart,
EChartsTreeChart,
GridComponent,
PolarComponent,
TooltipComponent,
LegendComponent,
MarkLineComponent,
MarkAreaComponent,
MarkPointComponent,
GraphicComponent,
RadarComponent,
VisualMapComponent,
CalendarComponent,
DataZoomComponent,
ParallelComponent,
SingleAxisComponent,
TitleComponent,
])
Raw manifest:https://uipkge.dev/r/react/liquid-fill-chart.json