Skip to content
Kappa
Charts
@dicehub/kappav0.4.2

Charts

Render broad data visualizations or high-density numeric plots with explicit engine boundaries.

<script setup lang="ts">
import { Chart } from "@dicehub/kappa/components/chart";
import { LineChart } from "echarts/charts";
import { GridComponent, LegendComponent, TooltipComponent } from "echarts/components";
import * as echarts from "echarts/core";
import { CanvasRenderer } from "echarts/renderers";

echarts.use([LineChart, GridComponent, LegendComponent, TooltipComponent, CanvasRenderer]);

const options = {
  tooltip: { trigger: "axis" },
  xAxis: { type: "category", data: ["Mon", "Tue", "Wed", "Thu", "Fri"] },
  yAxis: { type: "value" },
  series: [{ name: "CPU", type: "line", data: [42, 48, 46, 63, 58] }],
};
</script>

<template>
  <Chart
    :engine="echarts"
    :options="options"
    title="Workspace usage"
    aria-label="Workspace CPU usage"
    aria-description="CPU usage peaks at 63 percent on Thursday."
  />
</template>

Choose an Engine

Kappa has three chart components across two engines. Select one from the data shape and required chart type. The components do not switch engines at runtime.

Kappa componentEngineUseData
ChartEChartsBar, line, pie, scatter, heatmap, Sankey, maps, and normal dashboards.Small and medium data sets; large-mode ECharts series where they fit.
XYPlotuPlotDense numeric or time X/Y data, solver monitors, and live telemetry.Aligned columns, typed arrays, and 100,000 or more points.
TimeseriesChartEChartsPolished dashboard trends with opinionated line, area, bar, legend, and tooltip defaults.Normal dashboard ranges expressed as timestamp and value pairs.

Installation

The engines are optional peer dependencies. Install only the engine that your application imports. Import each component from its isolated path.

pnpm add echarts uplot

Chart

Chart hosts a modular ECharts instance. Register only the chart types, components, and renderer that the application uses. It supports the full ECharts catalogue, including bars, lines, pie charts, scatter plots, heatmaps, Sankey diagrams, and maps.

<script setup lang="ts">
import { Chart } from "@dicehub/kappa/components/chart";
import { LineChart } from "echarts/charts";
import { GridComponent, LegendComponent, TooltipComponent } from "echarts/components";
import * as echarts from "echarts/core";
import { CanvasRenderer } from "echarts/renderers";

echarts.use([LineChart, GridComponent, LegendComponent, TooltipComponent, CanvasRenderer]);

const options = {
  tooltip: { trigger: "axis" },
  xAxis: { type: "category", data: ["Mon", "Tue", "Wed", "Thu", "Fri"] },
  yAxis: { type: "value" },
  series: [{ name: "CPU", type: "line", data: [42, 48, 46, 63, 58] }],
};
</script>

<template>
  <Chart
    :engine="echarts"
    :options="options"
    title="Workspace usage"
    aria-label="Workspace CPU usage"
    aria-description="CPU usage peaks at 63 percent on Thursday."
  />
</template>

XYPlot

XYPlot uses uPlot for aligned numeric or time data. Keep the data in a shallowRef or outside Vue reactivity. Replace the data reference, update revision, or call an exposed method.

For polished dashboard time data, use TimeseriesChart. It composes ECharts with opinionated line, area, bar, axis, legend, tooltip, and motion defaults. Keep XYPlot for dense or sustained technical data.

<script setup lang="ts">
import { shallowRef } from "vue";
import {
  XYPlot,
  type XYPlotData,
  type XYPlotSeries,
} from "@dicehub/kappa/components/xy-plot";

const data = shallowRef<XYPlotData>([
  new Float64Array([0, 1, 2, 3]),
  new Float64Array([0.08, 0.021, 0.006, 0.0014]),
]);
const series: XYPlotSeries[] = [{ label: "p", width: 1.5 }];
</script>

<template>
  <XYPlot
    :data="data"
    :series="series"
    title="Residual monitor"
    aria-label="Pressure residual plot"
    aria-description="Pressure residual decreases across four iterations."
    x-label="Iteration"
    y-label="Residual"
    y-scale="log"
  />
</template>

Examples

Scatter

Use ECharts Canvas and its large mode for a broad scatter plot.

<Chart
  :engine="echarts"
  :options="{
    animation: false,
    xAxis: { type: 'value', name: 'Velocity (m/s)' },
    yAxis: { type: 'value', name: 'Pressure (kPa)' },
    series: [{ type: 'scatter', data: samples, large: true }],
  }"
  aria-label="Pressure field samples"
  aria-description="Pressure samples plotted against velocity."
/>

Heatmap

Use categorical axes and a visual scale for a compact utilization matrix.

<Chart
  :engine="echarts"
  :options="{
    xAxis: { type: 'category', data: hours },
    yAxis: { type: 'category', data: days },
    visualMap: { min: 0, max: 100 },
    series: [{ type: 'heatmap', data: load }],
  }"
  aria-label="Compute load by hour"
  aria-description="Compute load is highest on weekday afternoons."
/>

Sankey

Show flow between stages without changing the Kappa frame or accessibility contract.

<Chart
  :engine="echarts"
  :options="{
    series: [{
      type: 'sankey',
      data: nodes,
      links,
      emphasis: { focus: 'adjacency' },
    }],
  }"
  aria-label="Case processing flow"
  aria-description="Jobs move from geometry through meshing and solving."
