0.6.26 • Published 12 months ago

@chartwerk/core v0.6.26

Weekly downloads
-
License
ISC
Repository
-
Last release
12 months ago

Chartwerk Core

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. Everything can be overwritted.

Plugin contains:

  • SVG container.
  • Series and Options models with defaults.
  • State model to control charts changes.
  • 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

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.
datapoints = [number, number][]; // 0 index for X, 1 index for Y 
  • target - id of metric. Required param, should be unique.
target: string;

Options:

Options is a config working for whole chart and metrics. All options are optional.

  • margin — chart container positioning;
margin = {
  top: number,
  right: number,
  bottom: number,
  left: number,
}
  • colors: array of metrics colors (should be equal or greater than series length);
['red', 'blue', 'green']
  • labelFormat: labels for axes.
{
  xAxis: string;
  yAxis: string;
}

for example:

{
  xAxis: 'Time';
  yAxis: 'Value';
}
  • bounds: specify which metrics should be rendered as confidence. (TODO: move to @chartwerk/line-chart) $__metric_name macro can be used here. It will be replaced with each metric's name to find it's bound.
{
  upper: string;
  lower: string;
}

for example: metric names: 'serie', 'serie upper_bound', 'serie lower_bound'

bounds={
  upper: '$__metric_name upper_bound';
  lower: '$__metric_name lower_bound';
}

'serie upper_bound', 'serie lower_bound' metrics will be rendered as serie metric confidence;

  • timeRange: time range in timestamps
{
  from: number;
  to: number;
}

for example:

{
  from: 1582770000000;
  to: 1582810000000;
}
  • eventsCallbacks: event callbacks
{
  zoomIn: (range: [number, number]) => void,
  zoomOut: (center: number) => void,
  mouseMove: (evt: any) => void,
  mouseOut: () => void,
  onLegendClick: (idx: number) => void
}
0.6.25

12 months ago

0.6.26

12 months ago

0.6.23

1 year ago

0.6.22

1 year ago

0.6.24

1 year ago

0.6.21

1 year ago

0.6.20

1 year ago

0.6.19

1 year ago

0.6.18

1 year ago

0.6.17

2 years ago

0.6.16

2 years ago

0.6.14

2 years ago

0.6.15

2 years ago

0.6.13

2 years ago

0.6.12

3 years ago

0.6.7

3 years ago

0.5.8

3 years ago

0.6.6

3 years ago

0.5.7

3 years ago

0.6.9

3 years ago

0.6.8

3 years ago

0.6.10

3 years ago

0.6.11

3 years ago

0.6.3

3 years ago

0.6.2

3 years ago

0.6.5

3 years ago

0.5.6

3 years ago

0.6.4

3 years ago

0.5.5

3 years ago

0.6.1

3 years ago

0.6.0

3 years ago

0.5.2-test

3 years ago

0.5.0-beta

3 years ago

0.5.2-test4

3 years ago

0.5.0-beta3

3 years ago

0.5.0-beta2

3 years ago

0.5.4

3 years ago

0.5.2-test3

3 years ago

0.5.3-test

3 years ago

0.5.3

3 years ago

0.5.2-test2

3 years ago

0.5.2-test1

3 years ago

0.5.0

3 years ago

0.4.1

3 years ago

0.4.0

3 years ago

0.5.2

3 years ago

0.5.1

3 years ago

0.3.9

3 years ago

0.3.10

3 years ago

0.3.6

3 years ago

0.3.8

3 years ago

0.3.7

3 years ago

0.3.5

3 years ago

0.3.4

4 years ago

0.3.3

4 years ago

0.3.0

4 years ago

0.2.0

4 years ago

0.3.2

4 years ago

0.3.1

4 years ago

0.1.1

4 years ago