Skip to content

codexguy/bicharts

Repository files navigation

Business Intelligence Champions (BIC) Charts

A generated chart is source you own, not a service you call.

These packages let a chart generated by the Business Intelligence Champions (BIC) backend run in any web page — React, Svelte, plain HTML — with no API key at run time, no per-render cost, and no network call. The chart is a plain render(container, data, options) function you commit to your repository. This is the host side: the code that runs it correctly.

The same contract is implemented by the BIC Power BI visual, so a chart looks and behaves the same wherever it runs. That is the whole point.

Package What it is
@bicharts/chart-host Runs a generated chart in a web host: compiles it, applies the shared option defaults, resolves mark clicks, owns the selection affordance, translates row indices between cross-filtered charts, and tears down cleanly. React bindings included.
@bicharts/shape-core Measures the shape of a dataset — types, cardinality, temporal/ordinal detection, geographic region and point resolution, cross-column signals. Measurement only; the policy that decides what a shape means lives server-side.

Quick start

npm install @bicharts/chart-host d3@7
import * as d3 from "d3";
import { BicChart, BicChartGroup } from "@bicharts/chart-host/react";
import code from "./charts/revenue/chart.js?raw";

<BicChartGroup columns={columns} rows={rows}>
  <BicChart id="revenue" code={code} d3={d3} options={{ width, height }} />
  <BicChart id="detail"  code={detail} d3={d3} options={{ width, height }} />
</BicChartGroup>

Clicking a mark in one chart filters the other. See the package README for the vanilla API, sizing rules, maps, d3 plugins, and the row-index hazard you must not hand-roll.

Why these exist as open source

The interesting part of BIC is the generation — choosing a chart type for a dataset and writing code that renders it correctly. That stays a paid service. The part that runs the result is plumbing, and plumbing is worth more to everyone as a shared, inspectable thing than as a private one. Making it Apache-2.0 also means a chart you generated is yours in a way a proprietary runtime could never promise.

Development

npm install          # workspaces: both packages, linked
npm run build        # esbuild bundles + .d.ts for each package
npm test             # vitest across both

packages/chart-host bundles shape-core into its published artifact, so consumers get one self-contained package; shape-core also publishes independently for callers that only want the profiler.

Do not consume these by path alias. A package consumed by alias is not a package — it will appear to work while shipping a tarball nobody can install. The published artifact is verified by installing it into a freshly scaffolded app outside this repository.

Licence

Apache-2.0 — see LICENSE.

The packages embed geographic reference data. One source carries a condition, not a courtesy: city and administrative coordinates come from GeoNames under CC BY 4.0, and that attribution must travel with any redistribution — including an application that bundles these packages. It is in NOTICE and in a banner comment at the top of every built file, so keeping either satisfies it. Country polygons (Natural Earth) and US state/ZIP boundaries (US Census/TIGER) are public domain.

About

Run a generated D3 chart in any web page: mark hit-resolution, selection affordance, cross-chart filtering, and a host-agnostic data-shape profiler. Apache-2.0.

Topics

Resources

Contributing

Security policy

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages