Browse Source

Merge branch 'docs-update-1' into 'main'

Update docs

See merge request chartwerk/core!24
pull/2/head
Alexander Velikiy 2 years ago
parent
commit
a29c7a63d4
  1. 51
      README.md

51
README.md

@ -3,26 +3,59 @@
# Chartwerk Core # Chartwerk Core
Repo contains the core code of chartwerk project: abstrac classes and rendreing of grid together with crosshair! :) Repo contains the core code of chartwerk project: abstract classes, rendering system, basic components.
See ChartwerkPod to see what is parent for all chartwerk pods and get involved into development. See ChartwerkPod to see what is parent for all chartwerk pods and get involved into development.
Everything can be overwritted.
## Plugin renders: ## Plugin contains:
- SVG container with: - SVG container.
- Axes, with ticks and labels. - Series and Options models with defaults.
- Grid, which scales using specified time interval. - State model to control charts changes.
- Legend, which can hide metrics. - Overlay container to handle all events.
- Zoom events controller.
- Axes, with ticks and labels.
- Grid, with separate behavior from axis.
- Legend, which can hide metrics.
- Crosshair.
## Declare
```js
const pod = new ChartwerkPod(
document.getElementById('chart-div'),
series,
options,
);
pod.render();
```
## Series
Series is a list of metrics with datapoints and specific config working for each serie.
series = Serie[]
- `datapoints` - metric data for rendering.
```js
datapoints = [number, number][]; // 0 index for X, 1 index for Y
```
- `target` - id of metric. Required param, should be unique.
```js
target: string;
```
## Options: ## Options:
Options are not mandatory: Options is a config working for whole chart and metrics.
All options are optional.
- `margin` — chart container positioning; - `margin` — chart container positioning;
```js ```js
margin={ margin = {
top: number, top: number,
right: number, right: number,
bottom: number, bottom: number,
left: number left: number,
} }
``` ```

Loading…
Cancel
Save