Menu

Change language

GitHub repo

Raw Chart

raw-chartui

React mirror of @uipkge/raw-chart — see the Vue registry item for the canonical description.

Installation

$npx shadcn@latest add https://uipkge.dev/r/lit/raw-chart.json
Manifest:https://uipkge.dev/r/lit/raw-chart.jsonInstalls to:src/uip/components/charts/

Examples

Loading interactive previews…

Props

NameType / ValuesDefaultRequired
optionany{}optional
autoresizestringtrueoptional

Schema

Type aliases from this item's source — use them to shape the data you pass in.

HTMLElementTagNameMap
interface HTMLElementTagNameMap {
    'uip-raw-chart': UipRawChart
  }
}
ChartTheme
interface ChartTheme {
  colors: string[]
  textColor: string
  axisColor: string
  splitLineColor: string
  tooltipBg: string
  tooltipBorder: string
  tooltipText: string
  bgColor: string
  accentColor: string
  dangerColor: string
  /** `--card`: cell borders and inside-label text, so they read as gaps /
   *  contrast on light and dark surfaces (never '#fff'). */
  surfaceColor: string
  /** `--foreground`: primary numbers drawn on the canvas (gauge value). */
  foregroundColor: string
  /** Gauge stoplight from the status tokens, same rule as <uip-usage-bar>:
   *  < 70% success, 70-89% warning, >= 90% destructive. */
  semanticGaugeThresholds: [number, string][]
}

npm dependencies

Includes

Used by

Files installed (4)

  • src/uip/components/charts/raw-chart.ts1.2 kB
    import { ChartElement, defaultTrue } from './lib/chart-element'
    
    /**
     * <uip-raw-chart> — the registry RawChart (React `RawChart`): the raw
     * escape hatch. Pass a complete ECharts `option`; it is applied as-is
     * (notMerge). Every chart type / component the React wrappers register is
     * registered here too (sankey, sunburst, candlestick, graph, boxplot, …).
     *
     * Properties (React props): `option` (JSON attribute or property), `height`
     * (default 300), `autoresize` (default true; `autoresize="false"` opts out),
     * `aria-label` (React `ariaLabel`). React's `className` → host classes.
     * Theme helpers for weaving tokens into an option: `resolveChartTheme`,
     * `toRgba`, `mergeOptionBlock` from `./lib/chart-theme`.
     */
    export class UipRawChart extends ChartElement {
      static properties = {
        option: { type: Object },
        autoresize: { converter: defaultTrue },
      }
    
      option: any = {}
      autoresize = true
      protected readonly chartSlot = 'raw-chart'
    
      protected buildOption() {
        return this.option ?? {}
      }
    }
    
    customElements.get('uip-raw-chart') || customElements.define('uip-raw-chart', UipRawChart)
    
    declare global {
      interface HTMLElementTagNameMap {
        'uip-raw-chart': UipRawChart
      }
    }
    
  • src/uip/components/charts/lib/chart-element.ts4.9 kB
  • src/uip/components/charts/lib/chart-theme.ts7.1 kB
  • src/uip/components/charts/lib/echarts.ts1.9 kB

Raw manifest:https://uipkge.dev/r/lit/raw-chart.json