abstract-chart 3.1.0 → 3.1.4

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.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.
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
@@ -1 +1 @@
1
- {"version":3,"file":"chart.d.ts","sourceRoot":"","sources":["../src/chart.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,aAAa,MAAM,gBAAgB,CAAC;AAChD,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAC;AAK/B,oBAAY,OAAO,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;CAAE,CAAC;AAEnD,oBAAY,WAAW,GAAG,UAAU,GAAG,KAAK,GAAG,QAAQ,CAAC;AAExD,MAAM,WAAW,KAAK;IACpB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,WAAW,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC;IACxC,QAAQ,CAAC,UAAU,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;IACtC,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC;IAChC,QAAQ,CAAC,WAAW,EAAE,IAAI,CAAC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package/lib/chart.js CHANGED
@@ -24,7 +24,7 @@ const AbstractImage = __importStar(require("abstract-image"));
24
24
  const Axis = __importStar(require("./axis"));
25
25
  const ts_exhaustive_check_1 = require("ts-exhaustive-check");
26
26
  function createChart(props) {
27
- const { width = 600, height = 400, chartPoints = [], chartLines = [], chartStack = createChartStack({}), xAxisBottom = Axis.createLinearAxis(0, 100, ""), xAxisTop = undefined, yAxisLeft = Axis.createLinearAxis(0, 100, ""), yAxisRight = undefined, backgroundColor = AbstractImage.white, gridColor = AbstractImage.gray, gridThickness = 1, fontSize = 12, labelLayout = "original" } = props || {};
27
+ const { width = 600, height = 400, chartPoints = [], chartLines = [], chartStack = createChartStack({}), xAxisBottom = Axis.createLinearAxis(0, 100, ""), xAxisTop = undefined, yAxisLeft = Axis.createLinearAxis(0, 100, ""), yAxisRight = undefined, backgroundColor = AbstractImage.white, gridColor = AbstractImage.gray, gridThickness = 1, fontSize = 12, labelLayout = "original", } = props || {};
28
28
  return {
29
29
  width,
30
30
  height,
@@ -39,12 +39,12 @@ function createChart(props) {
39
39
  gridColor,
40
40
  gridThickness,
41
41
  fontSize,
42
- labelLayout
42
+ labelLayout,
43
43
  };
44
44
  }
45
45
  exports.createChart = createChart;
46
46
  function createChartPoint(props) {
47
- const { shape = "circle", position = AbstractImage.createPoint(0, 0), color = AbstractImage.black, size = AbstractImage.createSize(6, 6), label = "", xAxis = "bottom", yAxis = "left" } = props || {};
47
+ const { shape = "circle", position = AbstractImage.createPoint(0, 0), color = AbstractImage.black, size = AbstractImage.createSize(6, 6), label = "", xAxis = "bottom", yAxis = "left", } = props || {};
48
48
  return {
49
49
  shape,
50
50
  position,
@@ -52,19 +52,19 @@ function createChartPoint(props) {
52
52
  size,
53
53
  label,
54
54
  xAxis,
55
- yAxis
55
+ yAxis,
56
56
  };
57
57
  }
58
58
  exports.createChartPoint = createChartPoint;
59
59
  function createChartLine(props) {
60
- const { points = [], color = AbstractImage.black, thickness = 1, label = "", xAxis = "bottom", yAxis = "left" } = props || {};
60
+ const { points = [], color = AbstractImage.black, thickness = 1, label = "", xAxis = "bottom", yAxis = "left", } = props || {};
61
61
  return {
62
62
  points,
63
63
  color,
64
64
  thickness,
65
65
  label,
66
66
  xAxis,
67
- yAxis
67
+ yAxis,
68
68
  };
69
69
  }
70
70
  exports.createChartLine = createChartLine;
@@ -72,7 +72,7 @@ function createChartStackConfig(props) {
72
72
  const { color = AbstractImage.black, label = "" } = props || {};
73
73
  return {
74
74
  color,
75
- label
75
+ label,
76
76
  };
77
77
  }
78
78
  exports.createChartStackConfig = createChartStackConfig;
@@ -82,7 +82,7 @@ function createChartStack(props) {
82
82
  points,
83
83
  xAxis,
84
84
  yAxis,
85
- config
85
+ config,
86
86
  };
87
87
  }
88
88
  exports.createChartStack = createChartStack;
@@ -126,7 +126,7 @@ function renderChart(chart) {
126
126
  renderedYAxisRight,
127
127
  renderedStack,
128
128
  renderedLines,
129
- renderedPoints
129
+ renderedPoints,
130
130
  ];
131
131
  const topLeft = AbstractImage.createPoint(0, 0);
132
132
  const size = AbstractImage.createSize(width, height);
@@ -158,7 +158,7 @@ function generateXAxisBottom(xNumTicks, xAxisBottom, xMin, xMax, yMin, yMax, cha
158
158
  xLabel = generateXAxisLabel((xMin + xMax) / 2, yMin + 25, "uniform", "down", xAxisBottom.label, chart);
159
159
  break;
160
160
  default:
161
- return ts_exhaustive_check_1.exhaustiveCheck(chart.labelLayout);
161
+ return (0, ts_exhaustive_check_1.exhaustiveCheck)(chart.labelLayout);
162
162
  }
163
163
  return AbstractImage.createGroup("XAxisBottom", [xLines, xLabels, xLabel]);
164
164
  }
@@ -182,7 +182,7 @@ function generateXAxisTop(xNumTicks, xAxisTop, xMin, xMax, yMax, chart) {
182
182
  xLabel2 = generateXAxisLabel((xMin + xMax) / 2, yMax - 30, "uniform", "up", xAxisTop.label, chart);
183
183
  break;
184
184
  default:
185
- return ts_exhaustive_check_1.exhaustiveCheck(chart.labelLayout);
185
+ return (0, ts_exhaustive_check_1.exhaustiveCheck)(chart.labelLayout);
186
186
  }
187
187
  return AbstractImage.createGroup("XAxisTop", [xLines2, xLabels2, xLabel2]);
188
188
  }
@@ -207,7 +207,7 @@ function generateYAxisLeft(yNumTicks, yAxisLeft, xMin, xMax, yMin, yMax, chart)
207
207
  yLabel = generateYAxisLabel(xMin - labelPaddingLeft, (yMin + yMax) / 2, "uniform", "up", yAxisLeft.label, chart);
208
208
  break;
209
209
  default:
210
- return ts_exhaustive_check_1.exhaustiveCheck(chart.labelLayout);
210
+ return (0, ts_exhaustive_check_1.exhaustiveCheck)(chart.labelLayout);
211
211
  }
