@axdspub/axiom-charts 1.0.7 → 1.0.9
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 +63 -37
- package/library/Libraries/axiom/index.js.map +1 -1
- package/library/browser.js +63 -37
- package/library/browser.js.map +1 -1
- package/library/cjs.js +63 -37
- package/library/cjs.js.map +1 -1
- package/library/index.esm.js +63 -37
- package/library/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/stats.html +1 -19
|
@@ -4085,7 +4085,7 @@ class AxiomScatter extends AxiomPlotRoot {
|
|
|
4085
4085
|
const radius = r !== undefined ? +r : defaultPointW;
|
|
4086
4086
|
ctx.arc(xPosition(d), yPosition(d), radius, 0, 2 * Math.PI);
|
|
4087
4087
|
if (colorAccessor !== undefined) {
|
|
4088
|
-
const color = colorAccessor(d);
|
|
4088
|
+
const color = colorAccessor.apply(this, [d]);
|
|
4089
4089
|
if (color !== undefined && color !== null) {
|
|
4090
4090
|
ctx.fillStyle = color.toString();
|
|
4091
4091
|
}
|
|
@@ -4094,7 +4094,7 @@ class AxiomScatter extends AxiomPlotRoot {
|
|
|
4094
4094
|
}
|
|
4095
4095
|
}
|
|
4096
4096
|
if (strokeColorAccessor !== undefined) {
|
|
4097
|
-
const sc = strokeColorAccessor(d);
|
|
4097
|
+
const sc = strokeColorAccessor.apply(this, [d]);
|
|
4098
4098
|
if (sc !== undefined && sc !== null) {
|
|
4099
4099
|
ctx.strokeStyle = sc.toString();
|
|
4100
4100
|
}
|
|
@@ -4103,7 +4103,7 @@ class AxiomScatter extends AxiomPlotRoot {
|
|
|
4103
4103
|
}
|
|
4104
4104
|
}
|
|
4105
4105
|
if (strokeWidthAccessor !== undefined) {
|
|
4106
|
-
const sw = strokeWidthAccessor(d);
|
|
4106
|
+
const sw = strokeWidthAccessor.apply(this, [d]);
|
|
4107
4107
|
if (sw !== undefined && sw !== null) {
|
|
4108
4108
|
ctx.lineWidth = +sw;
|
|
4109
4109
|
}
|
|
@@ -4228,6 +4228,8 @@ class AxiomBar extends AxiomPlotRoot {
|
|
|
4228
4228
|
return p === undefined ? 0 : (p + offset);
|
|
4229
4229
|
};
|
|
4230
4230
|
};
|
|
4231
|
+
const xDataSpan = Math.abs(+xAxisScale.domain[1] - +xAxisScale.domain[0]);
|
|
4232
|
+
const yDataSpan = Math.abs(+yAxisScale.domain[1] - +yAxisScale.domain[0]);
|
|
4231
4233
|
ctx.save();
|
|
4232
4234
|
ctx.beginPath();
|
|
4233
4235
|
ctx.rect(this.chart.settings.margin.left, this.chart.settings.margin.top, xScale.range()[1], yScale.range()[0]);
|
|
@@ -4265,16 +4267,21 @@ class AxiomBar extends AxiomPlotRoot {
|
|
|
4265
4267
|
const barSpacePercent = 20;
|
|
4266
4268
|
const visibleData = parsedData.filter(row => {
|
|
4267
4269
|
return isVert
|
|
4268
|
-
? +rect.y(row) >= yAxisScale.range[
|
|
4270
|
+
? +rect.y(row) >= yAxisScale.range[1] && +rect.y(row) <= yAxisScale.range[0]
|
|
4269
4271
|
: +rect.x(row) >= (xAxisScale.range[0] + offset.x) && +rect.x(row) <= (xAxisScale.range[1] + offset.x);
|
|
4270
4272
|
});
|
|
4271
4273
|
const colorAccessor = (_o = this.getStringAccessorAtAxis('color')) !== null && _o !== void 0 ? _o : this.getStringAccessorAtAxis('fill');
|
|
4272
4274
|
const strokeWidthAccessor = this.getAccessorAtAxis('strokeWidth');
|
|
4273
4275
|
const strokeColorAccessor = this.getStringAccessorAtAxis('strokeColor');
|
|
4274
4276
|
const sizeAccessor = this.getAccessorAtAxis('size');
|
|
4275
|
-
const
|
|
4277
|
+
const dataSpanAccessor = this.getAccessorAtAxis('dataSpan');
|
|
4278
|
+
const sizeOfVisibleData = visibleData.length > 0 ?
|
|
4279
|
+
isVert
|
|
4280
|
+
? rect.y(visibleData[0]) - rect.y(visibleData[visibleData.length - 1])
|
|
4281
|
+
: rect.x(visibleData[visibleData.length - 1]) - rect.x(visibleData[0])
|
|
4282
|
+
: 1;
|
|
4283
|
+
const defaultBarSize = (_q = (_p = this.style) === null || _p === void 0 ? void 0 : _p.barSize) !== null && _q !== void 0 ? _q : Math.round((sizeOfVisibleData - visibleData.length) / visibleData.length);
|
|
4276
4284
|
const defaultFill = style.fill !== undefined ? style.fill : '#EDEDED';
|
|
4277
|
-
const defaultSize = Math.max(1, defaultBarSize - defaultBarSize * (barSpacePercent / 100));
|
|
4278
4285
|
const defaultStrokeWidth = style.strokeWidth !== undefined ? style.strokeWidth : 0;
|
|
4279
4286
|
const defaultStrokeColor = style.strokeColor !== undefined ? style.strokeColor : '#FFF';
|
|
4280
4287
|
ctx.fillStyle = defaultFill;
|
|
@@ -4282,15 +4289,61 @@ class AxiomBar extends AxiomPlotRoot {
|
|
|
4282
4289
|
ctx.lineWidth = defaultStrokeWidth;
|
|
4283
4290
|
ctx.beginPath();
|
|
4284
4291
|
visibleData.forEach((row, i) => {
|
|
4285
|
-
|
|
4286
|
-
const
|
|
4292
|
+
var _a, _b;
|
|
4293
|
+
const s = (_a = sizeAccessor === null || sizeAccessor === void 0 ? void 0 : sizeAccessor.apply) === null || _a === void 0 ? void 0 : _a.call(sizeAccessor, this, [row]);
|
|
4294
|
+
const ds = s === undefined && dataSpanAccessor !== undefined
|
|
4295
|
+
? (_b = dataSpanAccessor === null || dataSpanAccessor === void 0 ? void 0 : dataSpanAccessor.apply) === null || _b === void 0 ? void 0 : _b.call(dataSpanAccessor, this, [row])
|
|
4296
|
+
: undefined;
|
|
4297
|
+
const dataSpanLength = ds !== undefined
|
|
4298
|
+
? isVert
|
|
4299
|
+
? yDataSpan / +ds
|
|
4300
|
+
: xDataSpan / +ds
|
|
4301
|
+
: undefined;
|
|
4302
|
+
const dataSize = dataSpanLength !== undefined
|
|
4303
|
+
? Math.round(((isVert ? height : width) - dataSpanLength) / dataSpanLength)
|
|
4304
|
+
: undefined;
|
|
4305
|
+
const sizeWithoutSpace = s !== undefined && s !== null
|
|
4306
|
+
? +s
|
|
4307
|
+
: dataSize !== undefined
|
|
4308
|
+
? dataSize
|
|
4309
|
+
: defaultBarSize;
|
|
4310
|
+
const size = Math.max(1, sizeWithoutSpace - sizeWithoutSpace * (barSpacePercent / 100));
|
|
4311
|
+
if (colorAccessor !== undefined) {
|
|
4312
|
+
const color = colorAccessor.apply(this, [row]);
|
|
4313
|
+
if (color !== undefined && color !== null) {
|
|
4314
|
+
ctx.fillStyle = color.toString();
|
|
4315
|
+
}
|
|
4316
|
+
else if (ctx.fillStyle !== defaultFill) {
|
|
4317
|
+
ctx.fillStyle = defaultFill;
|
|
4318
|
+
}
|
|
4319
|
+
}
|
|
4320
|
+
if (strokeColorAccessor !== undefined) {
|
|
4321
|
+
const sc = strokeColorAccessor.apply(this, [row]);
|
|
4322
|
+
if (sc !== undefined && sc !== null) {
|
|
4323
|
+
ctx.strokeStyle = sc.toString();
|
|
4324
|
+
}
|
|
4325
|
+
else if (ctx.strokeStyle !== defaultStrokeColor) {
|
|
4326
|
+
ctx.strokeStyle = defaultStrokeColor;
|
|
4327
|
+
}
|
|
4328
|
+
}
|
|
4329
|
+
if (strokeWidthAccessor !== undefined) {
|
|
4330
|
+
const sw = strokeWidthAccessor.apply(this, [row]);
|
|
4331
|
+
if (sw !== undefined && sw !== null) {
|
|
4332
|
+
ctx.lineWidth = +sw;
|
|
4333
|
+
}
|
|
4334
|
+
else if (ctx.lineWidth !== defaultStrokeWidth) {
|
|
4335
|
+
ctx.lineWidth = defaultStrokeWidth;
|
|
4336
|
+
}
|
|
4337
|
+
}
|
|
4287
4338
|
if (isVert) {
|
|
4288
4339
|
const xVal = rect.x0(row);
|
|
4289
4340
|
if (isDefined(row) && xVal !== undefined && xVal !== null) {
|
|
4290
4341
|
const xW = Math.abs(rect.x1(row) - xVal);
|
|
4291
4342
|
const yVal = rect.y(row);
|
|
4292
4343
|
const yH = size;
|
|
4293
|
-
ctx.
|
|
4344
|
+
ctx.fillRect(xVal, yVal, xW, yH);
|
|
4345
|
+
ctx.strokeRect(xVal, yVal, xW, yH);
|
|
4346
|
+
//ctx.rect(xVal, yVal, xW, yH)
|
|
4294
4347
|
}
|
|
4295
4348
|
}
|
|
4296
4349
|
else {
|
|
@@ -4298,36 +4351,9 @@ class AxiomBar extends AxiomPlotRoot {
|
|
|
4298
4351
|
const y1 = rect.y1(row);
|
|
4299
4352
|
if (isDefined(row) && y0 !== undefined && y1 !== undefined) {
|
|
4300
4353
|
// make sure bar doesn't go outside of chart area
|
|
4301
|
-
const xVal = rect.x(row) -
|
|
4354
|
+
const xVal = rect.x(row) - size / 2;
|
|
4302
4355
|
// add per feature style option
|
|
4303
4356
|
// ctx.fillStyle = i % 2 === 0 ? '#FF0000' : '#006699'
|
|
4304
|
-
if (colorAccessor !== undefined) {
|
|
4305
|
-
const color = colorAccessor(row);
|
|
4306
|
-
if (color !== undefined && color !== null) {
|
|
4307
|
-
ctx.fillStyle = color.toString();
|
|
4308
|
-
}
|
|
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;
|
|
4320
|
-
}
|
|
4321
|
-
}
|
|
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
4357
|
ctx.fillRect(xVal, y0, size, y1 - y0);
|
|
4332
4358
|
ctx.strokeRect(xVal, y0, size, y1 - y0);
|
|
4333
4359
|
}
|