@mathstack/viz 0.0.1-beta.4 → 0.0.1-beta.6
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/fesm2022/mathstack-viz.mjs +104 -104
- package/fesm2022/mathstack-viz.mjs.map +1 -1
- package/package.json +1 -1
- package/types/mathstack-viz.d.ts +183 -183
|
@@ -5280,6 +5280,109 @@ const valueFormat = {
|
|
|
5280
5280
|
monthFullYear: '%B %Y',
|
|
5281
5281
|
};
|
|
5282
5282
|
|
|
5283
|
+
/**
|
|
5284
|
+
* A dimension that transforms Date values into a position on a chart.
|
|
5285
|
+
*
|
|
5286
|
+
* This dimension is used for the positional dimensions of a chart, such as x and y. The underlying scale will always be a [D3 time scale](https://d3js.org/d3-scale/time). The range of the scale will be a dimension from the chart.
|
|
5287
|
+
*
|
|
5288
|
+
* The generic is the type of the data that will be passed to the dimension.
|
|
5289
|
+
*
|
|
5290
|
+
* TESTABLE FUNCTIONALITY
|
|
5291
|
+
*
|
|
5292
|
+
* - It extracts values for the dimension from data.
|
|
5293
|
+
* - tested in: lines.cy.ts
|
|
5294
|
+
* - It sets the domain of the dimension.
|
|
5295
|
+
* - tested in: lines.cy.ts
|
|
5296
|
+
* - It creates and returns a scale from a range.
|
|
5297
|
+
* - tested in: lines.cy.ts
|
|
5298
|
+
* - It checks if a value is in valid.
|
|
5299
|
+
* - tested in: lines.cy.ts
|
|
5300
|
+
* - The domain will be unique values from the user-provided domain if the user provides a domain.
|
|
5301
|
+
* - tested in: date-chart-position.spec.ts
|
|
5302
|
+
* - The domain will be unique values from the data if no custom domain is given by the user.
|
|
5303
|
+
* - tested in: date-chart-position.spec.ts
|
|
5304
|
+
* - The domain can be set in reverse order.
|
|
5305
|
+
* - tested in: date-chart-position.spec.ts
|
|
5306
|
+
*/
|
|
5307
|
+
class DateChartPositionDimension extends DataDimension {
|
|
5308
|
+
constructor(options) {
|
|
5309
|
+
super('date');
|
|
5310
|
+
safeAssign(this, options);
|
|
5311
|
+
}
|
|
5312
|
+
setPropertiesFromData(data) {
|
|
5313
|
+
this.setValues(data);
|
|
5314
|
+
this.setDomain();
|
|
5315
|
+
}
|
|
5316
|
+
setDomain() {
|
|
5317
|
+
const extents = this.domain === undefined
|
|
5318
|
+
? [min(this.values), max(this.values)]
|
|
5319
|
+
: this.domain;
|
|
5320
|
+
this.calculatedDomain = extents;
|
|
5321
|
+
}
|
|
5322
|
+
getScaleFromRange(range) {
|
|
5323
|
+
return this.scaleFn().domain(this.calculatedDomain).range(range);
|
|
5324
|
+
}
|
|
5325
|
+
// returns false if data is undefined or null of not a Date
|
|
5326
|
+
// for some charts this may be fine
|
|
5327
|
+
// original intended use case: d3Line can only handle defined values
|
|
5328
|
+
isValidValue(x) {
|
|
5329
|
+
return isDate(x);
|
|
5330
|
+
}
|
|
5331
|
+
}
|
|
5332
|
+
|
|
5333
|
+
const DEFAULT$o = {
|
|
5334
|
+
_scaleFn: scaleUtc,
|
|
5335
|
+
_formatSpecifier: '%Y %m',
|
|
5336
|
+
};
|
|
5337
|
+
class DateChartPositionDimensionBuilder extends DataDimensionBuilder {
|
|
5338
|
+
constructor() {
|
|
5339
|
+
super();
|
|
5340
|
+
safeAssign(this, DEFAULT$o);
|
|
5341
|
+
}
|
|
5342
|
+
domain(domain) {
|
|
5343
|
+
if (domain === null) {
|
|
5344
|
+
this._domain = undefined;
|
|
5345
|
+
return this;
|
|
5346
|
+
}
|
|
5347
|
+
this._domain = domain;
|
|
5348
|
+
return this;
|
|
5349
|
+
}
|
|
5350
|
+
formatSpecifier(formatSpecifier) {
|
|
5351
|
+
if (formatSpecifier === null) {
|
|
5352
|
+
this._formatSpecifier = undefined;
|
|
5353
|
+
return this;
|
|
5354
|
+
}
|
|
5355
|
+
this._formatSpecifier = formatSpecifier;
|
|
5356
|
+
return this;
|
|
5357
|
+
}
|
|
5358
|
+
scaleFn(scaleFn) {
|
|
5359
|
+
if (scaleFn === null) {
|
|
5360
|
+
this._scaleFn = undefined;
|
|
5361
|
+
return this;
|
|
5362
|
+
}
|
|
5363
|
+
this._scaleFn = scaleFn;
|
|
5364
|
+
return this;
|
|
5365
|
+
}
|
|
5366
|
+
/**
|
|
5367
|
+
* @internal This function is for internal use only and should never be called by the user.
|
|
5368
|
+
*
|
|
5369
|
+
* @param dimensionName A user-intelligible name for the dimension being built. Used for error messages. Should be title cased.
|
|
5370
|
+
*/
|
|
5371
|
+
_build(dimensionName) {
|
|
5372
|
+
this.validateBuilder(dimensionName);
|
|
5373
|
+
return new DateChartPositionDimension({
|
|
5374
|
+
domain: this._domain,
|
|
5375
|
+
formatFunction: this._formatFunction,
|
|
5376
|
+
formatSpecifier: this._formatSpecifier,
|
|
5377
|
+
scaleFn: this._scaleFn,
|
|
5378
|
+
valueAccessor: this._valueAccessor,
|
|
5379
|
+
});
|
|
5380
|
+
}
|
|
5381
|
+
validateBuilder(dimensionName) {
|
|
5382
|
+
this.validateValueAccessor(dimensionName);
|
|
5383
|
+
}
|
|
5384
|
+
}
|
|
5385
|
+
|
|
5283
5386
|
class VicDataExport {
|
|
5284
5387
|
saveCSV(name, dataConfigs) {
|
|
5285
5388
|
const blobParts = [];
|
|
@@ -5427,109 +5530,6 @@ class VicDataExportConfig {
|
|
|
5427
5530
|
}
|
|
5428
5531
|
}
|
|
5429
5532
|
|
|
5430
|
-
/**
|
|
5431
|
-
* A dimension that transforms Date values into a position on a chart.
|
|
5432
|
-
*
|
|
5433
|
-
* This dimension is used for the positional dimensions of a chart, such as x and y. The underlying scale will always be a [D3 time scale](https://d3js.org/d3-scale/time). The range of the scale will be a dimension from the chart.
|
|
5434
|
-
*
|
|
5435
|
-
* The generic is the type of the data that will be passed to the dimension.
|
|
5436
|
-
*
|
|
5437
|
-
* TESTABLE FUNCTIONALITY
|
|
5438
|
-
*
|
|
5439
|
-
* - It extracts values for the dimension from data.
|
|
5440
|
-
* - tested in: lines.cy.ts
|
|
5441
|
-
* - It sets the domain of the dimension.
|
|
5442
|
-
* - tested in: lines.cy.ts
|
|
5443
|
-
* - It creates and returns a scale from a range.
|
|
5444
|
-
* - tested in: lines.cy.ts
|
|
5445
|
-
* - It checks if a value is in valid.
|
|
5446
|
-
* - tested in: lines.cy.ts
|
|
5447
|
-
* - The domain will be unique values from the user-provided domain if the user provides a domain.
|
|
5448
|
-
* - tested in: date-chart-position.spec.ts
|
|
5449
|
-
* - The domain will be unique values from the data if no custom domain is given by the user.
|
|
5450
|
-
* - tested in: date-chart-position.spec.ts
|
|
5451
|
-
* - The domain can be set in reverse order.
|
|
5452
|
-
* - tested in: date-chart-position.spec.ts
|
|
5453
|
-
*/
|
|
5454
|
-
class DateChartPositionDimension extends DataDimension {
|
|
5455
|
-
constructor(options) {
|
|
5456
|
-
super('date');
|
|
5457
|
-
safeAssign(this, options);
|
|
5458
|
-
}
|
|
5459
|
-
setPropertiesFromData(data) {
|
|
5460
|
-
this.setValues(data);
|
|
5461
|
-
this.setDomain();
|
|
5462
|
-
}
|
|
5463
|
-
setDomain() {
|
|
5464
|
-
const extents = this.domain === undefined
|
|
5465
|
-
? [min(this.values), max(this.values)]
|
|
5466
|
-
: this.domain;
|
|
5467
|
-
this.calculatedDomain = extents;
|
|
5468
|
-
}
|
|
5469
|
-
getScaleFromRange(range) {
|
|
5470
|
-
return this.scaleFn().domain(this.calculatedDomain).range(range);
|
|
5471
|
-
}
|
|
5472
|
-
// returns false if data is undefined or null of not a Date
|
|
5473
|
-
// for some charts this may be fine
|
|
5474
|
-
// original intended use case: d3Line can only handle defined values
|
|
5475
|
-
isValidValue(x) {
|
|
5476
|
-
return isDate(x);
|
|
5477
|
-
}
|
|
5478
|
-
}
|
|
5479
|
-
|
|
5480
|
-
const DEFAULT$o = {
|
|
5481
|
-
_scaleFn: scaleUtc,
|
|
5482
|
-
_formatSpecifier: '%Y %m',
|
|
5483
|
-
};
|
|
5484
|
-
class DateChartPositionDimensionBuilder extends DataDimensionBuilder {
|
|
5485
|
-
constructor() {
|
|
5486
|
-
super();
|
|
5487
|
-
safeAssign(this, DEFAULT$o);
|
|
5488
|
-
}
|
|
5489
|
-
domain(domain) {
|
|
5490
|
-
if (domain === null) {
|
|
5491
|
-
this._domain = undefined;
|
|
5492
|
-
return this;
|
|
5493
|
-
}
|
|
5494
|
-
this._domain = domain;
|
|
5495
|
-
return this;
|
|
5496
|
-
}
|
|
5497
|
-
formatSpecifier(formatSpecifier) {
|
|
5498
|
-
if (formatSpecifier === null) {
|
|
5499
|
-
this._formatSpecifier = undefined;
|
|
5500
|
-
return this;
|
|
5501
|
-
}
|
|
5502
|
-
this._formatSpecifier = formatSpecifier;
|
|
5503
|
-
return this;
|
|
5504
|
-
}
|
|
5505
|
-
scaleFn(scaleFn) {
|
|
5506
|
-
if (scaleFn === null) {
|
|
5507
|
-
this._scaleFn = undefined;
|
|
5508
|
-
return this;
|
|
5509
|
-
}
|
|
5510
|
-
this._scaleFn = scaleFn;
|
|
5511
|
-
return this;
|
|
5512
|
-
}
|
|
5513
|
-
/**
|
|
5514
|
-
* @internal This function is for internal use only and should never be called by the user.
|
|
5515
|
-
*
|
|
5516
|
-
* @param dimensionName A user-intelligible name for the dimension being built. Used for error messages. Should be title cased.
|
|
5517
|
-
*/
|
|
5518
|
-
_build(dimensionName) {
|
|
5519
|
-
this.validateBuilder(dimensionName);
|
|
5520
|
-
return new DateChartPositionDimension({
|
|
5521
|
-
domain: this._domain,
|
|
5522
|
-
formatFunction: this._formatFunction,
|
|
5523
|
-
formatSpecifier: this._formatSpecifier,
|
|
5524
|
-
scaleFn: this._scaleFn,
|
|
5525
|
-
valueAccessor: this._valueAccessor,
|
|
5526
|
-
});
|
|
5527
|
-
}
|
|
5528
|
-
validateBuilder(dimensionName) {
|
|
5529
|
-
this.validateValueAccessor(dimensionName);
|
|
5530
|
-
}
|
|
5531
|
-
}
|
|
5532
|
-
|
|
5533
5533
|
/**
|
|
5534
5534
|
* A dimension that transforms number values into a value of type number or string.
|
|
5535
5535
|
*
|
|
@@ -10981,5 +10981,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
10981
10981
|
* Generated bundle index. Do not edit.
|
|
10982
10982
|
*/
|
|
10983
10983
|
|
|
10984
|
-
export { AuxMarks, AuxMarksConfig, BARS, BarsClickEmitTooltipDataPauseOtherActions, BarsComponent, BarsConfig, BarsEventsDirective, BarsHoverEmitTooltipData, BarsHoverMoveEmitTooltipData, BarsHoverShowLabels, BarsLabels, BinStrategy, CHART, CHART_SIZE, CategoricalBinsAttributeDataDimension, Chart, ChartComponent, ChartConfig, ColorUtilities, CustomBreaksBinsAttributeDataDimension, DEFAULT_TOOLTIP_Y_OFFSET, DOTS, DataMarksConfig, DotsComponent, DotsConfig, DotsEventsDirective, DotsHoverDefaultStyles, DotsHoverMoveDefaultStyles, DotsHoverMoveEmitTooltipData, EqualFrequenciesAttributeDataDimension, EqualValueRangesAttributeDataDimension, EventType, EventsDirective, GEOGRAPHIES, GeographiesAttributeDataLayer, GeographiesAttributeDataLayerBuilder, GeographiesClickEmitTooltipDataPauseOtherActions, GeographiesComponent, GeographiesConfig, GeographiesEventsDirective, GeographiesGeojsonPropertiesLayer, GeographiesGeojsonPropertiesLayerBuilder, GeographiesHoverEmitTooltipData, GeographiesHoverMoveEmitTooltipData, GeographiesLabels, GeographiesLabelsBuilder, GroupedBarsComponent, GroupedBarsConfig, GroupedBarsEventsDirective, HorizontalBarsDimensionsBuilder, HtmlTooltipCdkManagedPosition, HtmlTooltipConfig, HtmlTooltipDirective, HtmlTooltipSize, HtmlTooltipSizeBuilder, LINES, LinesClickEmitTooltipDataPauseHoverMoveActions, LinesComponent, LinesConfig, LinesEventsDirective, LinesHoverMoveDefaultLinesStyles, LinesHoverMoveDefaultMarkersStyles, LinesHoverMoveDefaultStyles, LinesHoverMoveEmitTooltipData, LinesMarkerClickEmitTooltipData, LinesTooltipPositioner, MapChartComponent, MapLegendComponent, MapPrimaryMarks, MarksConfig, NoBinsAttributeDataDimension, Orientation, PointMarkers, PrimaryMarks, PrimaryMarksBuilder, PrimaryMarksConfig, QuantitativeRulesComponent, QuantitativeRulesConfig, QuantitativeRulesLabels, STACKED_AREA, STACKED_BARS, Side, StackedAreaComponent, StackedAreaConfig, StackedAreaEventsDirective, StackedAreaHoverMoveEmitTooltipData, StackedBarsClickEmitTooltipDataPauseOtherActions, StackedBarsComponent, StackedBarsConfig, StackedBarsEventsDirective, StackedBarsHoverEmitTooltipData, StackedBarsHoverMoveEmitTooltipData, Stroke, SvgTextWrap, TooltipPosition, TooltipPositionBuilder, TooltipPositioner, TooltipTriangleComponent, VIC_PRIMARY_MARKS, ValueExtent, VerticalBarsDimensionsBuilder, VicAuxMarksBuilder, VicBarsConfigBuilder, VicBarsModule, VicChartConfigBuilder, VicChartModule, VicColumnConfig, VicDataExport, VicDataExportConfig, VicDotsConfigBuilder, VicDotsModule, VicGeographiesConfigBuilder, VicGeographiesModule, VicGroupedBarsConfigBuilder, VicGroupedBarsModule, VicHtmlTooltipConfigBuilder, VicHtmlTooltipModule, VicImage, VicImageDownloadService, VicJpegImageConfig, VicLegendType, VicLinesConfigBuilder, VicLinesModule, VicMapAuxMarks, VicMapLegendModule, VicPngImageConfig, VicQuantitativeRulesConfigBuilder, VicQuantitativeRulesModule, VicStackedAreaConfigBuilder, VicStackedAreaModule, VicStackedBarsConfigBuilder, VicStackedBarsModule, VicSvgImageConfig, VicXOrdinalAxisConfig, VicXOrdinalAxisConfigBuilder, VicXQuantitativeAxisConfig, VicXQuantitativeAxisConfigBuilder, VicXyAxisModule, VicXyBackgroundModule, VicXyPrimaryMarks, VicYOrdinalAxisConfig, VicYOrdinalAxisConfigBuilder, VicYQuantitativeAxisConfig, VicYQuantitativeAxisConfigBuilder, XOrdinalAxisComponent, XQuantitativeAxisComponent, XyAuxMarks, XyBackgroundComponent, XyChartComponent, XyContentScale, XyMarksConfig, XyPrimaryMarksConfig, YOrdinalAxisComponent, YQuantitativeAxisComponent, valueFormat };
|
|
10984
|
+
export { AuxMarks, AuxMarksConfig, BARS, BarsClickEmitTooltipDataPauseOtherActions, BarsComponent, BarsConfig, BarsEventsDirective, BarsHoverEmitTooltipData, BarsHoverMoveEmitTooltipData, BarsHoverShowLabels, BarsLabels, BinStrategy, CHART, CHART_SIZE, CategoricalBinsAttributeDataDimension, Chart, ChartComponent, ChartConfig, ColorUtilities, CustomBreaksBinsAttributeDataDimension, DEFAULT_TOOLTIP_Y_OFFSET, DOTS, DataMarksConfig, DateChartPositionDimensionBuilder, DotsComponent, DotsConfig, DotsEventsDirective, DotsHoverDefaultStyles, DotsHoverMoveDefaultStyles, DotsHoverMoveEmitTooltipData, EqualFrequenciesAttributeDataDimension, EqualValueRangesAttributeDataDimension, EventType, EventsDirective, GEOGRAPHIES, GeographiesAttributeDataLayer, GeographiesAttributeDataLayerBuilder, GeographiesClickEmitTooltipDataPauseOtherActions, GeographiesComponent, GeographiesConfig, GeographiesEventsDirective, GeographiesGeojsonPropertiesLayer, GeographiesGeojsonPropertiesLayerBuilder, GeographiesHoverEmitTooltipData, GeographiesHoverMoveEmitTooltipData, GeographiesLabels, GeographiesLabelsBuilder, GroupedBarsComponent, GroupedBarsConfig, GroupedBarsEventsDirective, HorizontalBarsDimensionsBuilder, HtmlTooltipCdkManagedPosition, HtmlTooltipConfig, HtmlTooltipDirective, HtmlTooltipSize, HtmlTooltipSizeBuilder, LINES, LinesClickEmitTooltipDataPauseHoverMoveActions, LinesComponent, LinesConfig, LinesEventsDirective, LinesHoverMoveDefaultLinesStyles, LinesHoverMoveDefaultMarkersStyles, LinesHoverMoveDefaultStyles, LinesHoverMoveEmitTooltipData, LinesMarkerClickEmitTooltipData, LinesStrokeBuilder, LinesTooltipPositioner, MapChartComponent, MapLegendComponent, MapPrimaryMarks, MarksConfig, NoBinsAttributeDataDimension, NumberChartPositionDimensionBuilder, Orientation, PointMarkers, PrimaryMarks, PrimaryMarksBuilder, PrimaryMarksConfig, QuantitativeRulesComponent, QuantitativeRulesConfig, QuantitativeRulesLabels, STACKED_AREA, STACKED_BARS, Side, StackedAreaComponent, StackedAreaConfig, StackedAreaEventsDirective, StackedAreaHoverMoveEmitTooltipData, StackedBarsClickEmitTooltipDataPauseOtherActions, StackedBarsComponent, StackedBarsConfig, StackedBarsEventsDirective, StackedBarsHoverEmitTooltipData, StackedBarsHoverMoveEmitTooltipData, Stroke, SvgTextWrap, TooltipPosition, TooltipPositionBuilder, TooltipPositioner, TooltipTriangleComponent, VIC_PRIMARY_MARKS, ValueExtent, VerticalBarsDimensionsBuilder, VicAuxMarksBuilder, VicBarsConfigBuilder, VicBarsModule, VicChartConfigBuilder, VicChartModule, VicColumnConfig, VicDataExport, VicDataExportConfig, VicDotsConfigBuilder, VicDotsModule, VicGeographiesConfigBuilder, VicGeographiesModule, VicGroupedBarsConfigBuilder, VicGroupedBarsModule, VicHtmlTooltipConfigBuilder, VicHtmlTooltipModule, VicImage, VicImageDownloadService, VicJpegImageConfig, VicLegendType, VicLinesConfigBuilder, VicLinesModule, VicMapAuxMarks, VicMapLegendModule, VicPngImageConfig, VicQuantitativeRulesConfigBuilder, VicQuantitativeRulesModule, VicStackedAreaConfigBuilder, VicStackedAreaModule, VicStackedBarsConfigBuilder, VicStackedBarsModule, VicSvgImageConfig, VicXOrdinalAxisConfig, VicXOrdinalAxisConfigBuilder, VicXQuantitativeAxisConfig, VicXQuantitativeAxisConfigBuilder, VicXyAxisModule, VicXyBackgroundModule, VicXyPrimaryMarks, VicYOrdinalAxisConfig, VicYOrdinalAxisConfigBuilder, VicYQuantitativeAxisConfig, VicYQuantitativeAxisConfigBuilder, XOrdinalAxisComponent, XQuantitativeAxisComponent, XyAuxMarks, XyBackgroundComponent, XyChartComponent, XyContentScale, XyMarksConfig, XyPrimaryMarksConfig, YOrdinalAxisComponent, YQuantitativeAxisComponent, valueFormat };
|
|
10985
10985
|
//# sourceMappingURL=mathstack-viz.mjs.map
|