@axdspub/axiom-charts 1.0.6 → 1.0.7
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/library/Libraries/axiom/index.js +86 -24
- package/library/Libraries/axiom/index.js.map +1 -1
- package/library/axiom-charts.d.ts +2 -0
- package/library/browser.js +86 -24
- package/library/browser.js.map +1 -1
- package/library/cjs.js +86 -24
- package/library/cjs.js.map +1 -1
- package/library/index.esm.js +86 -24
- package/library/index.esm.js.map +1 -1
- package/package.json +146 -146
- package/stats.html +19 -1
|
@@ -4012,7 +4012,7 @@ class AxiomScatter extends AxiomPlotRoot {
|
|
|
4012
4012
|
onLegendReady: { get: () => super.onLegendReady }
|
|
4013
4013
|
});
|
|
4014
4014
|
return __awaiter(this, void 0, void 0, function* () {
|
|
4015
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
4015
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
|
4016
4016
|
const style = this.style !== undefined ? this.style : {};
|
|
4017
4017
|
const data = yield this.getData();
|
|
4018
4018
|
this.parsedData = (_a = data === null || data === void 0 ? void 0 : data.parsed) === null || _a === void 0 ? void 0 : _a.data;
|
|
@@ -4063,26 +4063,62 @@ class AxiomScatter extends AxiomPlotRoot {
|
|
|
4063
4063
|
});
|
|
4064
4064
|
// .style?.strokeColor !== undefined ? settings.style.strokeColor :
|
|
4065
4065
|
// .style?.strokeWidth ||
|
|
4066
|
-
const pointW = style.radius !== undefined ? style.radius : 2;
|
|
4067
4066
|
/* ctx.save()
|
|
4068
4067
|
ctx.beginPath()
|
|
4069
4068
|
ctx.rect(this.chart.settings.margin.left - pointW, this.chart.settings.margin.top - pointW, this.xScale.range()[1] - pointW * 2, this.yScale.range()[0] - pointW * 2)
|
|
4070
4069
|
ctx.clip() */
|
|
4071
|
-
|
|
4072
|
-
|
|
4073
|
-
|
|
4070
|
+
const defaultPointW = style.radius !== undefined ? style.radius : style.size !== undefined ? style.size : 2;
|
|
4071
|
+
const defaultFill = style.fill !== undefined ? style.fill : '#666';
|
|
4072
|
+
const defaultStroke = style.strokeColor !== undefined ? style.strokeColor : '#FFF';
|
|
4073
|
+
const defaultStrokeWidth = (style.strokeWidth !== undefined || style.strokeColor !== undefined) ? ((style.strokeWidth !== undefined ? style.strokeWidth : 1) + defaultPointW) : 0;
|
|
4074
|
+
const colorAccessor = (_o = this.getStringAccessorAtAxis('color')) !== null && _o !== void 0 ? _o : this.getStringAccessorAtAxis('fill');
|
|
4075
|
+
const radiusAccessor = (_p = this.getAccessorAtAxis('radius')) !== null && _p !== void 0 ? _p : this.getAccessorAtAxis('size');
|
|
4076
|
+
const strokeWidthAccessor = this.getAccessorAtAxis('strokeWidth');
|
|
4077
|
+
const strokeColorAccessor = this.getStringAccessorAtAxis('strokeColor');
|
|
4078
|
+
ctx.strokeStyle = defaultStroke;
|
|
4079
|
+
ctx.lineWidth = defaultStrokeWidth;
|
|
4080
|
+
ctx.fillStyle = defaultFill;
|
|
4074
4081
|
visibleData.forEach(d => {
|
|
4075
4082
|
if (isDefined(d)) {
|
|
4076
4083
|
ctx.beginPath();
|
|
4077
|
-
|
|
4084
|
+
const r = radiusAccessor === null || radiusAccessor === void 0 ? void 0 : radiusAccessor(d);
|
|
4085
|
+
const radius = r !== undefined ? +r : defaultPointW;
|
|
4086
|
+
ctx.arc(xPosition(d), yPosition(d), radius, 0, 2 * Math.PI);
|
|
4087
|
+
if (colorAccessor !== undefined) {
|
|
4088
|
+
const color = colorAccessor(d);
|
|
4089
|
+
if (color !== undefined && color !== null) {
|
|
4090
|
+
ctx.fillStyle = color.toString();
|
|
4091
|
+
}
|
|
4092
|
+
else if (ctx.fillStyle !== defaultFill) {
|
|
4093
|
+
ctx.fillStyle = defaultFill;
|
|
4094
|
+
}
|
|
4095
|
+
}
|
|
4096
|
+
if (strokeColorAccessor !== undefined) {
|
|
4097
|
+
const sc = strokeColorAccessor(d);
|
|
4098
|
+
if (sc !== undefined && sc !== null) {
|
|
4099
|
+
ctx.strokeStyle = sc.toString();
|
|
4100
|
+
}
|
|
4101
|
+
else if (ctx.strokeStyle !== defaultStroke) {
|
|
4102
|
+
ctx.strokeStyle = defaultStroke;
|
|
4103
|
+
}
|
|
4104
|
+
}
|
|
4105
|
+
if (strokeWidthAccessor !== undefined) {
|
|
4106
|
+
const sw = strokeWidthAccessor(d);
|
|
4107
|
+
if (sw !== undefined && sw !== null) {
|
|
4108
|
+
ctx.lineWidth = +sw;
|
|
4109
|
+
}
|
|
4110
|
+
else if (ctx.lineWidth !== defaultStrokeWidth) {
|
|
4111
|
+
ctx.lineWidth = defaultStrokeWidth;
|
|
4112
|
+
}
|
|
4113
|
+
}
|
|
4078
4114
|
ctx.stroke();
|
|
4079
4115
|
ctx.fill();
|
|
4080
4116
|
}
|
|
4081
4117
|
});
|
|
4082
|
-
if (((
|
|
4118
|
+
if (((_q = this.axes) === null || _q === void 0 ? void 0 : _q.y) !== undefined && !((_r = this.legendSettings.hide) !== null && _r !== void 0 ? _r : false)) {
|
|
4083
4119
|
_super.onLegendReady.call(this, [{
|
|
4084
4120
|
id: this.axes.y.key,
|
|
4085
|
-
label: (
|
|
4121
|
+
label: (_s = chart.getAxisLabel(this.axes.y, 'y')) !== null && _s !== void 0 ? _s : this.axes.y.key,
|
|
4086
4122
|
style: {
|
|
4087
4123
|
backgroundColor: ctx.fillStyle,
|
|
4088
4124
|
border: `1px solid ${ctx.strokeStyle}`
|
|
@@ -4148,7 +4184,7 @@ class AxiomBar extends AxiomPlotRoot {
|
|
|
4148
4184
|
onLegendReady: { get: () => super.onLegendReady }
|
|
4149
4185
|
});
|
|
4150
4186
|
return __awaiter(this, void 0, void 0, function* () {
|
|
4151
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
4187
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
|
4152
4188
|
const style = this.style !== undefined ? this.style : {};
|
|
4153
4189
|
const data = yield this.getData();
|
|
4154
4190
|
const parsedData = (_a = data === null || data === void 0 ? void 0 : data.parsed) === null || _a === void 0 ? void 0 : _a.data;
|
|
@@ -4160,7 +4196,6 @@ class AxiomBar extends AxiomPlotRoot {
|
|
|
4160
4196
|
const yAccessor = this.getAccessorAtAxis('y');
|
|
4161
4197
|
const y0Accessor = yAccessors.y0;
|
|
4162
4198
|
const y1Accessor = yAccessors.y1;
|
|
4163
|
-
const colorAccessor = this.getStringAccessorAtAxis('color');
|
|
4164
4199
|
const offset = {
|
|
4165
4200
|
x: ((_d = (_c = (_b = this === null || this === void 0 ? void 0 : this.axes) === null || _b === void 0 ? void 0 : _b.x) === null || _c === void 0 ? void 0 : _c.offset) === null || _d === void 0 ? void 0 : _d.x) !== undefined ? this.axes.x.offset.x : 0,
|
|
4166
4201
|
y: ((_g = (_f = (_e = this === null || this === void 0 ? void 0 : this.axes) === null || _e === void 0 ? void 0 : _e.y) === null || _f === void 0 ? void 0 : _f.offset) === null || _g === void 0 ? void 0 : _g.y) !== undefined ? this.axes.y.offset.y : 0
|
|
@@ -4197,8 +4232,6 @@ class AxiomBar extends AxiomPlotRoot {
|
|
|
4197
4232
|
ctx.beginPath();
|
|
4198
4233
|
ctx.rect(this.chart.settings.margin.left, this.chart.settings.margin.top, xScale.range()[1], yScale.range()[0]);
|
|
4199
4234
|
ctx.clip();
|
|
4200
|
-
const defaultColor = style.fill !== undefined ? style.fill : '#EDEDED';
|
|
4201
|
-
ctx.fillStyle = defaultColor;
|
|
4202
4235
|
const rect = {};
|
|
4203
4236
|
if (x0Accessor !== undefined && x1Accessor !== undefined) {
|
|
4204
4237
|
rect.x0 = makePositionFn(x0Accessor, xScale, offset.x);
|
|
@@ -4225,7 +4258,6 @@ class AxiomBar extends AxiomPlotRoot {
|
|
|
4225
4258
|
? x0Accessor(d) !== undefined && x0Accessor(d) !== null && x1Accessor(d) !== undefined && x1Accessor(d) !== null
|
|
4226
4259
|
: false;
|
|
4227
4260
|
};
|
|
4228
|
-
ctx.beginPath();
|
|
4229
4261
|
const isVert = !!(rect.x0 !== undefined && rect.x1 !== undefined);
|
|
4230
4262
|
const height = Math.abs(yAxisScale.range[1] - yAxisScale.range[0]);
|
|
4231
4263
|
const width = Math.abs(xAxisScale.range[1] - xAxisScale.range[0]);
|
|
@@ -4236,16 +4268,28 @@ class AxiomBar extends AxiomPlotRoot {
|
|
|
4236
4268
|
? +rect.y(row) >= yAxisScale.range[0] && +rect.y(row) <= yAxisScale.range[1]
|
|
4237
4269
|
: +rect.x(row) >= (xAxisScale.range[0] + offset.x) && +rect.x(row) <= (xAxisScale.range[1] + offset.x);
|
|
4238
4270
|
});
|
|
4239
|
-
const
|
|
4240
|
-
const
|
|
4241
|
-
|
|
4271
|
+
const colorAccessor = (_o = this.getStringAccessorAtAxis('color')) !== null && _o !== void 0 ? _o : this.getStringAccessorAtAxis('fill');
|
|
4272
|
+
const strokeWidthAccessor = this.getAccessorAtAxis('strokeWidth');
|
|
4273
|
+
const strokeColorAccessor = this.getStringAccessorAtAxis('strokeColor');
|
|
4274
|
+
const sizeAccessor = this.getAccessorAtAxis('size');
|
|
4275
|
+
const defaultBarSize = (_q = (_p = this.style) === null || _p === void 0 ? void 0 : _p.barSize) !== null && _q !== void 0 ? _q : Math.round(((isVert ? height : width) - visibleData.length) / visibleData.length);
|
|
4276
|
+
const defaultFill = style.fill !== undefined ? style.fill : '#EDEDED';
|
|
4277
|
+
const defaultSize = Math.max(1, defaultBarSize - defaultBarSize * (barSpacePercent / 100));
|
|
4278
|
+
const defaultStrokeWidth = style.strokeWidth !== undefined ? style.strokeWidth : 0;
|
|
4279
|
+
const defaultStrokeColor = style.strokeColor !== undefined ? style.strokeColor : '#FFF';
|
|
4280
|
+
ctx.fillStyle = defaultFill;
|
|
4281
|
+
ctx.strokeStyle = defaultStrokeColor;
|
|
4282
|
+
ctx.lineWidth = defaultStrokeWidth;
|
|
4283
|
+
ctx.beginPath();
|
|
4242
4284
|
visibleData.forEach((row, i) => {
|
|
4285
|
+
const s = sizeAccessor === null || sizeAccessor === void 0 ? void 0 : sizeAccessor(row);
|
|
4286
|
+
const size = s !== undefined && s !== null ? +s : defaultSize;
|
|
4243
4287
|
if (isVert) {
|
|
4244
4288
|
const xVal = rect.x0(row);
|
|
4245
4289
|
if (isDefined(row) && xVal !== undefined && xVal !== null) {
|
|
4246
4290
|
const xW = Math.abs(rect.x1(row) - xVal);
|
|
4247
4291
|
const yVal = rect.y(row);
|
|
4248
|
-
const yH =
|
|
4292
|
+
const yH = size;
|
|
4249
4293
|
ctx.rect(xVal, yVal, xW, yH);
|
|
4250
4294
|
}
|
|
4251
4295
|
}
|
|
@@ -4261,23 +4305,41 @@ class AxiomBar extends AxiomPlotRoot {
|
|
|
4261
4305
|
const color = colorAccessor(row);
|
|
4262
4306
|
if (color !== undefined && color !== null) {
|
|
4263
4307
|
ctx.fillStyle = color.toString();
|
|
4264
|
-
hadFillColor = true;
|
|
4265
4308
|
}
|
|
4266
|
-
else if (
|
|
4267
|
-
ctx.fillStyle =
|
|
4268
|
-
|
|
4309
|
+
else if (ctx.fillStyle !== defaultFill) {
|
|
4310
|
+
ctx.fillStyle = defaultFill;
|
|
4311
|
+
}
|
|
4312
|
+
}
|
|
4313
|
+
if (strokeColorAccessor !== undefined) {
|
|
4314
|
+
const sc = strokeColorAccessor(row);
|
|
4315
|
+
if (sc !== undefined && sc !== null) {
|
|
4316
|
+
ctx.strokeStyle = sc.toString();
|
|
4317
|
+
}
|
|
4318
|
+
else if (ctx.strokeStyle !== defaultStrokeColor) {
|
|
4319
|
+
ctx.strokeStyle = defaultStrokeColor;
|
|
4269
4320
|
}
|
|
4270
4321
|
}
|
|
4271
|
-
|
|
4322
|
+
if (strokeWidthAccessor !== undefined) {
|
|
4323
|
+
const sw = strokeWidthAccessor(row);
|
|
4324
|
+
if (sw !== undefined && sw !== null) {
|
|
4325
|
+
ctx.lineWidth = +sw;
|
|
4326
|
+
}
|
|
4327
|
+
else if (ctx.lineWidth !== defaultStrokeWidth) {
|
|
4328
|
+
ctx.lineWidth = defaultStrokeWidth;
|
|
4329
|
+
}
|
|
4330
|
+
}
|
|
4331
|
+
ctx.fillRect(xVal, y0, size, y1 - y0);
|
|
4332
|
+
ctx.strokeRect(xVal, y0, size, y1 - y0);
|
|
4272
4333
|
}
|
|
4273
4334
|
}
|
|
4274
4335
|
// ctx.rect(rect.x0(row),row.y0(row),)
|
|
4275
4336
|
});
|
|
4276
4337
|
ctx.fill();
|
|
4277
|
-
|
|
4338
|
+
ctx.stroke();
|
|
4339
|
+
if (((_r = this.axes) === null || _r === void 0 ? void 0 : _r.y) !== undefined && !((_s = this.legendSettings.hide) !== null && _s !== void 0 ? _s : false)) {
|
|
4278
4340
|
_super.onLegendReady.call(this, [{
|
|
4279
4341
|
id: this.axes.y.key,
|
|
4280
|
-
label: (
|
|
4342
|
+
label: (_t = chart.getAxisLabel(this.axes.y, 'y')) !== null && _t !== void 0 ? _t : this.axes.y.key,
|
|
4281
4343
|
style: { backgroundColor: ctx.fillStyle }
|
|
4282
4344
|
}]);
|
|
4283
4345
|
}
|