212
212
  return AbstractImage.createGroup("YAxisLeft", [yLines, yLabels, yLabel]);
213
213
  }
@@ -232,20 +232,20 @@ function generateYAxisRight(yNumTicks, yAxisRight, xMax, yMin, yMax, chart) {
232
232
  yLabel2 = generateYAxisLabel(xMax + labelPaddingRight, (yMin + yMax) / 2, "uniform", "up", yAxisRight.label, chart);
233
233
  break;
234
234
  default:
235
- return ts_exhaustive_check_1.exhaustiveCheck(chart.labelLayout);
235
+ return (0, ts_exhaustive_check_1.exhaustiveCheck)(chart.labelLayout);
236
236
  }
237
237
  return AbstractImage.createGroup("YAxisRight", [yLines2, yLabels2, yLabel2]);
238
238
  }
239
239
  exports.generateYAxisRight = generateYAxisRight;
240
240
  function generateStack(xMin, xMax, yMin, yMax, chart) {
241
- const pointsPos = chart.chartStack.points.map(stackPoint => ({
241
+ const pointsPos = chart.chartStack.points.map((stackPoint) => ({
242
242
  x: stackPoint.x,
243
- ys: [...stackPoint.ys.map(y => Math.min(0, y))]
243
+ ys: [...stackPoint.ys.map((y) => Math.min(0, y))],
244
244
  }));
245
245
  const stackPos = generateUnsignedStack(xMin, xMax, yMin, yMax, Object.assign(Object.assign({}, chart), { chartStack: Object.assign(Object.assign({}, chart.chartStack), { points: pointsPos }) }));
246
- const pointsNeg = chart.chartStack.points.map(stackPoint => ({
246
+ const pointsNeg = chart.chartStack.points.map((stackPoint) => ({
247
247
  x: stackPoint.x,
248
- ys: [...stackPoint.ys.map(y => Math.max(0, y))]
248
+ ys: [...stackPoint.ys.map((y) => Math.max(0, y))],
249
249
  }));
250
250
  const stackNeg = generateUnsignedStack(xMin, xMax, yMin, yMax, Object.assign(Object.assign({}, chart), { chartStack: Object.assign(Object.assign({}, chart.chartStack), { points: pointsNeg }) }));
251
251
  return AbstractImage.createGroup("Stacks", [stackPos, stackNeg]);
@@ -257,9 +257,9 @@ function generateUnsignedStack(xMin, xMax, yMin, yMax, chart) {
257
257
  }
258
258
  const xAxis = chart.chartStack.xAxis === "top" ? chart.xAxisTop : chart.xAxisBottom;
259
259
  const yAxis = chart.chartStack.yAxis === "right" ? chart.yAxisRight : chart.yAxisLeft;
260
- const xPoints = chart.chartStack.points.map(stackPoints => {
260
+ const xPoints = chart.chartStack.points.map((stackPoints) => {
261
261
  let sumY = 0;
262
- const points = stackPoints.ys.map(y => {
262
+ const points = stackPoints.ys.map((y) => {
263
263
  sumY += y;
264
264
  return Axis.transformPoint(AbstractImage.createPoint(stackPoints.x, sumY), xMin, xMax, yMin, yMax, xAxis, yAxis);
265
265
  });
@@ -274,7 +274,7 @@ function generateUnsignedStack(xMin, xMax, yMin, yMax, chart) {
274
274
  }
275
275
  }
276
276
  const polygons = [];
277
- let lastLine = chart.chartStack.points.map(stackPoint => Axis.transformPoint(AbstractImage.createPoint(stackPoint.x, 0), xMin, xMax, yMin, yMax, xAxis, yAxis));
277
+ let lastLine = chart.chartStack.points.map((stackPoint) => Axis.transformPoint(AbstractImage.createPoint(stackPoint.x, 0), xMin, xMax, yMin, yMax, xAxis, yAxis));
278
278
  lines.forEach((line, index) => {
279
279
  const config = chart.chartStack.config[index];
280
280
  if (!config) {
@@ -294,25 +294,25 @@ function generateLines(xMin, xMax, yMin, yMax, chart) {
294
294
  }
295
295
  const xAxis = l.xAxis === "top" ? chart.xAxisTop : chart.xAxisBottom;
296
296
  const yAxis = l.yAxis === "right" ? chart.yAxisRight : chart.yAxisLeft;
297
- const points = l.points.map(p => Axis.transformPoint(p, xMin, xMax, yMin, yMax, xAxis, yAxis));
297
+ const points = l.points.map((p) => Axis.transformPoint(p, xMin, xMax, yMin, yMax, xAxis, yAxis));
298
298
  const last = points[points.length - 1];
299
299
  return AbstractImage.createGroup(l.label, [
300
300
  AbstractImage.createPolyLine(points, l.color, l.thickness),
301
- AbstractImage.createText(last, l.label, "Arial", chart.fontSize, AbstractImage.black, "normal", 0, "center", "right", "down", 0, AbstractImage.black)
301
+ AbstractImage.createText(last, l.label, "Arial", chart.fontSize, AbstractImage.black, "normal", 0, "center", "right", "down", 0, AbstractImage.black, false),
302
302
  ]);
303
303
  });
304
304
  return AbstractImage.createGroup("Lines", lines);
305
305
  }
306
306
  exports.generateLines = generateLines;
307
307
  function generatePoints(xMin, xMax, yMin, yMax, chart) {
308
- const points = chart.chartPoints.map(p => {
308
+ const points = chart.chartPoints.map((p) => {
309
309
  const xAxis = p.xAxis === "top" ? chart.xAxisTop : chart.xAxisBottom;
310
310
  const yAxis = p.yAxis === "right" ? chart.yAxisRight : chart.yAxisLeft;
311
311
  const position = Axis.transformPoint(p.position, xMin, xMax, yMin, yMax, xAxis, yAxis);
312
312
  const shape = generatePointShape(p, position);
313
313
  return AbstractImage.createGroup(p.label, [
314
314
  shape,
315
- AbstractImage.createText(position, p.label, "Arial", chart.fontSize, AbstractImage.black, "normal", 0, "center", "right", "down", 0, AbstractImage.black)
315
+ AbstractImage.createText(position, p.label, "Arial", chart.fontSize, AbstractImage.black, "normal", 0, "center", "right", "down", 0, AbstractImage.black, false),
316
316
  ]);
317
317
  });
318
318
  return AbstractImage.createGroup("Points", points);
@@ -325,7 +325,7 @@ function generatePointShape(p, position) {
325
325
  const trianglePoints = [
326
326
  AbstractImage.createPoint(position.x, position.y + halfHeight),
327
327
  AbstractImage.createPoint(position.x - halfWidth, position.y - halfHeight),
328
- AbstractImage.createPoint(position.x + halfWidth, position.y - halfHeight)
328
+ AbstractImage.createPoint(position.x + halfWidth, position.y - halfHeight),
329
329
  ];
330
330
  return AbstractImage.createPolygon(trianglePoints, AbstractImage.black, 1, p.color);
331
331
  }
@@ -341,7 +341,7 @@ function generatePointShape(p, position) {
341
341
  }
342
342
  }
343
343
  function generateXAxisGridLines(xMin, xMax, yMin, yMax, xTicks, xAxis, chart) {
344
- const xLines = xTicks.map(l => {
344
+ const xLines = xTicks.map((l) => {
345
345
  const x = Axis.transformValue(l, xMin, xMax, xAxis);
346
346
  const start = AbstractImage.createPoint(x, yMin);
347
347
  const end = AbstractImage.createPoint(x, yMax);
@@ -351,20 +351,20 @@ function generateXAxisGridLines(xMin, xMax, yMin, yMax, xTicks, xAxis, chart) {
351
351
  }
352
352
  exports.generateXAxisGridLines = generateXAxisGridLines;
353
353
  function generateXAxisLabels(xMin, xMax, y, growVertical, xTicks, xAxis, chart) {
354
- const xLabels = xTicks.map(l => {
354
+ const xLabels = xTicks.map((l) => {
355
355
  const position = AbstractImage.createPoint(Axis.transformValue(l, xMin, xMax, xAxis), y);
356
- return AbstractImage.createText(position, formatNumber(l), "Arial", chart.fontSize, AbstractImage.black, "normal", 0, "center", "uniform", growVertical, 0, AbstractImage.black);
356
+ return AbstractImage.createText(position, formatNumber(l), "Arial", chart.fontSize, AbstractImage.black, "normal", 0, "center", "uniform", growVertical, 0, AbstractImage.black, false);
357
357
  });
358
358
  return AbstractImage.createGroup("Labels", xLabels);
359
359
  }
360
360
  exports.generateXAxisLabels = generateXAxisLabels;
361
361
  function generateXAxisLabel(x, y, horizontalGrowthDirection, verticalGrowthDirection, label, chart) {
362
362
  const position = AbstractImage.createPoint(x, y);
363
- return AbstractImage.createText(position, label, "Arial", chart.fontSize, AbstractImage.black, "normal", 0, "center", horizontalGrowthDirection, verticalGrowthDirection, 0, AbstractImage.black);
363
+ return AbstractImage.createText(position, label, "Arial", chart.fontSize, AbstractImage.black, "normal", 0, "center", horizontalGrowthDirection, verticalGrowthDirection, 0, AbstractImage.black, false);
364
364
  }
365
365
  exports.generateXAxisLabel = generateXAxisLabel;
366
366
  function generateYAxisLines(xMin, xMax, yMin, yMax, yTicks, yAxis, chart) {
367
- const yLines = yTicks.map(l => {
367
+ const yLines = yTicks.map((l) => {
368
368
  const y = Axis.transformValue(l, yMin, yMax, yAxis);
369
369
  const start = AbstractImage.createPoint(xMin, y);
370
370
  const end = AbstractImage.createPoint(xMax, y);
@@ -374,16 +374,16 @@ function generateYAxisLines(xMin, xMax, yMin, yMax, yTicks, yAxis, chart) {
374
374
  }
375
375
  exports.generateYAxisLines = generateYAxisLines;
376
376
  function generateYAxisLabels(x, yMin, yMax, growHorizontal, yTicks, yAxis, chart) {
377
- const yLabels = yTicks.map(l => {
377
+ const yLabels = yTicks.map((l) => {
378
378
  const position = AbstractImage.createPoint(x, Axis.transformValue(l, yMin, yMax, yAxis));
379
- return AbstractImage.createText(position, formatNumber(l), "Arial", chart.fontSize, AbstractImage.black, "normal", 0, "center", growHorizontal, "uniform", 0, AbstractImage.black);
379
+ return AbstractImage.createText(position, formatNumber(l), "Arial", chart.fontSize, AbstractImage.black, "normal", 0, "center", growHorizontal, "uniform", 0, AbstractImage.black, false);
380
380
  });
381
381
  return AbstractImage.createGroup("Labels", yLabels);
382
382
  }
383
383
  exports.generateYAxisLabels = generateYAxisLabels;
384
384
  function generateYAxisLabel(x, y, horizontalGrowthDirection, verticalGrowthDirection, label, chart) {
385
385
  const position = AbstractImage.createPoint(x, y);
386
- return AbstractImage.createText(position, label, "Arial", chart.fontSize, AbstractImage.black, "normal", -90, "center", horizontalGrowthDirection, verticalGrowthDirection, 0, AbstractImage.black);
386
+ return AbstractImage.createText(position, label, "Arial", chart.fontSize, AbstractImage.black, "normal", -90, "center", horizontalGrowthDirection, verticalGrowthDirection, 0, AbstractImage.black, false);
387
387
  }
388
388
  exports.generateYAxisLabel = generateYAxisLabel;
389
389
  function formatNumber(n) {
@@ -399,6 +399,6 @@ function numberToString(n) {
399
399
  return parseFloat(n.toPrecision(5)).toString();
400
400
  }
401
401
  function labelPadding(numberOfCharacters, fontSize, characterOffset) {
402
- return (numberOfCharacters + 1 + characterOffset) * fontSize * 3 / 4;
402
+ return ((numberOfCharacters + 1 + characterOffset) * fontSize * 3) / 4;
403
403
  }
404
404
  //# sourceMappingURL=chart.js.map