/>

100,000-point X/Y Plot

Pass aligned typed arrays directly to uPlot. Kappa does not deep-watch the values.

<script setup lang="ts">
import { XYPlot, type XYPlotData } from "@dicehub/kappa/components/xy-plot";

const pointCount = 100_000;
const x = new Float64Array(pointCount);
const pressure = new Float64Array(pointCount);
for (let index = 0; index < pointCount; index += 1) {
  x[index] = index * 0.005;
  pressure[index] = 1.2 + Math.sin(index * 0.007) * 0.18;
}
const data: XYPlotData = [x, pressure];
</script>

<template>
  <XYPlot
    :data="data"
    :series="[{ label: 'Pressure', width: 1 }]"
    aria-label="Dense pressure signal"
    aria-description="100,000 pressure samples across 500 seconds."
    x-label="Time (s)"
    y-label="Pressure"
  />
</template>

Streaming

Append bounded chunks. Calls in one animation frame become one draw.

const plot = useTemplateRef("plot");

function receiveSamples(chunk: XYPlotData) {
  // Calls within one frame become one uPlot update.
  // The oldest samples are removed at the limit.
  plot.value?.append(chunk, { maxPoints: 2_000 });
}

<XYPlot
  ref="plot"
  :data="initialData"
  :series="series"
  aria-label="Live residual plot"
  aria-description="Three residuals decrease over the solver iterations."
/>

Data States

The same frame provides loading, empty, and error states for both engines.

<Chart loading ... />
<Chart empty empty-label="No samples in this range" ... />
<Chart error="The data query failed." ... />

Performance

  • Use ECharts Canvas for normal dashboards and broad chart types.
  • Use XYPlot for dense aligned numeric series and sustained updates.
  • Use typed arrays for large static series. Do not put million-point arrays in deep Vue reactivity.
  • Aggregate and window million-point history before it reaches the browser. A renderer cannot remove transfer, parsing, and memory costs.
  • Batch live updates and keep a fixed point window. Stop subscriptions when the component unmounts or the view becomes inactive.

Accessibility

  • ariaLabel names the chart. ariaDescription states the visible range, units, series, and main trend.
  • Do not use color as the only series identifier. Keep labels or a linked data table available.
  • XYPlot supports drag, wheel, keyboard zoom, double-click reset, and a visible reset button.
  • Press plus or minus to zoom X. Hold Shift to zoom Y. Press 0 or Home to reset.
  • Loading, empty, and error messages use live status semantics.

Security

Treat engine options and callbacks as application code. Never pass serialized user configuration directly. Kappa removes ECharts HTML tooltip formatters, extra tooltip CSS, data view, and built-in image download from the standard option path. Use parsed and validated GeoJSON objects for maps.

API Reference

Chart

PropTypeDefaultDescription
engineChartEnginerequiredConfigured modular ECharts namespace.
optionsChartOptionsrequiredTrusted ECharts options with safe standard tooltips.
ariaLabelstringrequiredAccessible name for the rendered chart.
ariaDescriptionstringrequiredPlain-language data summary or interaction instructions.
title / descriptionstring—Compact visible heading and context.
heightCSS height | number"20rem"Stable plot body height. Numbers use pixels.
renderer"canvas" | "svg""canvas"Registered ECharts renderer.
loading / empty / errorboolean / boolean / stringfalse / false / —Complete data states.
eventsChartEvents—Stable event-to-handler map.
revisionstring | number0Reapplies options after controlled in-place mutation.
updateOptionsSetOptionOpts—ECharts setOption update behavior.

XYPlot

PropTypeDefaultDescription
dataXYPlotDatarequiredAligned X and Y columns. Typed arrays are supported.
seriesXYPlotSeries[]requiredOne definition for each Y column.
ariaLabel / ariaDescriptionstringrequiredAccessible chart name and data summary.
xScale"linear" | "time""linear"X-axis scale.
yScale"linear" | "log""linear"Y-axis scale.
zoom"none" | "x" | "xy""xy"Drag and keyboard zoom axes.
wheelZoombooleantrueWheel zooms X. Shift plus wheel zooms Y.
showLegend / showResetbooleantrueBuilt-in live legend and reset action.
nativeOptionsXYPlotNativeOptions—Trusted uPlot options for advanced composition.
revisionstring | number0Applies an in-place data mutation without a deep watcher.

Exposed Methods

ComponentMethodDescription
ChartgetInstance / resize / setOption / dispatchActionAccess the ECharts instance and imperative engine operations.
TimeseriesChartgetInstance / resize / setOption / dispatchActionAccess advanced ECharts operations when the opinionated API is not enough.
XYPlotgetInstance / resize / resetZoom / setData / setScaleControl the uPlot instance without deep Vue reactivity.
XYPlotappend / flushBatch bounded stream chunks into one animation-frame update.
XYPlotbatchRun multiple uPlot operations in one engine batch.

Exports

PathExports
@dicehub/kappa/components/chartChart, ChartProps, ChartOptions, ChartEngine, ChartInstance
@dicehub/kappa/components/xy-plotXYPlot, XYPlotProps, XYPlotData, XYPlotSeries, appendXYPlotData
@dicehub/kappa/components/timeseries-chartTimeseriesChart, TimeseriesChartProps, TimeseriesChartSeries, TimeseriesChartApi