# WebPivotTable

A professional-grade **pivot table & pivot chart** Web Component — framework-agnostic, works anywhere with a single `<script>` tag or via npm.

[![npm version](https://img.shields.io/npm/v/webpivottable.svg)](https://www.npmjs.com/package/webpivottable)

---

## Install

```bash
npm install webpivottable
# or
pnpm add webpivottable
# or
yarn add webpivottable
```

## Quick Start (CDN)

No build tools required — just add a script tag:

```html
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8" />
  <title>WebPivotTable Quick Start</title>
  <script type="module" src="https://cdn.webpivottable.com/wpt/latest/wpt.js"></script>
</head>
<body>
  <div style="width: 100%; height: 500px;">
    <web-pivot-table></web-pivot-table>
  </div>
</body>
</html>
```

## Quick Start (npm)

```js
import 'webpivottable'
```

Then use the custom element in your HTML or framework template:

```html
<web-pivot-table></web-pivot-table>
```

## Framework Integration

WebPivotTable works with any framework — React, Vue, Angular, Svelte, or plain HTML.

```jsx
// React example
import 'webpivottable'

export default function App() {
  return (
    <div style={{ width: '100%', height: '500px' }}>
      <web-pivot-table />
    </div>
  )
}
```

## Loading Data

Load data programmatically via JavaScript:

```js
const wpt = document.querySelector('web-pivot-table')

// Load from a CSV URL
wpt.setCsvUrl('https://example.com/data.csv')

// Or pass an array of objects directly
wpt.setData([
  { Region: 'East', Product: 'Widget', Sales: 100 },
  { Region: 'West', Product: 'Gadget', Sales: 200 },
])
```

## Options

Configure the component via the `options` attribute or `setOptions()`:

```js
const wpt = document.querySelector('web-pivot-table')
wpt.setOptions({ locale: 'zh' })
```

## Locales

Locale files are included in the package under `dist/locales/`. Load a locale to switch the UI language:

```html
<web-pivot-table locale="zh"></web-pivot-table>
```

## Documentation

For full documentation, live demos, API reference, and configuration options:

**[webpivottable.com/docs](https://webpivottable.com/docs)**

## Community & Support

- **Bug Reports**: [GitHub Issues](https://github.com/bright-sea/webpivottable/issues)
- **Questions / Discussions**: [GitHub Discussions](https://github.com/bright-sea/webpivottable/discussions)
- **Website**: [webpivottable.com](https://webpivottable.com)

## License

© 2026 Brightsea Inc. All rights reserved.

See [LICENSE](https://webpivottable.com/policy) for details.
