abstract-chart 3.2.1 → 3.2.3

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/CHANGELOG.md CHANGED
@@ -1,15 +1,15 @@
1
- # Change Log
2
-
3
- All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/).
4
-
5
- ## [Unreleased](https://github.com/promaster-sdk/property/compare/abstract-chart@3.0.0...master)
6
-
7
- ## [v0.0.0](https://github.com/promaster-sdk/property/compare/abstract-chart@3.0.0...abstract-chart@2.0.5) - 2021-01-01
8
-
9
- ### Added
10
-
11
- - To be determined
12
-
13
- ## v3.0.0 - 2021-03-24
14
-
15
- - Start of changelog.
1
+ # Change Log
2
+
3
+ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/).
4
+
5
+ ## [Unreleased](https://github.com/promaster-sdk/property/compare/abstract-chart@3.2.3...master)
6
+
7
+ ## [v3.2.1](https://github.com/promaster-sdk/property/compare/abstract-chart@3.0.0...abstract-chart@3.2.1) - 2022-06-02
8
+
9
+ ### Added
10
+
11
+ - Support for other font than Arial.
12
+
13
+ ## v3.0.0 - 2021-03-24
14
+
15
+ - Start of changelog.
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2018 Divid AB
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2018 Divid AB
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,106 +1,106 @@
1
- # abstract-chart
2
-
3
- [![npm version][version-image]][version-url]
4
- [![code style: prettier][prettier-image]][prettier-url]
5
- [![MIT license][license-image]][license-url]
6
-
7
- Drawing charts using multiple unit of measure axes as coordinate system
8
-
9
- ## Introduction
10
-
11
- When drawing complex scientific charts, regular line/bar/pie chart libraries are not very useful. This aim of this library is to enable any chart to be drawn, no matter how complex. This is achieved by treating the chart as a canvas where you can draw anything, but in constract to a regular canvas, the chart has a coordinate system specified by axes that can be of different units of measure. You can have multiple coordinate systems overlayed in the same chart by adding more axes to the chart.
12
-
13
- The chart is created as an abstract representation which can then be converted to an [abstract-image] which then in turn can be realised into different concrete formats such as .png, .svg etc.
14
-
15
- ## Installation
16
-
17
- `npm install --save abstract-chart`
18
-
19
- The library is compiled to ES5 and no polyfills are required.
20
-
21
- ## Usage
22
-
23
- Example of chart <a href="https://www.xkcd.com/1612/">XKCD 1612</a>, "The worst part of colds".
24
-
25
- ```typescript
26
- import * as React from "react";
27
- import * as AbstractChart from "abstract-chart";
28
- import * as AbstractImage from "abstract-image";
29
-
30
- const svg = AbstractImage.createSvg(
31
- AbstractChart.renderChart(generateLineChart())
32
- );
33
-
34
- function generateLineChart(): AbstractChart.Chart {
35
- const series = [
36
- AbstractChart.createChartLine({
37
- points: [
38
- { x: 0, y: 0 },
39
- { x: 1, y: 2 },
40
- { x: 2, y: 4 },
41
- { x: 3, y: 1.5 },
42
- { x: 4, y: 1 },
43
- { x: 5, y: 0 },
44
- { x: 6, y: 0 },
45
- { x: 7, y: 0 },
46
- { x: 8, y: 0 }
47
- ],
48
- color: AbstractImage.red,
49
- label: "How bad you feel",
50
- xAxis: "bottom",
51
- yAxis: "left"
52
- }),
53
- AbstractChart.createChartLine({
54
- points: [
55
- { x: 0, y: 0 },
56
- { x: 1, y: 0 },
57
- { x: 2, y: 0 },
58
- { x: 3, y: 1 },
59
- { x: 4, y: 2 },
60
- { x: 5, y: 3 },
61
- { x: 6, y: 2.8 },
62
- { x: 7, y: 2 },
63
- { x: 8, y: 1.5 }
64
- ],
65
- color: AbstractImage.blue,
66
- label: "How bad you sound",
67
- xAxis: "bottom",
68
- yAxis: "left"
69
- })
70
- ];
71
-
72
- const [xMin, xMax] = getLineRange(series, point => point.x);
73
- const [yMin, yMax] = getLineRange(series, point => point.y);
74
-
75
- const chart = AbstractChart.createChart({
76
- chartLines: series,
77
- xAxisBottom: AbstractChart.createLinearAxis(xMin, xMax, "Days with cold"),
78
- yAxisLeft: AbstractChart.createLinearAxis(yMin, yMax + 1, "Badness"),
79
- labelLayout: "center"
80
- });
81
-
82
- return chart;
83
- }
84
-
85
- function getLineRange(
86
- series: AbstractChart.ChartLine[],
87
- axisSelector: (point: AbstractImage.Point) => number
88
- ): [number, number] {
89
- const axisValues = series.map(serie => serie.points.map(axisSelector)).reduce(
90
- (soFar, current) => {
91
- return [...soFar, ...current];
92
- },
93
- [] as ReadonlyArray<number>
94
- );
95
- return [Math.min(...axisValues), Math.max(...axisValues)];
96
- }
97
- ```
98
-
99
- [version-image]: https://img.shields.io/npm/v/abstract-chart.svg?style=flat
100
- [version-url]: https://www.npmjs.com/package/abstract-chart
101
- [license-image]: https://img.shields.io/github/license/dividab/abstract-visuals.svg?style=flat
102
- [license-url]: https://opensource.org/licenses/MIT
103
- [prettier-image]: https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat
104
- [prettier-url]: https://github.com/prettier/prettier
105
- [abstract-image]: https://www.npmjs.com/package/abstract-image
106
- [uom]: https://www.npmjs.com/package/uom
1
+ # abstract-chart
2
+
3
+ [![npm version][version-image]][version-url]
4
+ [![code style: prettier][prettier-image]][prettier-url]
5
+ [![MIT license][license-image]][license-url]
6
+
7
+ Drawing charts using multiple unit of measure axes as coordinate system
8
+
9
+ ## Introduction
10
+
11
+ When drawing complex scientific charts, regular line/bar/pie chart libraries are not very useful. This aim of this library is to enable any chart to be drawn, no matter how complex. This is achieved by treating the chart as a canvas where you can draw anything, but in constract to a regular canvas, the chart has a coordinate system specified by axes that can be of different units of measure. You can have multiple coordinate systems overlayed in the same chart by adding more axes to the chart.
12
+
13
+ The chart is created as an abstract representation which can then be converted to an [abstract-image] which then in turn can be realised into different concrete formats such as .png, .svg etc.
14
+
15
+ ## Installation
16
+
17
+ `npm install --save abstract-chart`
18
+
19
+ The library is compiled to ES5 and no polyfills are required.
20
+
21
+ ## Usage
22
+
23
+ Example of chart <a href="https://www.xkcd.com/1612/">XKCD 1612</a>, "The worst part of colds".
24
+
25
+ ```typescript
26
+ import * as React from "react";
27
+ import * as AbstractChart from "abstract-chart";
28
+ import * as AbstractImage from "abstract-image";
29
+
30
+ const svg = AbstractImage.createSvg(
31
+ AbstractChart.renderChart(generateLineChart())
32
+ );
33
+
34
+ function generateLineChart(): AbstractChart.Chart {
35
+ const series = [
36
+ AbstractChart.createChartLine({
37
+ points: [
38
+ { x: 0, y: 0 },
39
+ { x: 1, y: 2 },
40
+ { x: 2, y: 4 },
41
+ { x: 3, y: 1.5 },
42
+ { x: 4, y: 1 },
43
+ { x: 5, y: 0 },
44
+ { x: 6, y: 0 },
45
+ { x: 7, y: 0 },
46
+ { x: 8, y: 0 }
47
+ ],
48
+ color: AbstractImage.red,
49
+ label: "How bad you feel",
50
+ xAxis: "bottom",
51
+ yAxis: "left"
52
+ }),
53
+ AbstractChart.createChartLine({
54
+ points: [
55
+ { x: 0, y: 0 },
56
+ { x: 1, y: 0 },
57
+ { x: 2, y: 0 },
58
+ { x: 3, y: 1 },
59
+ { x: 4, y: 2 },
60
+ { x: 5, y: 3 },
61
+ { x: 6, y: 2.8 },
62
+ { x: 7, y: 2 },
63
+ { x: 8, y: 1.5 }
64
+ ],
65
+ color: AbstractImage.blue,
66
+ label: "How bad you sound",
67
+ xAxis: "bottom",
68
+ yAxis: "left"
69
+ })
70
+ ];
71
+
72
+ const [xMin, xMax] = getLineRange(series, point => point.x);
73
+ const [yMin, yMax] = getLineRange(series, point => point.y);
74
+
75
+ const chart = AbstractChart.createChart({
76
+ chartLines: series,
77
+ xAxisBottom: AbstractChart.createLinearAxis(xMin, xMax, "Days with cold"),
78
+ yAxisLeft: AbstractChart.createLinearAxis(yMin, yMax + 1, "Badness"),
79
+ labelLayout: "center"
80
+ });
81
+
82
+ return chart;
83
+ }
84
+
85
+ function getLineRange(
86
+ series: AbstractChart.ChartLine[],
87
+ axisSelector: (point: AbstractImage.Point) => number
88
+ ): [number, number] {
89
+ const axisValues = series.map(serie => serie.points.map(axisSelector)).reduce(
90
+ (soFar, current) => {
91
+ return [...soFar, ...current];
92
+ },
93
+ [] as ReadonlyArray<number>
94
+ );
95
+ return [Math.min(...axisValues), Math.max(...axisValues)];
96
+ }
97
+ ```
98
+
99
+ [version-image]: https://img.shields.io/npm/v/abstract-chart.svg?style=flat
100
+ [version-url]: https://www.npmjs.com/package/abstract-chart
101
+ [license-image]: https://img.shields.io/github/license/dividab/abstract-visuals.svg?style=flat
102
+ [license-url]: https://opensource.org/licenses/MIT
103
+ [prettier-image]: https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat
104
+ [prettier-url]: https://github.com/prettier/prettier
105
+ [abstract-image]: https://www.npmjs.com/package/abstract-image
106
+ [uom]: https://www.npmjs.com/package/uom
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "abstract-chart",
3
- "version": "3.2.1",
3
+ "version": "3.2.3",
4
4
  "description": "Drawing charts using multiple unit of measure axes as coordinate system",
5
5
  "repository": "https://github.com/dividab/abstract-visuals/tree/master/packages/abstract-chart",
6
6
  "main": "lib/index.js",
@@ -15,12 +15,12 @@
15
15
  "README.md"
16
16
  ],
17
17
  "dependencies": {
18
- "abstract-image": "^3.3.0",
18
+ "abstract-image": "^3.3.2",
19
19
  "ramda": "^0.22.1",
20
20
  "ts-exhaustive-check": "^1.0.0"
21
21
  },
22
22
  "devDependencies": {
23
23
  "@types/ramda": "^0.25.29"
24
24
  },
25
- "gitHead": "ce86a5ef9a7db865039dc76458f984a9991a5c05"
25
+ "gitHead": "b672d84296a7b57fb4caaa69ad99771e6c399723"
26
26
  }