chartist 0.11.4 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE-WTFPL +5 -5
- package/README.md +142 -32
- package/dist/axes/AutoScaleAxis.d.ts +12 -0
- package/dist/axes/AutoScaleAxis.d.ts.map +1 -0
- package/dist/axes/Axis.d.ts +40 -0
- package/dist/axes/Axis.d.ts.map +1 -0
- package/dist/axes/FixedScaleAxis.d.ts +11 -0
- package/dist/axes/FixedScaleAxis.d.ts.map +1 -0
- package/dist/axes/StepAxis.d.ts +9 -0
- package/dist/axes/StepAxis.d.ts.map +1 -0
- package/dist/axes/index.d.ts +6 -0
- package/dist/axes/index.d.ts.map +1 -0
- package/dist/axes/types.d.ts +5 -0
- package/dist/axes/types.d.ts.map +1 -0
- package/dist/charts/BarChart/BarChart.d.ts +47 -0
- package/dist/charts/BarChart/BarChart.d.ts.map +1 -0
- package/dist/charts/BarChart/BarChart.types.d.ts +40 -0
- package/dist/charts/BarChart/BarChart.types.d.ts.map +1 -0
- package/dist/charts/BarChart/index.d.ts +3 -0
- package/dist/charts/BarChart/index.d.ts.map +1 -0
- package/dist/charts/BaseChart.d.ts +47 -0
- package/dist/charts/BaseChart.d.ts.map +1 -0
- package/dist/charts/LineChart/LineChart.d.ts +92 -0
- package/dist/charts/LineChart/LineChart.d.ts.map +1 -0
- package/dist/charts/LineChart/LineChart.types.d.ts +53 -0
- package/dist/charts/LineChart/LineChart.types.d.ts.map +1 -0
- package/dist/charts/LineChart/index.d.ts +3 -0
- package/dist/charts/LineChart/index.d.ts.map +1 -0
- package/dist/charts/PieChart/PieChart.d.ts +83 -0
- package/dist/charts/PieChart/PieChart.d.ts.map +1 -0
- package/dist/charts/PieChart/PieChart.types.d.ts +53 -0
- package/dist/charts/PieChart/PieChart.types.d.ts.map +1 -0
- package/dist/charts/PieChart/index.d.ts +3 -0
- package/dist/charts/PieChart/index.d.ts.map +1 -0
- package/dist/charts/index.d.ts +6 -0
- package/dist/charts/index.d.ts.map +1 -0
- package/dist/charts/types.d.ts +11 -0
- package/dist/charts/types.d.ts.map +1 -0
- package/dist/core/constants.d.ts +13 -0
- package/dist/core/constants.d.ts.map +1 -0
- package/dist/core/creation.d.ts +61 -0
- package/dist/core/creation.d.ts.map +1 -0
- package/dist/core/data/bounds.d.ts +14 -0
- package/dist/core/data/bounds.d.ts.map +1 -0
- package/dist/core/data/data.d.ts +23 -0
- package/dist/core/data/data.d.ts.map +1 -0
- package/dist/core/data/highLow.d.ts +13 -0
- package/dist/core/data/highLow.d.ts.map +1 -0
- package/dist/core/data/index.d.ts +7 -0
- package/dist/core/data/index.d.ts.map +1 -0
- package/dist/core/data/normalize.d.ts +11 -0
- package/dist/core/data/normalize.d.ts.map +1 -0
- package/dist/core/data/segments.d.ts +29 -0
- package/dist/core/data/segments.d.ts.map +1 -0
- package/dist/core/data/serialize.d.ts +12 -0
- package/dist/core/data/serialize.d.ts.map +1 -0
- package/dist/core/index.d.ts +8 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/lang.d.ts +23 -0
- package/dist/core/lang.d.ts.map +1 -0
- package/dist/core/math.d.ts +42 -0
- package/dist/core/math.d.ts.map +1 -0
- package/dist/core/optionsProvider.d.ts +15 -0
- package/dist/core/optionsProvider.d.ts.map +1 -0
- package/dist/core/types.d.ts +205 -0
- package/dist/core/types.d.ts.map +1 -0
- package/dist/event/EventEmitter.d.ts +27 -0
- package/dist/event/EventEmitter.d.ts.map +1 -0
- package/dist/event/index.d.ts +2 -0
- package/dist/event/index.d.ts.map +1 -0
- package/dist/index.cjs +3557 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.css +2 -0
- package/dist/index.css.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3497 -0
- package/dist/index.js.map +1 -0
- package/dist/index.umd.js +2 -0
- package/dist/index.umd.js.map +1 -0
- package/dist/interpolation/cardinal.d.ts +28 -0
- package/dist/interpolation/cardinal.d.ts.map +1 -0
- package/dist/interpolation/index.d.ts +6 -0
- package/dist/interpolation/index.d.ts.map +1 -0
- package/dist/interpolation/monotoneCubic.d.ts +28 -0
- package/dist/interpolation/monotoneCubic.d.ts.map +1 -0
- package/dist/interpolation/none.d.ts +20 -0
- package/dist/interpolation/none.d.ts.map +1 -0
- package/dist/interpolation/simple.d.ts +28 -0
- package/dist/interpolation/simple.d.ts.map +1 -0
- package/dist/interpolation/step.d.ts +24 -0
- package/dist/interpolation/step.d.ts.map +1 -0
- package/dist/svg/Svg.d.ts +201 -0
- package/dist/svg/Svg.d.ts.map +1 -0
- package/dist/svg/SvgList.d.ts +31 -0
- package/dist/svg/SvgList.d.ts.map +1 -0
- package/dist/svg/SvgPath.d.ts +125 -0
- package/dist/svg/SvgPath.d.ts.map +1 -0
- package/dist/svg/animation.d.ts +37 -0
- package/dist/svg/animation.d.ts.map +1 -0
- package/dist/svg/index.d.ts +6 -0
- package/dist/svg/index.d.ts.map +1 -0
- package/dist/svg/types.d.ts +54 -0
- package/dist/svg/types.d.ts.map +1 -0
- package/dist/utils/extend.d.ts +10 -0
- package/dist/utils/extend.d.ts.map +1 -0
- package/dist/utils/functional.d.ts +30 -0
- package/dist/utils/functional.d.ts.map +1 -0
- package/dist/utils/index.d.ts +5 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/types.d.ts +7 -0
- package/dist/utils/types.d.ts.map +1 -0
- package/dist/utils/utils.d.ts +27 -0
- package/dist/utils/utils.d.ts.map +1 -0
- package/package.json +39 -76
- package/CHANGELOG.md +0 -232
- package/dist/chartist.css +0 -615
- package/dist/chartist.css.map +0 -10
- package/dist/chartist.js +0 -4516
- package/dist/chartist.min.css +0 -1
- package/dist/chartist.min.js +0 -10
- package/dist/chartist.min.js.map +0 -1
- package/dist/scss/chartist.scss +0 -241
- package/dist/scss/settings/_chartist-settings.scss +0 -88
package/LICENSE-WTFPL
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
|
2
2
|
Version 2, December 2004
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
Everyone is permitted to copy and distribute verbatim or modified
|
|
7
|
+
copies of this license document, and changing it is allowed as long
|
|
8
|
+
as the name is changed.
|
|
9
9
|
|
|
10
10
|
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
|
11
|
-
|
|
11
|
+
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
|
12
12
|
|
|
13
13
|
0. You just DO WHAT THE FUCK YOU WANT TO.
|
package/README.md
CHANGED
|
@@ -1,33 +1,98 @@
|
|
|
1
1
|
# Big welcome by the Chartist Guy
|
|
2
2
|
|
|
3
|
-
[![
|
|
4
|
-
[![
|
|
3
|
+
[![NPM version][npm]][npm-url]
|
|
4
|
+
[![Downloads][downloads]][downloads-url]
|
|
5
|
+
[![Build status][build]][build-url]
|
|
6
|
+
[![Coverage status][coverage]][coverage-url]
|
|
7
|
+
[![Bundle size][size]][size-url]
|
|
8
|
+
[![Join the chat at https://gitter.im/gionkunz/chartist-js][chat]][chat-url]
|
|
5
9
|
|
|
6
|
-
|
|
10
|
+
[npm]: https://img.shields.io/npm/v/chartist.svg
|
|
11
|
+
[npm-url]: https://www.npmjs.com/package/chartist
|
|
7
12
|
|
|
8
|
-
|
|
13
|
+
[downloads]: https://img.shields.io/npm/dm/chartist.svg
|
|
14
|
+
[downloads-url]: https://www.npmjs.com/package/chartist
|
|
9
15
|
|
|
10
|
-
|
|
16
|
+
[build]: https://img.shields.io/github/workflow/status/chartist-js/chartist/CI.svg
|
|
17
|
+
[build-url]: https://github.com/chartist-js/chartist/actions
|
|
11
18
|
|
|
12
|
-
|
|
19
|
+
[coverage]: https://img.shields.io/codecov/c/github/chartist-js/chartist.svg
|
|
20
|
+
[coverage-url]: https://app.codecov.io/gh/chartist-js/chartist
|
|
13
21
|
|
|
14
|
-
|
|
22
|
+
[size]: https://img.shields.io/bundlephobia/minzip/chartist
|
|
23
|
+
[size-url]: https://bundlephobia.com/package/chartist
|
|
24
|
+
|
|
25
|
+
[chat]: https://badges.gitter.im/gionkunz/chartist-js.svg
|
|
26
|
+
[chat-url]: https://gitter.im/gionkunz/chartist-js?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge
|
|
27
|
+
|
|
28
|
+
<p align="center">
|
|
29
|
+
<img width="400" alt="The Chartist Guy" src="https://raw.github.com/chartist-js/chartist/master/site/images/chartist-guy.gif">
|
|
30
|
+
</p>
|
|
31
|
+
|
|
32
|
+
Chartist is a simple responsive charting library built with SVG. There are hundreds of nice charting libraries already
|
|
15
33
|
out there, but they are either:
|
|
16
34
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
35
|
+
- use the wrong technologies for illustration (canvas)
|
|
36
|
+
- weighs hundreds of kilobytes
|
|
37
|
+
- are not flexible enough while keeping the configuration simple
|
|
38
|
+
- are not friendly to designers
|
|
39
|
+
- more annoying things
|
|
40
|
+
|
|
41
|
+
That's why we started Chartist and our goal is to solve all of the above issues.
|
|
42
|
+
|
|
43
|
+
<hr />
|
|
44
|
+
<a href="#quickstart">Quickstart</a>
|
|
45
|
+
<span> • </span>
|
|
46
|
+
<a href="#what-is-it-made-for">What is it made for?</a>
|
|
47
|
+
<span> • </span>
|
|
48
|
+
<a href="#whats-new-in-v1">What's new in v1?</a>
|
|
49
|
+
<span> • </span>
|
|
50
|
+
<a href="#contribution">Contribution</a>
|
|
51
|
+
<hr />
|
|
52
|
+
|
|
53
|
+
## Quickstart
|
|
54
|
+
|
|
55
|
+
Install this library using your favorite package manager:
|
|
56
|
+
|
|
57
|
+
```sh
|
|
58
|
+
pnpm add chartist
|
|
59
|
+
# or
|
|
60
|
+
yarn add chartist
|
|
61
|
+
# or
|
|
62
|
+
npm i chartist
|
|
63
|
+
```
|
|
24
64
|
|
|
25
|
-
|
|
65
|
+
Then, just import chart you want and use it:
|
|
66
|
+
|
|
67
|
+
```js
|
|
68
|
+
import { BarChart } from 'chartist';
|
|
69
|
+
|
|
70
|
+
new BarChart('#chart', {
|
|
71
|
+
labels: ['W1', 'W2', 'W3', 'W4', 'W5', 'W6', 'W7', 'W8', 'W9', 'W10'],
|
|
72
|
+
series: [
|
|
73
|
+
[1, 2, 4, 8, 6, -2, -1, -4, -6, -2]
|
|
74
|
+
]
|
|
75
|
+
}, {
|
|
76
|
+
high: 10,
|
|
77
|
+
low: -10,
|
|
78
|
+
axisX: {
|
|
79
|
+
labelInterpolationFnc: (value, index) => (index % 2 === 0 ? value : null)
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
<br />
|
|
85
|
+
|
|
86
|
+
Need an API to fetch data? Consider [Cube](https://cube.dev/?ref=eco-chartist), an open-source API for data apps.
|
|
87
|
+
|
|
88
|
+
<br />
|
|
89
|
+
|
|
90
|
+
[](https://cube.dev/?ref=eco-chartist)
|
|
26
91
|
|
|
27
92
|
## What is it made for?
|
|
28
93
|
|
|
29
94
|
Chartist's goal is to provide a simple, lightweight and unintrusive library to responsively craft charts on your website.
|
|
30
|
-
It's important to understand that one of the main intentions of Chartist
|
|
95
|
+
It's important to understand that one of the main intentions of Chartist is to rely on standards rather than providing
|
|
31
96
|
it's own solution to a problem which is already solved by those standards. We need to leverage the power of browsers
|
|
32
97
|
today and say good bye to the idea of solving all problems ourselves.
|
|
33
98
|
|
|
@@ -36,29 +101,70 @@ also means that Chartist does not provide it's own event handling, labels, behav
|
|
|
36
101
|
done with plain HTML, JavaScript and CSS. The single and only responsibility of Chartist is to help you drawing "Simple
|
|
37
102
|
responsive Charts" using inline-SVG in the DOM, CSS to style and JavaScript to provide an API for configuring your charts.
|
|
38
103
|
|
|
39
|
-
##
|
|
104
|
+
## What's new in v1?
|
|
40
105
|
|
|
41
|
-
|
|
42
|
-
We are still developing and constantly add features but you can already use Chartist.js in your projects as we have
|
|
43
|
-
reached a stable and reliable state already.
|
|
106
|
+
### ESM
|
|
44
107
|
|
|
45
|
-
|
|
108
|
+
Now Chartist is truly an ES module and exposes its API through the exports, thus making Chartist [tree-shakable](https://developer.mozilla.org/en-US/docs/Glossary/Tree_shaking).
|
|
46
109
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
to the masses.
|
|
110
|
+
<details>
|
|
111
|
+
<summary>Migration from v0.11</summary>
|
|
50
112
|
|
|
51
|
-
|
|
113
|
+
- Each property of Chartist object now is named export.
|
|
114
|
+
- Chart classes were renamed.
|
|
115
|
+
- Easing object now is named export.
|
|
52
116
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
117
|
+
```js
|
|
118
|
+
const Chartist = require('chartist')
|
|
119
|
+
|
|
120
|
+
new Chartist.Bar(/* ... */);
|
|
121
|
+
new Chartist.Line(/* ... */);
|
|
122
|
+
new Chartist.Pie(/* ... */);
|
|
123
|
+
new Chartist.Svg(/* ... */);
|
|
124
|
+
Chartist.Svg.Easing
|
|
125
|
+
// ...
|
|
126
|
+
|
|
127
|
+
// ->
|
|
128
|
+
|
|
129
|
+
import { BarChart, LineChart, PieChart, Svg, easings } from 'chartist'
|
|
130
|
+
|
|
131
|
+
new BarChart(/* ... */)
|
|
132
|
+
new LineChart(/* ... */)
|
|
133
|
+
new PieChart(/* ... */)
|
|
134
|
+
new Svg(/* ... */)
|
|
135
|
+
easings
|
|
136
|
+
// ...
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
</details>
|
|
140
|
+
|
|
141
|
+
### TypeScript
|
|
142
|
+
|
|
143
|
+
Chartist was rewritten and fully typed with TypeScript.
|
|
144
|
+
|
|
145
|
+
<details>
|
|
146
|
+
<summary>Some of exposed types</summary>
|
|
147
|
+
|
|
148
|
+
```ts
|
|
149
|
+
import type {
|
|
150
|
+
BarChartData,
|
|
151
|
+
BarChartOptions,
|
|
152
|
+
LineChartData,
|
|
153
|
+
LineChartOptions,
|
|
154
|
+
PieChartData,
|
|
155
|
+
PieChartOptions
|
|
156
|
+
} from 'chartist'
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
</details>
|
|
59
160
|
|
|
60
161
|
## Plugins
|
|
61
162
|
|
|
163
|
+
Coming soon.
|
|
164
|
+
|
|
165
|
+
<details>
|
|
166
|
+
<summary>For v0.11</summary>
|
|
167
|
+
|
|
62
168
|
Some features aren't right for the core product
|
|
63
169
|
but there is a great set of plugins available
|
|
64
170
|
which add features like:
|
|
@@ -71,10 +177,14 @@ and more.
|
|
|
71
177
|
|
|
72
178
|
See all the plugins [here](https://gionkunz.github.io/chartist-js/plugins.html).
|
|
73
179
|
|
|
180
|
+
</details>
|
|
181
|
+
|
|
74
182
|
## Contribution
|
|
75
183
|
|
|
76
184
|
We are looking for people who share the idea of having a simple, flexible charting library that is responsive and uses
|
|
77
185
|
modern and future-proof technologies. The goal of this project is to create a responsive charting library where developers
|
|
78
|
-
have their joy in using it and designers love it because of the designing flexibility they have.
|
|
186
|
+
have their joy in using it and designers love it because of the designing flexibility they have. Please contribute
|
|
187
|
+
to the project if you like the idea and the concept and help us to bring nice looking responsive open-source charts
|
|
188
|
+
to the masses.
|
|
79
189
|
|
|
80
190
|
Contribute if you like the Chartist Guy!
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ChartRect, AxisOptions, NormalizedSeries, NormalizedSeriesPrimitiveValue } from '../core';
|
|
2
|
+
import { AxisUnits, Axis } from './Axis';
|
|
3
|
+
export declare class AutoScaleAxis extends Axis {
|
|
4
|
+
private readonly bounds;
|
|
5
|
+
readonly range: {
|
|
6
|
+
min: number;
|
|
7
|
+
max: number;
|
|
8
|
+
};
|
|
9
|
+
constructor(axisUnit: AxisUnits, data: NormalizedSeries[], chartRect: ChartRect, options: AxisOptions);
|
|
10
|
+
projectValue(value: NormalizedSeriesPrimitiveValue): number;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=AutoScaleAxis.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AutoScaleAxis.d.ts","sourceRoot":"","sources":["../../src/axes/AutoScaleAxis.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,SAAS,EACT,WAAW,EAEX,gBAAgB,EAChB,8BAA8B,EAC/B,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAEzC,qBAAa,aAAc,SAAQ,IAAI;IACrC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAChC,SAAyB,KAAK,EAAE;QAC9B,GAAG,EAAE,MAAM,CAAC;QACZ,GAAG,EAAE,MAAM,CAAC;KACb,CAAC;gBAGA,QAAQ,EAAE,SAAS,EACnB,IAAI,EAAE,gBAAgB,EAAE,EACxB,SAAS,EAAE,SAAS,EACpB,OAAO,EAAE,WAAW;IAqBtB,YAAY,CAAC,KAAK,EAAE,8BAA8B;CAOnD"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { Label, ChartRect, OptionsWithDefaults, NormalizedSeriesPrimitiveValue, NormalizedSeries } from '../core';
|
|
2
|
+
import type { Svg } from '../svg';
|
|
3
|
+
import type { EventEmitter } from '../event';
|
|
4
|
+
export declare const axisUnits: {
|
|
5
|
+
readonly x: {
|
|
6
|
+
readonly pos: "x";
|
|
7
|
+
readonly len: "width";
|
|
8
|
+
readonly dir: "horizontal";
|
|
9
|
+
readonly rectStart: "x1";
|
|
10
|
+
readonly rectEnd: "x2";
|
|
11
|
+
readonly rectOffset: "y2";
|
|
12
|
+
};
|
|
13
|
+
readonly y: {
|
|
14
|
+
readonly pos: "y";
|
|
15
|
+
readonly len: "height";
|
|
16
|
+
readonly dir: "vertical";
|
|
17
|
+
readonly rectStart: "y2";
|
|
18
|
+
readonly rectEnd: "y1";
|
|
19
|
+
readonly rectOffset: "x1";
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
export declare type XAxisUnits = typeof axisUnits.x;
|
|
23
|
+
export declare type YAxisUnits = typeof axisUnits.y;
|
|
24
|
+
export declare type AxisUnits = XAxisUnits | YAxisUnits;
|
|
25
|
+
export declare abstract class Axis {
|
|
26
|
+
readonly units: AxisUnits;
|
|
27
|
+
private readonly chartRect;
|
|
28
|
+
private readonly ticks;
|
|
29
|
+
readonly counterUnits: AxisUnits;
|
|
30
|
+
readonly range: {
|
|
31
|
+
min: number;
|
|
32
|
+
max: number;
|
|
33
|
+
} | undefined;
|
|
34
|
+
readonly axisLength: number;
|
|
35
|
+
private readonly gridOffset;
|
|
36
|
+
constructor(units: AxisUnits, chartRect: ChartRect, ticks: Label[]);
|
|
37
|
+
abstract projectValue(value: NormalizedSeriesPrimitiveValue | Label, index?: number, series?: NormalizedSeries): number;
|
|
38
|
+
createGridAndLabels(gridGroup: Svg, labelGroup: Svg, chartOptions: OptionsWithDefaults, eventEmitter: EventEmitter): void;
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=Axis.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Axis.d.ts","sourceRoot":"","sources":["../../src/axes/Axis.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,KAAK,EACL,SAAS,EACT,mBAAmB,EACnB,8BAA8B,EAC9B,gBAAgB,EACjB,MAAM,SAAS,CAAC;AACjB,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAC;AAClC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAI7C,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;CAiBZ,CAAC;AAEX,oBAAY,UAAU,GAAG,OAAO,SAAS,CAAC,CAAC,CAAC;AAC5C,oBAAY,UAAU,GAAG,OAAO,SAAS,CAAC,CAAC,CAAC;AAC5C,oBAAY,SAAS,GAAG,UAAU,GAAG,UAAU,CAAC;AAEhD,8BAAsB,IAAI;aAYN,KAAK,EAAE,SAAS;IAChC,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,KAAK;IAbxB,SAAgB,YAAY,EAAE,SAAS,CAAC;IACxC,SAAgB,KAAK,EACjB;QACE,GAAG,EAAE,MAAM,CAAC;QACZ,GAAG,EAAE,MAAM,CAAC;KACb,GACD,SAAS,CAAC;IACd,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAS;gBAGlB,KAAK,EAAE,SAAS,EACf,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE,KAAK,EAAE;IAQjC,QAAQ,CAAC,YAAY,CACnB,KAAK,EAAE,8BAA8B,GAAG,KAAK,EAC7C,KAAK,CAAC,EAAE,MAAM,EACd,MAAM,CAAC,EAAE,gBAAgB,GACxB,MAAM;IAET,mBAAmB,CACjB,SAAS,EAAE,GAAG,EACd,UAAU,EAAE,GAAG,EACf,YAAY,EAAE,mBAAmB,EACjC,YAAY,EAAE,YAAY;CAsG7B"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ChartRect, AxisOptions, NormalizedSeries, NormalizedSeriesPrimitiveValue } from '../core';
|
|
2
|
+
import { AxisUnits, Axis } from './Axis';
|
|
3
|
+
export declare class FixedScaleAxis extends Axis {
|
|
4
|
+
readonly range: {
|
|
5
|
+
min: number;
|
|
6
|
+
max: number;
|
|
7
|
+
};
|
|
8
|
+
constructor(axisUnit: AxisUnits, data: NormalizedSeries[], chartRect: ChartRect, options: AxisOptions);
|
|
9
|
+
projectValue(value: NormalizedSeriesPrimitiveValue): number;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=FixedScaleAxis.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FixedScaleAxis.d.ts","sourceRoot":"","sources":["../../src/axes/FixedScaleAxis.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,SAAS,EACT,WAAW,EACX,gBAAgB,EAChB,8BAA8B,EAC/B,MAAM,SAAS,CAAC;AAGjB,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAEzC,qBAAa,cAAe,SAAQ,IAAI;IACtC,SAAyB,KAAK,EAAE;QAC9B,GAAG,EAAE,MAAM,CAAC;QACZ,GAAG,EAAE,MAAM,CAAC;KACb,CAAC;gBAGA,QAAQ,EAAE,SAAS,EACnB,IAAI,EAAE,gBAAgB,EAAE,EACxB,SAAS,EAAE,SAAS,EACpB,OAAO,EAAE,WAAW;IAqBtB,YAAY,CAAC,KAAK,EAAE,8BAA8B;CAQnD"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ChartRect, AxisOptions } from '../core';
|
|
2
|
+
import { AxisUnits, Axis } from './Axis';
|
|
3
|
+
export declare class StepAxis extends Axis {
|
|
4
|
+
private readonly stepLength;
|
|
5
|
+
readonly stretch: boolean;
|
|
6
|
+
constructor(axisUnit: AxisUnits, _data: unknown, chartRect: ChartRect, options: AxisOptions);
|
|
7
|
+
projectValue(_value: unknown, index: number): number;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=StepAxis.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StepAxis.d.ts","sourceRoot":"","sources":["../../src/axes/StepAxis.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAEzC,qBAAa,QAAS,SAAQ,IAAI;IAChC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAS;IACpC,SAAgB,OAAO,EAAE,OAAO,CAAC;gBAG/B,QAAQ,EAAE,SAAS,EACnB,KAAK,EAAE,OAAO,EACd,SAAS,EAAE,SAAS,EACpB,OAAO,EAAE,WAAW;IAWtB,YAAY,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM;CAG5C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/axes/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { AutoScaleAxis } from './AutoScaleAxis';
|
|
2
|
+
import type { FixedScaleAxis } from './FixedScaleAxis';
|
|
3
|
+
import type { StepAxis } from './StepAxis';
|
|
4
|
+
export declare type AxisType = typeof AutoScaleAxis | typeof FixedScaleAxis | typeof StepAxis;
|
|
5
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/axes/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C,oBAAY,QAAQ,GAChB,OAAO,aAAa,GACpB,OAAO,cAAc,GACrB,OAAO,QAAQ,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { BarChartData, BarChartOptions, BarChartOptionsWithDefaults, BarChartEventsTypes } from './BarChart.types';
|
|
2
|
+
import type { ResponsiveOptions } from '../../core';
|
|
3
|
+
import { BaseChart } from '../BaseChart';
|
|
4
|
+
export declare class BarChart extends BaseChart<BarChartEventsTypes> {
|
|
5
|
+
protected data: BarChartData;
|
|
6
|
+
/**
|
|
7
|
+
* This method creates a new bar chart and returns API object that you can use for later changes.
|
|
8
|
+
* @param query A selector query string or directly a DOM element
|
|
9
|
+
* @param data The data object that needs to consist of a labels and a series array
|
|
10
|
+
* @param options The options object with options that override the default options. Check the examples for a detailed list.
|
|
11
|
+
* @param responsiveOptions Specify an array of responsive option arrays which are a media query and options object pair => [[mediaQueryString, optionsObject],[more...]]
|
|
12
|
+
* @return An object which exposes the API for the created chart
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* // Create a simple bar chart
|
|
16
|
+
* const data = {
|
|
17
|
+
* labels: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri'],
|
|
18
|
+
* series: [
|
|
19
|
+
* [5, 2, 4, 2, 0]
|
|
20
|
+
* ]
|
|
21
|
+
* };
|
|
22
|
+
*
|
|
23
|
+
* // In the global name space Chartist we call the Bar function to initialize a bar chart. As a first parameter we pass in a selector where we would like to get our chart created and as a second parameter we pass our data object.
|
|
24
|
+
* new BarChart('.ct-chart', data);
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* // This example creates a bipolar grouped bar chart where the boundaries are limitted to -10 and 10
|
|
28
|
+
* new BarChart('.ct-chart', {
|
|
29
|
+
* labels: [1, 2, 3, 4, 5, 6, 7],
|
|
30
|
+
* series: [
|
|
31
|
+
* [1, 3, 2, -5, -3, 1, -6],
|
|
32
|
+
* [-5, -2, -4, -1, 2, -3, 1]
|
|
33
|
+
* ]
|
|
34
|
+
* }, {
|
|
35
|
+
* seriesBarDistance: 12,
|
|
36
|
+
* low: -10,
|
|
37
|
+
* high: 10
|
|
38
|
+
* });
|
|
39
|
+
*
|
|
40
|
+
*/
|
|
41
|
+
constructor(query: string | Element | null, data: BarChartData, options?: BarChartOptions, responsiveOptions?: ResponsiveOptions<BarChartOptions>);
|
|
42
|
+
/**
|
|
43
|
+
* Creates a new chart
|
|
44
|
+
*/
|
|
45
|
+
createChart(options: BarChartOptionsWithDefaults): void;
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=BarChart.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BarChart.d.ts","sourceRoot":"","sources":["../../../src/charts/BarChart/BarChart.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,YAAY,EACZ,eAAe,EACf,2BAA2B,EAG3B,mBAAmB,EACpB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAoB,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAmBtE,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAkHzC,qBAAa,QAAS,SAAQ,SAAS,CAAC,mBAAmB,CAAC;cAsCrC,IAAI,EAAE,YAAY;IArCvC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAkCG;gBAED,KAAK,EAAE,MAAM,GAAG,OAAO,GAAG,IAAI,EACX,IAAI,EAAE,YAAY,EACrC,OAAO,CAAC,EAAE,eAAe,EACzB,iBAAiB,CAAC,EAAE,iBAAiB,CAAC,eAAe,CAAC;IAWxD;;OAEG;IACH,WAAW,CAAC,OAAO,EAAE,2BAA2B;CAkYjD"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { Options, AxisOptions, Data, CreatedEvent, DrawEvent, NormalizedMulti, AxesDrawEvent } from '../../core';
|
|
2
|
+
import type { RequiredKeys } from '../../utils';
|
|
3
|
+
import type { BaseChartEventsTypes } from '../types';
|
|
4
|
+
export declare type BarChartData = Data;
|
|
5
|
+
export interface BarChartOptions<TXAxisOptions = AxisOptions, TYAxisOptions = TXAxisOptions> extends Options<TXAxisOptions, TYAxisOptions> {
|
|
6
|
+
classNames?: {
|
|
7
|
+
chart?: string;
|
|
8
|
+
horizontalBars?: string;
|
|
9
|
+
label?: string;
|
|
10
|
+
labelGroup?: string;
|
|
11
|
+
series?: string;
|
|
12
|
+
bar?: string;
|
|
13
|
+
grid?: string;
|
|
14
|
+
gridGroup?: string;
|
|
15
|
+
gridBackground?: string;
|
|
16
|
+
vertical?: string;
|
|
17
|
+
horizontal?: string;
|
|
18
|
+
start?: string;
|
|
19
|
+
end?: string;
|
|
20
|
+
};
|
|
21
|
+
seriesBarDistance?: number;
|
|
22
|
+
stackBars?: boolean;
|
|
23
|
+
stackMode?: 'accumulate' | boolean;
|
|
24
|
+
horizontalBars?: boolean;
|
|
25
|
+
distributeSeries?: boolean;
|
|
26
|
+
reverseData?: boolean;
|
|
27
|
+
showGridBackground?: boolean;
|
|
28
|
+
}
|
|
29
|
+
export declare type BarChartOptionsWithDefaults = RequiredKeys<BarChartOptions<RequiredKeys<AxisOptions, 'offset' | 'position' | 'labelOffset' | 'showLabel' | 'showGrid' | 'labelInterpolationFnc' | 'scaleMinSpace'>, RequiredKeys<AxisOptions, 'offset' | 'position' | 'labelOffset' | 'showLabel' | 'showGrid' | 'labelInterpolationFnc' | 'scaleMinSpace'>>, 'referenceValue' | 'chartPadding' | 'seriesBarDistance' | 'stackMode' | 'axisX' | 'axisY', 'classNames'>;
|
|
30
|
+
export declare type BarChartCreatedEvent = CreatedEvent<BarChartOptions>;
|
|
31
|
+
export interface BarDrawEvent extends DrawEvent {
|
|
32
|
+
type: 'bar';
|
|
33
|
+
value: number | NormalizedMulti;
|
|
34
|
+
x1: number;
|
|
35
|
+
y1: number;
|
|
36
|
+
x2: number;
|
|
37
|
+
y2: number;
|
|
38
|
+
}
|
|
39
|
+
export declare type BarChartEventsTypes = BaseChartEventsTypes<BarChartCreatedEvent, AxesDrawEvent | BarDrawEvent>;
|
|
40
|
+
//# sourceMappingURL=BarChart.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BarChart.types.d.ts","sourceRoot":"","sources":["../../../src/charts/BarChart/BarChart.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,OAAO,EACP,WAAW,EACX,IAAI,EACJ,YAAY,EACZ,SAAS,EACT,eAAe,EACf,aAAa,EACd,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAErD,oBAAY,YAAY,GAAG,IAAI,CAAC;AAEhC,MAAM,WAAW,eAAe,CAC9B,aAAa,GAAG,WAAW,EAC3B,aAAa,GAAG,aAAa,CAC7B,SAAQ,OAAO,CAAC,aAAa,EAAE,aAAa,CAAC;IAC7C,UAAU,CAAC,EAAE;QACX,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,GAAG,CAAC,EAAE,MAAM,CAAC;KACd,CAAC;IACF,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,SAAS,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC;IACnC,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B;AAED,oBAAY,2BAA2B,GAAG,YAAY,CACpD,eAAe,CACb,YAAY,CACV,WAAW,EACT,QAAQ,GACR,UAAU,GACV,aAAa,GACb,WAAW,GACX,UAAU,GACV,uBAAuB,GACvB,eAAe,CAClB,EACD,YAAY,CACV,WAAW,EACT,QAAQ,GACR,UAAU,GACV,aAAa,GACb,WAAW,GACX,UAAU,GACV,uBAAuB,GACvB,eAAe,CAClB,CACF,EACC,gBAAgB,GAChB,cAAc,GACd,mBAAmB,GACnB,WAAW,GACX,OAAO,GACP,OAAO,EACT,YAAY,CACb,CAAC;AAEF,oBAAY,oBAAoB,GAAG,YAAY,CAAC,eAAe,CAAC,CAAC;AAEjE,MAAM,WAAW,YAAa,SAAQ,SAAS;IAC7C,IAAI,EAAE,KAAK,CAAC;IACZ,KAAK,EAAE,MAAM,GAAG,eAAe,CAAC;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,oBAAY,mBAAmB,GAAG,oBAAoB,CACpD,oBAAoB,EACpB,aAAa,GAAG,YAAY,CAC7B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/charts/BarChart/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { Data, Options, ResponsiveOptions } from '../core';
|
|
2
|
+
import type { Svg } from '../svg';
|
|
3
|
+
import type { BaseChartEventsTypes } from './types';
|
|
4
|
+
import { EventListener, AllEventsListener, EventEmitter } from '../event';
|
|
5
|
+
export declare abstract class BaseChart<TEventsTypes = BaseChartEventsTypes> {
|
|
6
|
+
protected data: Data;
|
|
7
|
+
private readonly defaultOptions;
|
|
8
|
+
private options;
|
|
9
|
+
private readonly responsiveOptions?;
|
|
10
|
+
protected svg?: Svg;
|
|
11
|
+
protected readonly container: Element;
|
|
12
|
+
protected readonly eventEmitter: EventEmitter;
|
|
13
|
+
private readonly resizeListener;
|
|
14
|
+
private initializeTimeoutId;
|
|
15
|
+
private optionsProvider?;
|
|
16
|
+
constructor(query: string | Element | null, data: Data, defaultOptions: Options, options: Options, responsiveOptions?: ResponsiveOptions<Options<import("../core").AxisOptions, import("../core").AxisOptions>> | undefined);
|
|
17
|
+
abstract createChart(options: Options): void;
|
|
18
|
+
/**
|
|
19
|
+
* Updates the chart which currently does a full reconstruction of the SVG DOM
|
|
20
|
+
* @param data Optional data you'd like to set for the chart before it will update. If not specified the update method will use the data that is already configured with the chart.
|
|
21
|
+
* @param options Optional options you'd like to add to the previous options for the chart before it will update. If not specified the update method will use the options that have been already configured with the chart.
|
|
22
|
+
* @param override If set to true, the passed options will be used to extend the options that have been configured already. Otherwise the chart default options will be used as the base
|
|
23
|
+
*/
|
|
24
|
+
update(data?: Data, options?: Options, override?: boolean): this;
|
|
25
|
+
/**
|
|
26
|
+
* This method can be called on the API object of each chart and will un-register all event listeners that were added to other components. This currently includes a window.resize listener as well as media query listeners if any responsive options have been provided. Use this function if you need to destroy and recreate Chartist charts dynamically.
|
|
27
|
+
*/
|
|
28
|
+
detach(): this;
|
|
29
|
+
/**
|
|
30
|
+
* Use this function to register event handlers. The handler callbacks are synchronous and will run in the main thread rather than the event loop.
|
|
31
|
+
* @param event Name of the event. Check the examples for supported events.
|
|
32
|
+
* @param listener The handler function that will be called when an event with the given name was emitted. This function will receive a data argument which contains event data. See the example for more details.
|
|
33
|
+
*/
|
|
34
|
+
on<T extends keyof TEventsTypes>(event: T, listener: EventListener<TEventsTypes[T]>): this;
|
|
35
|
+
on(event: '*', listener: AllEventsListener): this;
|
|
36
|
+
on(event: string, listener: EventListener): this;
|
|
37
|
+
/**
|
|
38
|
+
* Use this function to un-register event handlers. If the handler function parameter is omitted all handlers for the given event will be un-registered.
|
|
39
|
+
* @param event Name of the event for which a handler should be removed
|
|
40
|
+
* @param listener The handler function that that was previously used to register a new event handler. This handler will be removed from the event handler list. If this parameter is omitted then all event handlers for the given event are removed from the list.
|
|
41
|
+
*/
|
|
42
|
+
off<T extends keyof TEventsTypes>(event: T, listener?: EventListener<TEventsTypes[T]>): this;
|
|
43
|
+
off(event: '*', listener?: AllEventsListener): this;
|
|
44
|
+
off(event: string, listener?: EventListener): this;
|
|
45
|
+
initialize(): void;
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=BaseChart.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BaseChart.d.ts","sourceRoot":"","sources":["../../src/charts/BaseChart.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,OAAO,EAAa,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAC3E,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAC;AAClC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAGpD,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAI1E,8BAAsB,SAAS,CAAC,YAAY,GAAG,oBAAoB;IAe/D,SAAS,CAAC,IAAI,EAAE,IAAI;IACpB,OAAO,CAAC,QAAQ,CAAC,cAAc;IAC/B,OAAO,CAAC,OAAO;IACf,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAC;IAjBrC,SAAS,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC;IACpB,SAAS,CAAC,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IACtC,SAAS,CAAC,QAAQ,CAAC,YAAY,eAAsB;IACrD,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAuB;IAGtD,OAAO,CAAC,mBAAmB,CAGzB;IACF,OAAO,CAAC,eAAe,CAAC,CAA2B;gBAGjD,KAAK,EAAE,MAAM,GAAG,OAAO,GAAG,IAAI,EACpB,IAAI,EAAE,IAAI,EACH,cAAc,EAAE,OAAO,EAChC,OAAO,EAAE,OAAO,EACP,iBAAiB,CAAC,sGAA4B;IAqBjE,QAAQ,CAAC,WAAW,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI;IAQ5C;;;;;OAKG;IACH,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,EAAE,OAAO,EAAE,QAAQ,UAAQ;IAwCvD;;OAEG;IACH,MAAM;IAeN;;;;OAIG;IACH,EAAE,CAAC,CAAC,SAAS,MAAM,YAAY,EAC7B,KAAK,EAAE,CAAC,EACR,QAAQ,EAAE,aAAa,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,GACvC,IAAI;IACP,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,iBAAiB,GAAG,IAAI;IACjD,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,aAAa,GAAG,IAAI;IAOhD;;;;OAIG;IACH,GAAG,CAAC,CAAC,SAAS,MAAM,YAAY,EAC9B,KAAK,EAAE,CAAC,EACR,QAAQ,CAAC,EAAE,aAAa,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,GACxC,IAAI;IACP,GAAG,CAAC,KAAK,EAAE,GAAG,EAAE,QAAQ,CAAC,EAAE,iBAAiB,GAAG,IAAI;IACnD,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,aAAa,GAAG,IAAI;IAOlD,UAAU;CAuCX"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import type { LineChartData, LineChartOptions, LineChartOptionsWithDefaults, LineChartEventsTypes } from './LineChart.types';
|
|
2
|
+
import type { Series, SeriesObject, ResponsiveOptions } from '../../core';
|
|
3
|
+
import { BaseChart } from './../BaseChart';
|
|
4
|
+
export declare function getSeriesOption<T extends keyof Omit<LineChartOptionsWithDefaults, 'series'>>(series: Series | SeriesObject, options: LineChartOptionsWithDefaults, key: T): LineChartOptionsWithDefaults[T];
|
|
5
|
+
export declare class LineChart extends BaseChart<LineChartEventsTypes> {
|
|
6
|
+
protected data: LineChartData;
|
|
7
|
+
/**
|
|
8
|
+
* This method creates a new line chart.
|
|
9
|
+
* @param query A selector query string or directly a DOM element
|
|
10
|
+
* @param data The data object that needs to consist of a labels and a series array
|
|
11
|
+
* @param options The options object with options that override the default options. Check the examples for a detailed list.
|
|
12
|
+
* @param responsiveOptions Specify an array of responsive option arrays which are a media query and options object pair => [[mediaQueryString, optionsObject],[more...]]
|
|
13
|
+
* @return An object which exposes the API for the created chart
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* // Create a simple line chart
|
|
17
|
+
* const data = {
|
|
18
|
+
* // A labels array that can contain any sort of values
|
|
19
|
+
* labels: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri'],
|
|
20
|
+
* // Our series array that contains series objects or in this case series data arrays
|
|
21
|
+
* series: [
|
|
22
|
+
* [5, 2, 4, 2, 0]
|
|
23
|
+
* ]
|
|
24
|
+
* };
|
|
25
|
+
*
|
|
26
|
+
* // As options we currently only set a static size of 300x200 px
|
|
27
|
+
* const options = {
|
|
28
|
+
* width: '300px',
|
|
29
|
+
* height: '200px'
|
|
30
|
+
* };
|
|
31
|
+
*
|
|
32
|
+
* // In the global name space Chartist we call the Line function to initialize a line chart. As a first parameter we pass in a selector where we would like to get our chart created. Second parameter is the actual data object and as a third parameter we pass in our options
|
|
33
|
+
* new LineChart('.ct-chart', data, options);
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* // Use specific interpolation function with configuration from the Chartist.Interpolation module
|
|
37
|
+
*
|
|
38
|
+
* const chart = new LineChart('.ct-chart', {
|
|
39
|
+
* labels: [1, 2, 3, 4, 5],
|
|
40
|
+
* series: [
|
|
41
|
+
* [1, 1, 8, 1, 7]
|
|
42
|
+
* ]
|
|
43
|
+
* }, {
|
|
44
|
+
* lineSmooth: Chartist.Interpolation.cardinal({
|
|
45
|
+
* tension: 0.2
|
|
46
|
+
* })
|
|
47
|
+
* });
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* // Create a line chart with responsive options
|
|
51
|
+
*
|
|
52
|
+
* const data = {
|
|
53
|
+
* // A labels array that can contain any sort of values
|
|
54
|
+
* labels: ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday'],
|
|
55
|
+
* // Our series array that contains series objects or in this case series data arrays
|
|
56
|
+
* series: [
|
|
57
|
+
* [5, 2, 4, 2, 0]
|
|
58
|
+
* ]
|
|
59
|
+
* };
|
|
60
|
+
*
|
|
61
|
+
* // In addition to the regular options we specify responsive option overrides that will override the default configutation based on the matching media queries.
|
|
62
|
+
* const responsiveOptions = [
|
|
63
|
+
* ['screen and (min-width: 641px) and (max-width: 1024px)', {
|
|
64
|
+
* showPoint: false,
|
|
65
|
+
* axisX: {
|
|
66
|
+
* labelInterpolationFnc: function(value) {
|
|
67
|
+
* // Will return Mon, Tue, Wed etc. on medium screens
|
|
68
|
+
* return value.slice(0, 3);
|
|
69
|
+
* }
|
|
70
|
+
* }
|
|
71
|
+
* }],
|
|
72
|
+
* ['screen and (max-width: 640px)', {
|
|
73
|
+
* showLine: false,
|
|
74
|
+
* axisX: {
|
|
75
|
+
* labelInterpolationFnc: function(value) {
|
|
76
|
+
* // Will return M, T, W etc. on small screens
|
|
77
|
+
* return value[0];
|
|
78
|
+
* }
|
|
79
|
+
* }
|
|
80
|
+
* }]
|
|
81
|
+
* ];
|
|
82
|
+
*
|
|
83
|
+
* new LineChart('.ct-chart', data, null, responsiveOptions);
|
|
84
|
+
*
|
|
85
|
+
*/
|
|
86
|
+
constructor(query: string | Element | null, data: LineChartData, options?: LineChartOptions, responsiveOptions?: ResponsiveOptions<LineChartOptions>);
|
|
87
|
+
/**
|
|
88
|
+
* Creates a new chart
|
|
89
|
+
*/
|
|
90
|
+
createChart(options: LineChartOptionsWithDefaults): void;
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=LineChart.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LineChart.d.ts","sourceRoot":"","sources":["../../../src/charts/LineChart/LineChart.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,aAAa,EACb,gBAAgB,EAChB,4BAA4B,EAK5B,oBAAoB,EACrB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAEV,MAAM,EACN,YAAY,EACZ,iBAAiB,EAClB,MAAM,YAAY,CAAC;AAapB,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,wBAAgB,eAAe,CAC7B,CAAC,SAAS,MAAM,IAAI,CAAC,4BAA4B,EAAE,QAAQ,CAAC,EAE5D,MAAM,EAAE,MAAM,GAAG,YAAY,EAC7B,OAAO,EAAE,4BAA4B,EACrC,GAAG,EAAE,CAAC,mCAeP;AAoGD,qBAAa,SAAU,SAAQ,SAAS,CAAC,oBAAoB,CAAC;cAkFvC,IAAI,EAAE,aAAa;IAjFxC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8EG;gBAED,KAAK,EAAE,MAAM,GAAG,OAAO,GAAG,IAAI,EACX,IAAI,EAAE,aAAa,EACtC,OAAO,CAAC,EAAE,gBAAgB,EAC1B,iBAAiB,CAAC,EAAE,iBAAiB,CAAC,gBAAgB,CAAC;IAWzD;;OAEG;IACH,WAAW,CAAC,OAAO,EAAE,4BAA4B;CA0TlD"}
|