@carbon/charts 0.41.20 → 0.41.24
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 +28 -46
- package/axis-chart.d.ts +4 -4
- package/axis-chart.js +46 -46
- package/axis-chart.js.map +1 -1
- package/build/demo/create-codesandbox.d.ts +42 -42
- package/build/demo/data/bar.d.ts +2 -2
- package/build/demo/data/index.d.ts +13 -13
- package/build/demo/data/line.d.ts +4 -4
- package/build/demo/data/meter.d.ts +1 -1
- package/build/src/axis-chart.d.ts +4 -4
- package/build/src/chart.d.ts +3 -3
- package/build/src/charts/area-stacked.d.ts +2 -2
- package/build/src/charts/area.d.ts +2 -2
- package/build/src/charts/bar-grouped.d.ts +2 -2
- package/build/src/charts/bar-simple.d.ts +2 -2
- package/build/src/charts/bar-stacked.d.ts +2 -2
- package/build/src/charts/bubble.d.ts +2 -2
- package/build/src/charts/combo.d.ts +2 -2
- package/build/src/charts/donut.d.ts +2 -2
- package/build/src/charts/gauge.d.ts +3 -3
- package/build/src/charts/index.d.ts +16 -16
- package/build/src/charts/line.d.ts +2 -2
- package/build/src/charts/lollipop.d.ts +2 -2
- package/build/src/charts/meter.d.ts +3 -3
- package/build/src/charts/pie.d.ts +3 -3
- package/build/src/charts/radar.d.ts +2 -2
- package/build/src/charts/scatter.d.ts +2 -2
- package/build/src/charts/treemap.d.ts +2 -2
- package/build/src/components/axes/axis.d.ts +3 -3
- package/build/src/components/axes/chart-clip.d.ts +2 -2
- package/build/src/components/axes/grid-brush.d.ts +1 -1
- package/build/src/components/axes/grid.d.ts +1 -1
- package/build/src/components/axes/ruler-stacked.d.ts +1 -1
- package/build/src/components/axes/ruler.d.ts +2 -2
- package/build/src/components/axes/toolbar.d.ts +2 -2
- package/build/src/components/axes/two-dimensional-axes.d.ts +2 -2
- package/build/src/components/axes/zero-line.d.ts +1 -1
- package/build/src/components/axes/zoom-bar.d.ts +2 -2
- package/build/src/components/component.d.ts +1 -1
- package/build/src/components/essentials/legend.d.ts +1 -1
- package/build/src/components/essentials/threshold.d.ts +3 -3
- package/build/src/components/essentials/title-meter.d.ts +1 -1
- package/build/src/components/essentials/title.d.ts +1 -1
- package/build/src/components/essentials/tooltip-axis.d.ts +1 -1
- package/build/src/components/essentials/tooltip.d.ts +3 -3
- package/build/src/components/graphs/area-stacked.d.ts +1 -1
- package/build/src/components/graphs/area.d.ts +1 -1
- package/build/src/components/graphs/bar-grouped.d.ts +2 -2
- package/build/src/components/graphs/bar-simple.d.ts +1 -1
- package/build/src/components/graphs/bar-stacked.d.ts +1 -1
- package/build/src/components/graphs/bar.d.ts +1 -1
- package/build/src/components/graphs/bubble.d.ts +2 -2
- package/build/src/components/graphs/donut.d.ts +1 -1
- package/build/src/components/graphs/gauge.d.ts +1 -1
- package/build/src/components/graphs/line.d.ts +1 -1
- package/build/src/components/graphs/lollipop.d.ts +1 -1
- package/build/src/components/graphs/meter.d.ts +1 -1
- package/build/src/components/graphs/pie.d.ts +1 -1
- package/build/src/components/graphs/radar.d.ts +1 -1
- package/build/src/components/graphs/scatter-stacked.d.ts +1 -1
- package/build/src/components/graphs/scatter.d.ts +2 -2
- package/build/src/components/graphs/skeleton-lines.d.ts +1 -1
- package/build/src/components/graphs/skeleton.d.ts +1 -1
- package/build/src/components/graphs/treemap.d.ts +1 -1
- package/build/src/components/index.d.ts +36 -36
- package/build/src/components/layout/layout.d.ts +3 -3
- package/build/src/components/layout/spacer.d.ts +1 -1
- package/build/src/configuration-non-customizable.d.ts +7 -7
- package/build/src/configuration.d.ts +2 -2
- package/build/src/interfaces/axis-scales.d.ts +7 -7
- package/build/src/interfaces/charts.d.ts +11 -4
- package/build/src/interfaces/components.d.ts +3 -3
- package/build/src/interfaces/enums.d.ts +1 -1
- package/build/src/interfaces/index.d.ts +7 -7
- package/build/src/interfaces/layout.d.ts +1 -1
- package/build/src/interfaces/model.d.ts +1 -1
- package/build/src/model-cartesian-charts.d.ts +1 -1
- package/build/src/model-gauge.d.ts +1 -1
- package/build/src/model-meter.d.ts +1 -1
- package/build/src/model-pie.d.ts +1 -1
- package/build/src/model.d.ts +1 -9
- package/build/src/services/angle-utils.d.ts +1 -1
- package/build/src/services/curves.d.ts +2 -2
- package/build/src/services/essentials/dom-utils.d.ts +2 -2
- package/build/src/services/essentials/events.d.ts +1 -1
- package/build/src/services/essentials/gradient-utils.d.ts +1 -1
- package/build/src/services/essentials/transitions.d.ts +2 -2
- package/build/src/services/index.d.ts +7 -7
- package/build/src/services/scales-cartesian.d.ts +2 -2
- package/build/src/services/service.d.ts +1 -1
- package/build/src/services/time-series.d.ts +1 -1
- package/build/src/services/zoom.d.ts +2 -2
- package/build/src/tools.d.ts +2 -2
- package/build/stories/all.stories.d.ts +1 -1
- package/build/stories/tutorials/index.d.ts +11 -11
- package/build/stories/tutorials.stories.d.ts +1 -1
- package/bundle.js +1 -1
- package/chart.d.ts +3 -3
- package/chart.js +35 -35
- package/chart.js.map +1 -1
- package/charts/area-stacked.d.ts +2 -2
- package/charts/area-stacked.js +8 -8
- package/charts/area-stacked.js.map +1 -1
- package/charts/area.d.ts +2 -2
- package/charts/area.js +8 -8
- package/charts/area.js.map +1 -1
- package/charts/bar-grouped.d.ts +2 -2
- package/charts/bar-grouped.js +7 -7
- package/charts/bar-grouped.js.map +1 -1
- package/charts/bar-simple.d.ts +2 -2
- package/charts/bar-simple.js +7 -7
- package/charts/bar-simple.js.map +1 -1
- package/charts/bar-stacked.d.ts +2 -2
- package/charts/bar-stacked.js +7 -7
- package/charts/bar-stacked.js.map +1 -1
- package/charts/bubble.d.ts +2 -2
- package/charts/bubble.js +7 -7
- package/charts/bubble.js.map +1 -1
- package/charts/combo.d.ts +2 -2
- package/charts/combo.js +12 -12
- package/charts/combo.js.map +1 -1
- package/charts/donut.d.ts +2 -2
- package/charts/donut.js +7 -7
- package/charts/donut.js.map +1 -1
- package/charts/gauge.d.ts +3 -3
- package/charts/gauge.js +5 -5
- package/charts/gauge.js.map +1 -1
- package/charts/index.d.ts +16 -16
- package/charts/index.js +16 -16
- package/charts/index.js.map +1 -1
- package/charts/line.d.ts +2 -2
- package/charts/line.js +5 -5
- package/charts/line.js.map +1 -1
- package/charts/lollipop.d.ts +2 -2
- package/charts/lollipop.js +7 -7
- package/charts/lollipop.js.map +1 -1
- package/charts/meter.d.ts +3 -3
- package/charts/meter.js +18 -18
- package/charts/meter.js.map +1 -1
- package/charts/pie.d.ts +3 -3
- package/charts/pie.js +8 -8
- package/charts/pie.js.map +1 -1
- package/charts/radar.d.ts +2 -2
- package/charts/radar.js +5 -5
- package/charts/radar.js.map +1 -1
- package/charts/scatter.d.ts +2 -2
- package/charts/scatter.js +7 -7
- package/charts/scatter.js.map +1 -1
- package/charts/treemap.d.ts +2 -2
- package/charts/treemap.js +4 -4
- package/charts/treemap.js.map +1 -1
- package/components/axes/axis.d.ts +3 -3
- package/components/axes/axis.js +98 -98
- package/components/axes/axis.js.map +1 -1
- package/components/axes/chart-clip.d.ts +2 -2
- package/components/axes/chart-clip.js +9 -9
- package/components/axes/chart-clip.js.map +1 -1
- package/components/axes/grid-brush.d.ts +1 -1
- package/components/axes/grid-brush.js +32 -32
- package/components/axes/grid-brush.js.map +1 -1
- package/components/axes/grid.d.ts +1 -1
- package/components/axes/grid.js +34 -34
- package/components/axes/grid.js.map +1 -1
- package/components/axes/ruler-stacked.d.ts +1 -1
- package/components/axes/ruler-stacked.js +5 -5
- package/components/axes/ruler-stacked.js.map +1 -1
- package/components/axes/ruler.d.ts +2 -2
- package/components/axes/ruler.js +36 -36
- package/components/axes/ruler.js.map +1 -1
- package/components/axes/toolbar.d.ts +2 -2
- package/components/axes/toolbar.js +85 -85
- package/components/axes/toolbar.js.map +1 -1
- package/components/axes/two-dimensional-axes.d.ts +2 -2
- package/components/axes/two-dimensional-axes.js +13 -13
- package/components/axes/two-dimensional-axes.js.map +1 -1
- package/components/axes/zero-line.d.ts +1 -1
- package/components/axes/zero-line.js +12 -12
- package/components/axes/zero-line.js.map +1 -1
- package/components/axes/zoom-bar.d.ts +2 -2
- package/components/axes/zoom-bar.js +114 -114
- package/components/axes/zoom-bar.js.map +1 -1
- package/components/component.d.ts +1 -1
- package/components/component.js +13 -13
- package/components/component.js.map +1 -1
- package/components/essentials/legend.d.ts +1 -1
- package/components/essentials/legend.js +95 -92
- package/components/essentials/legend.js.map +1 -1
- package/components/essentials/threshold.d.ts +3 -3
- package/components/essentials/threshold.js +39 -39
- package/components/essentials/threshold.js.map +1 -1
- package/components/essentials/title-meter.d.ts +1 -1
- package/components/essentials/title-meter.js +42 -42
- package/components/essentials/title-meter.js.map +1 -1
- package/components/essentials/title.d.ts +1 -1
- package/components/essentials/title.js +19 -19
- package/components/essentials/title.js.map +1 -1
- package/components/essentials/tooltip-axis.d.ts +1 -1
- package/components/essentials/tooltip-axis.js +23 -23
- package/components/essentials/tooltip-axis.js.map +1 -1
- package/components/essentials/tooltip.d.ts +3 -3
- package/components/essentials/tooltip.js +31 -31
- package/components/essentials/tooltip.js.map +1 -1
- package/components/graphs/area-stacked.d.ts +1 -1
- package/components/graphs/area-stacked.js +28 -29
- package/components/graphs/area-stacked.js.map +1 -1
- package/components/graphs/area.d.ts +1 -1
- package/components/graphs/area.js +62 -57
- package/components/graphs/area.js.map +1 -1
- package/components/graphs/bar-grouped.d.ts +2 -2
- package/components/graphs/bar-grouped.js +56 -56
- package/components/graphs/bar-grouped.js.map +1 -1
- package/components/graphs/bar-simple.d.ts +1 -1
- package/components/graphs/bar-simple.js +45 -45
- package/components/graphs/bar-simple.js.map +1 -1
- package/components/graphs/bar-stacked.d.ts +1 -1
- package/components/graphs/bar-stacked.js +50 -51
- package/components/graphs/bar-stacked.js.map +1 -1
- package/components/graphs/bar.d.ts +1 -1
- package/components/graphs/bar.js +4 -4
- package/components/graphs/bar.js.map +1 -1
- package/components/graphs/bubble.d.ts +2 -2
- package/components/graphs/bubble.js +19 -19
- package/components/graphs/bubble.js.map +1 -1
- package/components/graphs/donut.d.ts +1 -1
- package/components/graphs/donut.js +20 -20
- package/components/graphs/donut.js.map +1 -1
- package/components/graphs/gauge.d.ts +1 -1
- package/components/graphs/gauge.js +89 -87
- package/components/graphs/gauge.js.map +1 -1
- package/components/graphs/line.d.ts +1 -1
- package/components/graphs/line.js +33 -33
- package/components/graphs/line.js.map +1 -1
- package/components/graphs/lollipop.d.ts +1 -1
- package/components/graphs/lollipop.js +32 -32
- package/components/graphs/lollipop.js.map +1 -1
- package/components/graphs/meter.d.ts +1 -1
- package/components/graphs/meter.js +39 -39
- package/components/graphs/meter.js.map +1 -1
- package/components/graphs/pie.d.ts +1 -1
- package/components/graphs/pie.js +102 -100
- package/components/graphs/pie.js.map +1 -1
- package/components/graphs/radar.d.ts +1 -1
- package/components/graphs/radar.js +180 -180
- package/components/graphs/radar.js.map +1 -1
- package/components/graphs/scatter-stacked.d.ts +1 -1
- package/components/graphs/scatter-stacked.js +22 -22
- package/components/graphs/scatter-stacked.js.map +1 -1
- package/components/graphs/scatter.d.ts +2 -2
- package/components/graphs/scatter.js +67 -66
- package/components/graphs/scatter.js.map +1 -1
- package/components/graphs/skeleton-lines.d.ts +1 -1
- package/components/graphs/skeleton-lines.js +27 -27
- package/components/graphs/skeleton-lines.js.map +1 -1
- package/components/graphs/skeleton.d.ts +1 -1
- package/components/graphs/skeleton.js +85 -85
- package/components/graphs/skeleton.js.map +1 -1
- package/components/graphs/treemap.d.ts +1 -1
- package/components/graphs/treemap.js +82 -82
- package/components/graphs/treemap.js.map +1 -1
- package/components/index.d.ts +36 -36
- package/components/index.js +36 -36
- package/components/index.js.map +1 -1
- package/components/layout/layout.d.ts +3 -3
- package/components/layout/layout.js +28 -28
- package/components/layout/layout.js.map +1 -1
- package/components/layout/spacer.d.ts +1 -1
- package/components/layout/spacer.js +10 -10
- package/components/layout/spacer.js.map +1 -1
- package/configuration-non-customizable.d.ts +7 -7
- package/configuration-non-customizable.js +37 -37
- package/configuration-non-customizable.js.map +1 -1
- package/configuration.d.ts +2 -2
- package/configuration.js +81 -78
- package/configuration.js.map +1 -1
- package/demo/create-codesandbox.d.ts +42 -42
- package/demo/create-codesandbox.js +100 -100
- package/demo/create-codesandbox.js.map +1 -1
- package/demo/data/area.js +220 -190
- package/demo/data/area.js.map +1 -1
- package/demo/data/bar.d.ts +2 -2
- package/demo/data/bar.js +302 -302
- package/demo/data/bar.js.map +1 -1
- package/demo/data/bubble.js +108 -108
- package/demo/data/bubble.js.map +1 -1
- package/demo/data/combo.js +323 -323
- package/demo/data/combo.js.map +1 -1
- package/demo/data/donut.js +19 -19
- package/demo/data/donut.js.map +1 -1
- package/demo/data/gauge.js +20 -20
- package/demo/data/gauge.js.map +1 -1
- package/demo/data/high-scale.js +3 -3
- package/demo/data/high-scale.js.map +1 -1
- package/demo/data/index.d.ts +13 -13
- package/demo/data/index.js +299 -299
- package/demo/data/index.js.map +1 -1
- package/demo/data/line.d.ts +4 -4
- package/demo/data/line.js +332 -332
- package/demo/data/line.js.map +1 -1
- package/demo/data/lollipop.js +19 -19
- package/demo/data/lollipop.js.map +1 -1
- package/demo/data/meter.d.ts +1 -1
- package/demo/data/meter.js +22 -22
- package/demo/data/meter.js.map +1 -1
- package/demo/data/pie.js +17 -17
- package/demo/data/pie.js.map +1 -1
- package/demo/data/radar.js +84 -84
- package/demo/data/radar.js.map +1 -1
- package/demo/data/scatter.js +125 -125
- package/demo/data/scatter.js.map +1 -1
- package/demo/data/step.js +11 -11
- package/demo/data/step.js.map +1 -1
- package/demo/data/time-series-axis.js +164 -164
- package/demo/data/time-series-axis.js.map +1 -1
- package/demo/data/toolbar.js +15 -15
- package/demo/data/toolbar.js.map +1 -1
- package/demo/data/treemap.js +63 -63
- package/demo/data/treemap.js.map +1 -1
- package/demo/data/zoom-bar.js +65 -65
- package/demo/data/zoom-bar.js.map +1 -1
- package/demo/styles.css +1 -1
- package/demo/styles.min.css +1 -1
- package/demo/tsconfig.tsbuildinfo +45 -45
- package/index.d.ts +3 -3
- package/index.js +3 -3
- package/index.js.map +1 -1
- package/interfaces/a11y.js.map +1 -1
- package/interfaces/axis-scales.d.ts +7 -7
- package/interfaces/axis-scales.js.map +1 -1
- package/interfaces/charts.d.ts +11 -4
- package/interfaces/charts.js.map +1 -1
- package/interfaces/components.d.ts +3 -3
- package/interfaces/components.js.map +1 -1
- package/interfaces/enums.d.ts +1 -1
- package/interfaces/enums.js +1 -1
- package/interfaces/enums.js.map +1 -1
- package/interfaces/events.js.map +1 -1
- package/interfaces/index.d.ts +7 -7
- package/interfaces/index.js +2 -2
- package/interfaces/index.js.map +1 -1
- package/interfaces/layout.d.ts +1 -1
- package/interfaces/layout.js.map +1 -1
- package/interfaces/model.d.ts +1 -1
- package/interfaces/model.js.map +1 -1
- package/model-cartesian-charts.d.ts +1 -1
- package/model-cartesian-charts.js +7 -7
- package/model-cartesian-charts.js.map +1 -1
- package/model-gauge.d.ts +1 -1
- package/model-gauge.js +2 -2
- package/model-gauge.js.map +1 -1
- package/model-meter.d.ts +1 -1
- package/model-meter.js +7 -7
- package/model-meter.js.map +1 -1
- package/model-pie.d.ts +1 -1
- package/model-pie.js +1 -1
- package/model-pie.js.map +1 -1
- package/model.d.ts +1 -9
- package/model.js +31 -42
- package/model.js.map +1 -1
- package/package.json +2 -3
- package/polyfills.js +9 -9
- package/polyfills.js.map +1 -1
- package/services/angle-utils.d.ts +1 -1
- package/services/angle-utils.js +9 -9
- package/services/angle-utils.js.map +1 -1
- package/services/curves.d.ts +2 -2
- package/services/curves.js +6 -6
- package/services/curves.js.map +1 -1
- package/services/essentials/dom-utils.d.ts +2 -2
- package/services/essentials/dom-utils.js +37 -37
- package/services/essentials/dom-utils.js.map +1 -1
- package/services/essentials/events.d.ts +1 -1
- package/services/essentials/events.js +3 -3
- package/services/essentials/events.js.map +1 -1
- package/services/essentials/gradient-utils.d.ts +1 -1
- package/services/essentials/gradient-utils.js +25 -25
- package/services/essentials/gradient-utils.js.map +1 -1
- package/services/essentials/transitions.d.ts +2 -2
- package/services/essentials/transitions.js +8 -8
- package/services/essentials/transitions.js.map +1 -1
- package/services/index.d.ts +7 -7
- package/services/index.js +7 -7
- package/services/index.js.map +1 -1
- package/services/scales-cartesian.d.ts +2 -2
- package/services/scales-cartesian.js +57 -60
- package/services/scales-cartesian.js.map +1 -1
- package/services/service.d.ts +1 -1
- package/services/service.js.map +1 -1
- package/services/time-series.d.ts +1 -1
- package/services/time-series.js +27 -27
- package/services/time-series.js.map +1 -1
- package/services/zoom.d.ts +2 -2
- package/services/zoom.js +20 -20
- package/services/zoom.js.map +1 -1
- package/styles/_type.scss +7 -7
- package/styles/color-palatte.scss +218 -218
- package/styles/colors.scss +3 -3
- package/styles/components/_axis.scss +5 -5
- package/styles/components/_ruler.scss +2 -2
- package/styles/components/_threshold.scss +1 -1
- package/styles/components/_title.scss +3 -3
- package/styles/components/_toolbar.scss +1 -1
- package/styles/components/_tooltip.scss +6 -6
- package/styles/components/index.scss +16 -16
- package/styles/graphs/_bubble.scss +1 -1
- package/styles/graphs/_radar.scss +2 -2
- package/styles/graphs/_scatter.scss +1 -1
- package/styles/graphs/_treemap.scss +1 -1
- package/styles/graphs/index.scss +9 -9
- package/styles/styles-g10.scss +2 -2
- package/styles/styles-g100.scss +2 -2
- package/styles/styles-g90.scss +2 -2
- package/styles/styles-white.scss +2 -2
- package/styles/styles.scss +10 -10
- package/tools.d.ts +2 -2
- package/tools.js +26 -26
- package/tools.js.map +1 -1
- package/tsconfig.tsbuildinfo +173 -173
|
@@ -12,24 +12,24 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
12
12
|
};
|
|
13
13
|
})();
|
|
14
14
|
// Internal Imports
|
|
15
|
-
import { Component } from
|
|
16
|
-
import { DOMUtils } from
|
|
17
|
-
import { Events, Roles, ColorClassNameTypes } from
|
|
18
|
-
import { Tools } from
|
|
19
|
-
import { radialLabelPlacement, radToDeg, polarToCartesianCoords, distanceBetweenPointOnCircAndVerticalDiameter } from
|
|
20
|
-
import * as Configuration from
|
|
15
|
+
import { Component } from '../component';
|
|
16
|
+
import { DOMUtils } from '../../services';
|
|
17
|
+
import { Events, Roles, ColorClassNameTypes } from '../../interfaces';
|
|
18
|
+
import { Tools } from '../../tools';
|
|
19
|
+
import { radialLabelPlacement, radToDeg, polarToCartesianCoords, distanceBetweenPointOnCircAndVerticalDiameter, } from '../../services/angle-utils';
|
|
20
|
+
import * as Configuration from '../../configuration';
|
|
21
21
|
// D3 Imports
|
|
22
|
-
import { select } from
|
|
23
|
-
import { scaleBand, scaleLinear } from
|
|
24
|
-
import { max, extent } from
|
|
25
|
-
import { lineRadial, curveLinearClosed } from
|
|
22
|
+
import { select } from 'd3-selection';
|
|
23
|
+
import { scaleBand, scaleLinear } from 'd3-scale';
|
|
24
|
+
import { max, extent } from 'd3-array';
|
|
25
|
+
import { lineRadial, curveLinearClosed } from 'd3-shape';
|
|
26
26
|
// used to make transitions
|
|
27
27
|
var oldYScale;
|
|
28
28
|
var Radar = /** @class */ (function (_super) {
|
|
29
29
|
__extends(Radar, _super);
|
|
30
30
|
function Radar() {
|
|
31
31
|
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
32
|
-
_this.type =
|
|
32
|
+
_this.type = 'radar';
|
|
33
33
|
// append temporarily the label to get the exact space that it occupies
|
|
34
34
|
_this.getLabelDimensions = function (label) {
|
|
35
35
|
var tmpTick = DOMUtils.appendOrSelect(_this.getContainerSVG(), "g.tmp-tick");
|
|
@@ -42,8 +42,8 @@ var Radar = /** @class */ (function (_super) {
|
|
|
42
42
|
// creates corresponding data with value = null
|
|
43
43
|
_this.normalizeFlatData = function (dataset) {
|
|
44
44
|
var options = _this.getOptions();
|
|
45
|
-
var _a = Tools.getProperty(options,
|
|
46
|
-
var groupMapsTo = Tools.getProperty(options,
|
|
45
|
+
var _a = Tools.getProperty(options, 'radar', 'axes'), angle = _a.angle, value = _a.value;
|
|
46
|
+
var groupMapsTo = Tools.getProperty(options, 'data', 'groupMapsTo');
|
|
47
47
|
var completeBlankData = Tools.flatMapDeep(_this.uniqueKeys.map(function (key) {
|
|
48
48
|
return _this.uniqueGroups.map(function (group) {
|
|
49
49
|
var _a;
|
|
@@ -60,8 +60,8 @@ var Radar = /** @class */ (function (_super) {
|
|
|
60
60
|
// creates corresponding data with value = null
|
|
61
61
|
_this.normalizeGroupedData = function (dataset) {
|
|
62
62
|
var options = _this.getOptions();
|
|
63
|
-
var _a = Tools.getProperty(options,
|
|
64
|
-
var groupMapsTo = Tools.getProperty(options,
|
|
63
|
+
var _a = Tools.getProperty(options, 'radar', 'axes'), angle = _a.angle, value = _a.value;
|
|
64
|
+
var groupMapsTo = Tools.getProperty(options, 'data', 'groupMapsTo');
|
|
65
65
|
return dataset.map(function (_a) {
|
|
66
66
|
var name = _a.name, data = _a.data;
|
|
67
67
|
var completeBlankData = _this.uniqueKeys.map(function (k) {
|
|
@@ -78,15 +78,15 @@ var Radar = /** @class */ (function (_super) {
|
|
|
78
78
|
_this.handleLegendOnHover = function (event) {
|
|
79
79
|
var hoveredElement = event.detail.hoveredElement;
|
|
80
80
|
_this.parent
|
|
81
|
-
.selectAll(
|
|
82
|
-
.transition(_this.services.transitions.getTransition(
|
|
83
|
-
.style(
|
|
81
|
+
.selectAll('g.blobs path')
|
|
82
|
+
.transition(_this.services.transitions.getTransition('legend-hover-blob'))
|
|
83
|
+
.style('fill-opacity', function (group) {
|
|
84
84
|
if (group.name !== hoveredElement.datum().name) {
|
|
85
85
|
return Configuration.radar.opacity.unselected;
|
|
86
86
|
}
|
|
87
87
|
return Configuration.radar.opacity.selected;
|
|
88
88
|
})
|
|
89
|
-
.style(
|
|
89
|
+
.style('stroke-opacity', function (group) {
|
|
90
90
|
if (group.name !== hoveredElement.datum().name) {
|
|
91
91
|
return Configuration.radar.opacity.unselected;
|
|
92
92
|
}
|
|
@@ -95,10 +95,10 @@ var Radar = /** @class */ (function (_super) {
|
|
|
95
95
|
};
|
|
96
96
|
_this.handleLegendMouseOut = function (event) {
|
|
97
97
|
_this.parent
|
|
98
|
-
.selectAll(
|
|
99
|
-
.transition(_this.services.transitions.getTransition(
|
|
100
|
-
.style(
|
|
101
|
-
.style(
|
|
98
|
+
.selectAll('g.blobs path')
|
|
99
|
+
.transition(_this.services.transitions.getTransition('legend-mouseout-blob'))
|
|
100
|
+
.style('fill-opacity', Configuration.radar.opacity.selected)
|
|
101
|
+
.style('stroke-opacity', 1);
|
|
102
102
|
};
|
|
103
103
|
return _this;
|
|
104
104
|
}
|
|
@@ -114,14 +114,14 @@ var Radar = /** @class */ (function (_super) {
|
|
|
114
114
|
if (animate === void 0) { animate = true; }
|
|
115
115
|
var svg = this.getContainerSVG();
|
|
116
116
|
var _a = DOMUtils.getSVGElementSize(this.parent, {
|
|
117
|
-
useAttrs: true
|
|
117
|
+
useAttrs: true,
|
|
118
118
|
}), width = _a.width, height = _a.height;
|
|
119
119
|
var data = this.model.getData();
|
|
120
120
|
var displayData = this.model.getDisplayData();
|
|
121
121
|
var groupedData = this.model.getGroupedData();
|
|
122
122
|
var options = this.getOptions();
|
|
123
|
-
var _b = Tools.getProperty(options,
|
|
124
|
-
var groupMapsTo = Tools.getProperty(options,
|
|
123
|
+
var _b = Tools.getProperty(options, 'radar', 'axes'), angle = _b.angle, value = _b.value;
|
|
124
|
+
var groupMapsTo = Tools.getProperty(options, 'data', 'groupMapsTo');
|
|
125
125
|
var _c = Configuration.radar, xLabelPadding = _c.xLabelPadding, yLabelPadding = _c.yLabelPadding, yTicksNumber = _c.yTicksNumber, minRange = _c.minRange, xAxisRectHeight = _c.xAxisRectHeight;
|
|
126
126
|
this.uniqueKeys = Array.from(new Set(data.map(function (d) { return d[angle]; })));
|
|
127
127
|
this.uniqueGroups = Array.from(new Set(data.map(function (d) { return d[groupMapsTo]; })));
|
|
@@ -143,7 +143,7 @@ var Radar = /** @class */ (function (_super) {
|
|
|
143
143
|
var yScale = scaleLinear()
|
|
144
144
|
.domain([
|
|
145
145
|
0,
|
|
146
|
-
max(this.displayDataNormalized.map(function (d) { return d[value]; }))
|
|
146
|
+
max(this.displayDataNormalized.map(function (d) { return d[value]; })),
|
|
147
147
|
])
|
|
148
148
|
.range([minRange, radius])
|
|
149
149
|
.nice(yTicksNumber);
|
|
@@ -176,15 +176,15 @@ var Radar = /** @class */ (function (_super) {
|
|
|
176
176
|
// center coordinates
|
|
177
177
|
var c = {
|
|
178
178
|
x: leftPadding + xLabelPadding,
|
|
179
|
-
y: height / 2
|
|
179
|
+
y: height / 2,
|
|
180
180
|
};
|
|
181
181
|
/////////////////////////////
|
|
182
182
|
// Drawing the radar
|
|
183
183
|
/////////////////////////////
|
|
184
184
|
// y axes
|
|
185
|
-
var yAxes = DOMUtils.appendOrSelect(svg,
|
|
185
|
+
var yAxes = DOMUtils.appendOrSelect(svg, 'g.y-axes').attr('role', Roles.GROUP);
|
|
186
186
|
var yAxisUpdate = yAxes
|
|
187
|
-
.selectAll(
|
|
187
|
+
.selectAll('path')
|
|
188
188
|
.data(yTicks, function (tick) { return tick; });
|
|
189
189
|
// for each tick, create array of data corresponding to the points composing the shape
|
|
190
190
|
var shapeData = function (tick) {
|
|
@@ -195,294 +195,294 @@ var Radar = /** @class */ (function (_super) {
|
|
|
195
195
|
};
|
|
196
196
|
yAxisUpdate.join(function (enter) {
|
|
197
197
|
return enter
|
|
198
|
-
.append(
|
|
199
|
-
.attr(
|
|
200
|
-
.attr(
|
|
201
|
-
.attr(
|
|
202
|
-
.attr(
|
|
203
|
-
.attr(
|
|
198
|
+
.append('path')
|
|
199
|
+
.attr('role', Roles.GRAPHICS_SYMBOL)
|
|
200
|
+
.attr('opacity', 0)
|
|
201
|
+
.attr('transform', "translate(" + c.x + ", " + c.y + ")")
|
|
202
|
+
.attr('fill', 'none')
|
|
203
|
+
.attr('d', function (tick) {
|
|
204
204
|
return oldRadialLineGenerator(shapeData(tick));
|
|
205
205
|
})
|
|
206
206
|
.call(function (selection) {
|
|
207
207
|
return selection
|
|
208
|
-
.transition(_this.services.transitions.getTransition(
|
|
209
|
-
.attr(
|
|
210
|
-
.attr(
|
|
208
|
+
.transition(_this.services.transitions.getTransition('radar_y_axes_enter', animate))
|
|
209
|
+
.attr('opacity', 1)
|
|
210
|
+
.attr('d', function (tick) {
|
|
211
211
|
return radialLineGenerator(shapeData(tick));
|
|
212
212
|
});
|
|
213
213
|
});
|
|
214
214
|
}, function (update) {
|
|
215
215
|
return update.call(function (selection) {
|
|
216
216
|
return selection
|
|
217
|
-
.transition(_this.services.transitions.getTransition(
|
|
218
|
-
.attr(
|
|
219
|
-
.attr(
|
|
220
|
-
.attr(
|
|
217
|
+
.transition(_this.services.transitions.getTransition('radar_y_axes_update', animate))
|
|
218
|
+
.attr('opacity', 1)
|
|
219
|
+
.attr('transform', "translate(" + c.x + ", " + c.y + ")")
|
|
220
|
+
.attr('d', function (tick) {
|
|
221
221
|
return radialLineGenerator(shapeData(tick));
|
|
222
222
|
});
|
|
223
223
|
});
|
|
224
224
|
}, function (exit) {
|
|
225
225
|
return exit.call(function (selection) {
|
|
226
226
|
return selection
|
|
227
|
-
.transition(_this.services.transitions.getTransition(
|
|
228
|
-
.attr(
|
|
227
|
+
.transition(_this.services.transitions.getTransition('radar_y_axes_exit', animate))
|
|
228
|
+
.attr('d', function (tick) {
|
|
229
229
|
return radialLineGenerator(shapeData(tick));
|
|
230
230
|
})
|
|
231
|
-
.attr(
|
|
231
|
+
.attr('opacity', 0)
|
|
232
232
|
.remove();
|
|
233
233
|
});
|
|
234
234
|
});
|
|
235
235
|
// x axes
|
|
236
|
-
var xAxes = DOMUtils.appendOrSelect(svg,
|
|
236
|
+
var xAxes = DOMUtils.appendOrSelect(svg, 'g.x-axes').attr('role', Roles.GROUP);
|
|
237
237
|
var xAxisUpdate = xAxes
|
|
238
|
-
.selectAll(
|
|
238
|
+
.selectAll('line')
|
|
239
239
|
.data(this.uniqueKeys, function (key) { return key; });
|
|
240
240
|
xAxisUpdate.join(function (enter) {
|
|
241
241
|
return enter
|
|
242
|
-
.append(
|
|
243
|
-
.attr(
|
|
244
|
-
.attr(
|
|
245
|
-
.attr(
|
|
246
|
-
.attr(
|
|
247
|
-
.attr(
|
|
248
|
-
.attr(
|
|
249
|
-
.attr(
|
|
250
|
-
.attr(
|
|
242
|
+
.append('line')
|
|
243
|
+
.attr('role', Roles.GRAPHICS_SYMBOL)
|
|
244
|
+
.attr('opacity', 0)
|
|
245
|
+
.attr('class', function (key) { return "x-axis-" + Tools.kebabCase(key); }) // replace spaces with -
|
|
246
|
+
.attr('stroke-dasharray', '0')
|
|
247
|
+
.attr('x1', function (key) { return polarToCartesianCoords(xScale(key), 0, c).x; })
|
|
248
|
+
.attr('y1', function (key) { return polarToCartesianCoords(xScale(key), 0, c).y; })
|
|
249
|
+
.attr('x2', function (key) { return polarToCartesianCoords(xScale(key), 0, c).x; })
|
|
250
|
+
.attr('y2', function (key) { return polarToCartesianCoords(xScale(key), 0, c).y; })
|
|
251
251
|
.call(function (selection) {
|
|
252
252
|
return selection
|
|
253
|
-
.transition(_this.services.transitions.getTransition(
|
|
254
|
-
.attr(
|
|
255
|
-
.attr(
|
|
253
|
+
.transition(_this.services.transitions.getTransition('radar_x_axes_enter', animate))
|
|
254
|
+
.attr('opacity', 1)
|
|
255
|
+
.attr('x1', function (key) {
|
|
256
256
|
return polarToCartesianCoords(xScale(key), yScale.range()[0], c).x;
|
|
257
257
|
})
|
|
258
|
-
.attr(
|
|
258
|
+
.attr('y1', function (key) {
|
|
259
259
|
return polarToCartesianCoords(xScale(key), yScale.range()[0], c).y;
|
|
260
260
|
})
|
|
261
|
-
.attr(
|
|
261
|
+
.attr('x2', function (key) {
|
|
262
262
|
return polarToCartesianCoords(xScale(key), yScale.range()[1], c).x;
|
|
263
263
|
})
|
|
264
|
-
.attr(
|
|
264
|
+
.attr('y2', function (key) {
|
|
265
265
|
return polarToCartesianCoords(xScale(key), yScale.range()[1], c).y;
|
|
266
266
|
});
|
|
267
267
|
});
|
|
268
268
|
}, function (update) {
|
|
269
269
|
return update.call(function (selection) {
|
|
270
270
|
return selection
|
|
271
|
-
.transition(_this.services.transitions.getTransition(
|
|
272
|
-
.attr(
|
|
273
|
-
.attr(
|
|
271
|
+
.transition(_this.services.transitions.getTransition('radar_x_axes_update', animate))
|
|
272
|
+
.attr('opacity', 1)
|
|
273
|
+
.attr('x1', function (key) {
|
|
274
274
|
return polarToCartesianCoords(xScale(key), yScale.range()[0], c).x;
|
|
275
275
|
})
|
|
276
|
-
.attr(
|
|
276
|
+
.attr('y1', function (key) {
|
|
277
277
|
return polarToCartesianCoords(xScale(key), yScale.range()[0], c).y;
|
|
278
278
|
})
|
|
279
|
-
.attr(
|
|
279
|
+
.attr('x2', function (key) {
|
|
280
280
|
return polarToCartesianCoords(xScale(key), yScale.range()[1], c).x;
|
|
281
281
|
})
|
|
282
|
-
.attr(
|
|
282
|
+
.attr('y2', function (key) {
|
|
283
283
|
return polarToCartesianCoords(xScale(key), yScale.range()[1], c).y;
|
|
284
284
|
});
|
|
285
285
|
});
|
|
286
286
|
}, function (exit) {
|
|
287
287
|
return exit.call(function (selection) {
|
|
288
288
|
return selection
|
|
289
|
-
.transition(_this.services.transitions.getTransition(
|
|
290
|
-
.attr(
|
|
289
|
+
.transition(_this.services.transitions.getTransition('radar_x_axes_exit', animate))
|
|
290
|
+
.attr('opacity', 0)
|
|
291
291
|
.remove();
|
|
292
292
|
});
|
|
293
293
|
});
|
|
294
294
|
// x labels
|
|
295
|
-
var xLabels = DOMUtils.appendOrSelect(svg,
|
|
296
|
-
var xLabelUpdate = xLabels.selectAll(
|
|
295
|
+
var xLabels = DOMUtils.appendOrSelect(svg, 'g.x-labels').attr('role', Roles.GROUP);
|
|
296
|
+
var xLabelUpdate = xLabels.selectAll('text').data(this.uniqueKeys);
|
|
297
297
|
xLabelUpdate.join(function (enter) {
|
|
298
298
|
return enter
|
|
299
|
-
.append(
|
|
299
|
+
.append('text')
|
|
300
300
|
.text(function (key) { return key; })
|
|
301
|
-
.attr(
|
|
302
|
-
.attr(
|
|
301
|
+
.attr('opacity', 0)
|
|
302
|
+
.attr('x', function (key) {
|
|
303
303
|
return polarToCartesianCoords(xScale(key), yScale.range()[1] + xLabelPadding, c).x;
|
|
304
304
|
})
|
|
305
|
-
.attr(
|
|
305
|
+
.attr('y', function (key) {
|
|
306
306
|
return polarToCartesianCoords(xScale(key), yScale.range()[1] + xLabelPadding, c).y;
|
|
307
307
|
})
|
|
308
|
-
.style(
|
|
309
|
-
.style(
|
|
308
|
+
.style('text-anchor', function (key) { return radialLabelPlacement(xScale(key)).textAnchor; })
|
|
309
|
+
.style('dominant-baseline', function (key) {
|
|
310
310
|
return radialLabelPlacement(xScale(key)).dominantBaseline;
|
|
311
311
|
})
|
|
312
312
|
.call(function (selection) {
|
|
313
313
|
return selection
|
|
314
|
-
.transition(_this.services.transitions.getTransition(
|
|
315
|
-
.attr(
|
|
314
|
+
.transition(_this.services.transitions.getTransition('radar_x_labels_enter', animate))
|
|
315
|
+
.attr('opacity', 1);
|
|
316
316
|
});
|
|
317
317
|
}, function (update) {
|
|
318
318
|
return update.call(function (selection) {
|
|
319
319
|
return selection
|
|
320
|
-
.transition(_this.services.transitions.getTransition(
|
|
321
|
-
.attr(
|
|
322
|
-
.attr(
|
|
320
|
+
.transition(_this.services.transitions.getTransition('radar_x_labels_update', animate))
|
|
321
|
+
.attr('opacity', 1)
|
|
322
|
+
.attr('x', function (key) {
|
|
323
323
|
return polarToCartesianCoords(xScale(key), yScale.range()[1] + xLabelPadding, c).x;
|
|
324
324
|
})
|
|
325
|
-
.attr(
|
|
325
|
+
.attr('y', function (key) {
|
|
326
326
|
return polarToCartesianCoords(xScale(key), yScale.range()[1] + xLabelPadding, c).y;
|
|
327
327
|
});
|
|
328
328
|
});
|
|
329
329
|
}, function (exit) {
|
|
330
330
|
return exit.call(function (selection) {
|
|
331
331
|
return selection
|
|
332
|
-
.transition(_this.services.transitions.getTransition(
|
|
333
|
-
.attr(
|
|
332
|
+
.transition(_this.services.transitions.getTransition('radar_x_labels_exit', animate))
|
|
333
|
+
.attr('opacity', 0)
|
|
334
334
|
.remove();
|
|
335
335
|
});
|
|
336
336
|
});
|
|
337
337
|
// blobs
|
|
338
|
-
var blobs = DOMUtils.appendOrSelect(svg,
|
|
338
|
+
var blobs = DOMUtils.appendOrSelect(svg, 'g.blobs').attr('role', Roles.GROUP);
|
|
339
339
|
var blobUpdate = blobs
|
|
340
|
-
.selectAll(
|
|
340
|
+
.selectAll('path')
|
|
341
341
|
.data(this.groupedDataNormalized, function (group) { return group.name; });
|
|
342
342
|
blobUpdate.join(function (enter) {
|
|
343
343
|
return enter
|
|
344
|
-
.append(
|
|
345
|
-
.attr(
|
|
344
|
+
.append('path')
|
|
345
|
+
.attr('class', function (group) {
|
|
346
346
|
return _this.model.getColorClassName({
|
|
347
347
|
classNameTypes: [
|
|
348
348
|
ColorClassNameTypes.FILL,
|
|
349
|
-
ColorClassNameTypes.STROKE
|
|
349
|
+
ColorClassNameTypes.STROKE,
|
|
350
350
|
],
|
|
351
351
|
dataGroupName: group.name,
|
|
352
|
-
originalClassName:
|
|
352
|
+
originalClassName: 'blob',
|
|
353
353
|
});
|
|
354
354
|
})
|
|
355
|
-
.attr(
|
|
356
|
-
.attr(
|
|
357
|
-
.attr(
|
|
358
|
-
.style(
|
|
359
|
-
.style(
|
|
360
|
-
.style(
|
|
361
|
-
.attr(
|
|
355
|
+
.attr('role', Roles.GRAPHICS_SYMBOL)
|
|
356
|
+
.attr('opacity', 0)
|
|
357
|
+
.attr('transform', "translate(" + c.x + ", " + c.y + ")")
|
|
358
|
+
.style('fill', function (group) { return colorScale(group.name); })
|
|
359
|
+
.style('fill-opacity', Configuration.radar.opacity.selected)
|
|
360
|
+
.style('stroke', function (group) { return colorScale(group.name); })
|
|
361
|
+
.attr('d', function (group) { return oldRadialLineGenerator(group.data); })
|
|
362
362
|
.call(function (selection) {
|
|
363
363
|
return selection
|
|
364
|
-
.transition(_this.services.transitions.getTransition(
|
|
365
|
-
.attr(
|
|
366
|
-
.attr(
|
|
364
|
+
.transition(_this.services.transitions.getTransition('radar_blobs_enter', animate))
|
|
365
|
+
.attr('opacity', 1)
|
|
366
|
+
.attr('d', function (group) {
|
|
367
367
|
return radialLineGenerator(group.data);
|
|
368
368
|
});
|
|
369
369
|
});
|
|
370
370
|
}, function (update) {
|
|
371
371
|
update
|
|
372
|
-
.attr(
|
|
372
|
+
.attr('class', function (group) {
|
|
373
373
|
return _this.model.getColorClassName({
|
|
374
374
|
classNameTypes: [
|
|
375
375
|
ColorClassNameTypes.FILL,
|
|
376
|
-
ColorClassNameTypes.STROKE
|
|
376
|
+
ColorClassNameTypes.STROKE,
|
|
377
377
|
],
|
|
378
378
|
dataGroupName: group.name,
|
|
379
|
-
originalClassName:
|
|
379
|
+
originalClassName: 'blob',
|
|
380
380
|
});
|
|
381
381
|
})
|
|
382
|
-
.style(
|
|
383
|
-
.style(
|
|
382
|
+
.style('fill', function (group) { return colorScale(group.name); })
|
|
383
|
+
.style('stroke', function (group) { return colorScale(group.name); });
|
|
384
384
|
update.call(function (selection) {
|
|
385
385
|
return selection
|
|
386
|
-
.transition(_this.services.transitions.getTransition(
|
|
387
|
-
.attr(
|
|
388
|
-
.attr(
|
|
389
|
-
.attr(
|
|
386
|
+
.transition(_this.services.transitions.getTransition('radar_blobs_update', animate))
|
|
387
|
+
.attr('opacity', 1)
|
|
388
|
+
.attr('transform', "translate(" + c.x + ", " + c.y + ")")
|
|
389
|
+
.attr('d', function (group) { return radialLineGenerator(group.data); });
|
|
390
390
|
});
|
|
391
391
|
}, function (exit) {
|
|
392
392
|
return exit.call(function (selection) {
|
|
393
393
|
return selection
|
|
394
|
-
.transition(_this.services.transitions.getTransition(
|
|
395
|
-
.attr(
|
|
396
|
-
.attr(
|
|
394
|
+
.transition(_this.services.transitions.getTransition('radar_blobs_exit', animate))
|
|
395
|
+
.attr('d', function (group) { return radialLineGenerator(group.data); })
|
|
396
|
+
.attr('opacity', 0)
|
|
397
397
|
.remove();
|
|
398
398
|
});
|
|
399
399
|
});
|
|
400
400
|
// data dots
|
|
401
|
-
var dots = DOMUtils.appendOrSelect(svg,
|
|
401
|
+
var dots = DOMUtils.appendOrSelect(svg, 'g.dots').attr('role', Roles.GROUP);
|
|
402
402
|
var dotsUpdate = dots
|
|
403
|
-
.selectAll(
|
|
403
|
+
.selectAll('circle')
|
|
404
404
|
.data(this.displayDataNormalized);
|
|
405
405
|
dotsUpdate
|
|
406
406
|
.join(function (enter) {
|
|
407
|
-
return enter.append(
|
|
407
|
+
return enter.append('circle').attr('role', Roles.GRAPHICS_SYMBOL);
|
|
408
408
|
}, function (update) { return update; }, function (exit) { return exit.remove(); })
|
|
409
|
-
.attr(
|
|
409
|
+
.attr('class', function (d) {
|
|
410
410
|
return _this.model.getColorClassName({
|
|
411
411
|
classNameTypes: [ColorClassNameTypes.FILL],
|
|
412
412
|
dataGroupName: d[groupMapsTo],
|
|
413
|
-
originalClassName: Tools.kebabCase(d[angle])
|
|
413
|
+
originalClassName: Tools.kebabCase(d[angle]),
|
|
414
414
|
});
|
|
415
415
|
})
|
|
416
|
-
.attr(
|
|
416
|
+
.attr('cx', function (d) {
|
|
417
417
|
return polarToCartesianCoords(xScale(d[angle]), yScale(d[value]), c).x;
|
|
418
418
|
})
|
|
419
|
-
.attr(
|
|
419
|
+
.attr('cy', function (d) {
|
|
420
420
|
return polarToCartesianCoords(xScale(d[angle]), yScale(d[value]), c).y;
|
|
421
421
|
})
|
|
422
|
-
.attr(
|
|
423
|
-
.attr(
|
|
424
|
-
.style(
|
|
422
|
+
.attr('r', 0)
|
|
423
|
+
.attr('opacity', 0)
|
|
424
|
+
.style('fill', function (d) { return colorScale(d[groupMapsTo]); });
|
|
425
425
|
// rectangles
|
|
426
|
-
var xAxesRect = DOMUtils.appendOrSelect(svg,
|
|
426
|
+
var xAxesRect = DOMUtils.appendOrSelect(svg, 'g.x-axes-rect').attr('role', Roles.GROUP);
|
|
427
427
|
var xAxisRectUpdate = xAxesRect
|
|
428
|
-
.selectAll(
|
|
428
|
+
.selectAll('rect')
|
|
429
429
|
.data(this.uniqueKeys);
|
|
430
430
|
xAxisRectUpdate
|
|
431
431
|
.join(function (enter) {
|
|
432
|
-
return enter.append(
|
|
432
|
+
return enter.append('rect').attr('role', Roles.GRAPHICS_SYMBOL);
|
|
433
433
|
}, function (update) { return update; }, function (exit) { return exit.remove(); })
|
|
434
|
-
.attr(
|
|
435
|
-
.attr(
|
|
436
|
-
.attr(
|
|
437
|
-
.attr(
|
|
438
|
-
.style(
|
|
439
|
-
.style(
|
|
440
|
-
.attr(
|
|
434
|
+
.attr('x', c.x)
|
|
435
|
+
.attr('y', c.y - xAxisRectHeight / 2)
|
|
436
|
+
.attr('width', yScale.range()[1])
|
|
437
|
+
.attr('height', xAxisRectHeight)
|
|
438
|
+
.style('fill', 'red')
|
|
439
|
+
.style('fill-opacity', 0)
|
|
440
|
+
.attr('transform', function (key) { return "rotate(" + radToDeg(xScale(key)) + ", " + c.x + ", " + c.y + ")"; });
|
|
441
441
|
// y labels (show only the min and the max labels)
|
|
442
|
-
var yLabels = DOMUtils.appendOrSelect(svg,
|
|
443
|
-
var yLabelUpdate = yLabels.selectAll(
|
|
442
|
+
var yLabels = DOMUtils.appendOrSelect(svg, 'g.y-labels').attr('role', Roles.GROUP);
|
|
443
|
+
var yLabelUpdate = yLabels.selectAll('text').data(extent(yTicks));
|
|
444
444
|
yLabelUpdate.join(function (enter) {
|
|
445
445
|
return enter
|
|
446
|
-
.append(
|
|
447
|
-
.attr(
|
|
446
|
+
.append('text')
|
|
447
|
+
.attr('opacity', 0)
|
|
448
448
|
.text(function (tick) { return tick; })
|
|
449
|
-
.attr(
|
|
449
|
+
.attr('x', function (tick) {
|
|
450
450
|
return polarToCartesianCoords(-Math.PI / 2, yScale(tick), c).x + yLabelPadding;
|
|
451
451
|
})
|
|
452
|
-
.attr(
|
|
452
|
+
.attr('y', function (tick) {
|
|
453
453
|
return polarToCartesianCoords(-Math.PI / 2, yScale(tick), c).y;
|
|
454
454
|
})
|
|
455
|
-
.style(
|
|
456
|
-
.style(
|
|
455
|
+
.style('text-anchor', 'start')
|
|
456
|
+
.style('dominant-baseline', 'middle')
|
|
457
457
|
.call(function (selection) {
|
|
458
458
|
return selection
|
|
459
|
-
.transition(_this.services.transitions.getTransition(
|
|
460
|
-
.attr(
|
|
459
|
+
.transition(_this.services.transitions.getTransition('radar_y_labels_enter', animate))
|
|
460
|
+
.attr('opacity', 1);
|
|
461
461
|
});
|
|
462
462
|
}, function (update) {
|
|
463
463
|
return update.call(function (selection) {
|
|
464
464
|
return selection
|
|
465
|
-
.transition(_this.services.transitions.getTransition(
|
|
465
|
+
.transition(_this.services.transitions.getTransition('radar_y_labels_update', animate))
|
|
466
466
|
.text(function (tick) { return tick; })
|
|
467
|
-
.attr(
|
|
468
|
-
.attr(
|
|
467
|
+
.attr('opacity', 1)
|
|
468
|
+
.attr('x', function (tick) {
|
|
469
469
|
return polarToCartesianCoords(-Math.PI / 2, yScale(tick), c).x + yLabelPadding;
|
|
470
470
|
})
|
|
471
|
-
.attr(
|
|
471
|
+
.attr('y', function (tick) {
|
|
472
472
|
return polarToCartesianCoords(-Math.PI / 2, yScale(tick), c).y;
|
|
473
473
|
});
|
|
474
474
|
});
|
|
475
475
|
}, function (exit) {
|
|
476
476
|
return exit.call(function (selection) {
|
|
477
477
|
return selection
|
|
478
|
-
.transition(_this.services.transitions.getTransition(
|
|
479
|
-
.attr(
|
|
478
|
+
.transition(_this.services.transitions.getTransition('radar_y_labels_exit', animate))
|
|
479
|
+
.attr('opacity', 0)
|
|
480
480
|
.remove();
|
|
481
481
|
});
|
|
482
482
|
});
|
|
483
|
-
var alignment = Tools.getProperty(options,
|
|
483
|
+
var alignment = Tools.getProperty(options, 'radar', 'alignment');
|
|
484
484
|
var alignmentOffset = DOMUtils.getAlignmentOffset(alignment, svg, this.getParent());
|
|
485
|
-
svg.attr(
|
|
485
|
+
svg.attr('transform', "translate(" + alignmentOffset + ", 0)");
|
|
486
486
|
// Add event listeners
|
|
487
487
|
this.addEventListeners();
|
|
488
488
|
oldYScale = yScale; // save the current scale as the old one
|
|
@@ -490,10 +490,10 @@ var Radar = /** @class */ (function (_super) {
|
|
|
490
490
|
Radar.prototype.destroy = function () {
|
|
491
491
|
// Remove event listeners
|
|
492
492
|
this.parent
|
|
493
|
-
.selectAll(
|
|
494
|
-
.on(
|
|
495
|
-
.on(
|
|
496
|
-
.on(
|
|
493
|
+
.selectAll('.x-axes-rect > rect')
|
|
494
|
+
.on('mouseover', null)
|
|
495
|
+
.on('mousemove', null)
|
|
496
|
+
.on('mouseout', null);
|
|
497
497
|
// Remove legend listeners
|
|
498
498
|
var eventsFragment = this.services.events;
|
|
499
499
|
eventsFragment.removeEventListener(Events.Legend.ITEM_HOVER, this.handleLegendOnHover);
|
|
@@ -501,76 +501,76 @@ var Radar = /** @class */ (function (_super) {
|
|
|
501
501
|
};
|
|
502
502
|
Radar.prototype.addEventListeners = function () {
|
|
503
503
|
var self = this;
|
|
504
|
-
var angle = Tools.getProperty(this.getOptions(),
|
|
504
|
+
var angle = Tools.getProperty(this.getOptions(), 'radar').axes.angle;
|
|
505
505
|
// events on x axes rects
|
|
506
506
|
this.parent
|
|
507
|
-
.selectAll(
|
|
508
|
-
.on(
|
|
507
|
+
.selectAll('.x-axes-rect > rect')
|
|
508
|
+
.on('mouseover', function (datum) {
|
|
509
509
|
var hoveredElement = select(this);
|
|
510
510
|
// Dispatch mouse event
|
|
511
511
|
self.services.events.dispatchEvent(Events.Radar.X_AXIS_MOUSEOVER, {
|
|
512
512
|
element: hoveredElement,
|
|
513
|
-
datum: datum
|
|
513
|
+
datum: datum,
|
|
514
514
|
});
|
|
515
515
|
var axisLine = self.parent.select(".x-axes .x-axis-" + Tools.kebabCase(datum));
|
|
516
516
|
var dots = self.parent.selectAll(".dots circle." + Tools.kebabCase(datum));
|
|
517
517
|
// Change style
|
|
518
518
|
axisLine
|
|
519
|
-
.classed(
|
|
520
|
-
.attr(
|
|
521
|
-
dots.classed(
|
|
522
|
-
.attr(
|
|
523
|
-
.attr(
|
|
519
|
+
.classed('hovered', true)
|
|
520
|
+
.attr('stroke-dasharray', '4 4');
|
|
521
|
+
dots.classed('hovered', true)
|
|
522
|
+
.attr('opacity', 1)
|
|
523
|
+
.attr('r', Configuration.radar.dotsRadius);
|
|
524
524
|
// get the items that should be highlighted
|
|
525
525
|
var itemsToHighlight = self.displayDataNormalized.filter(function (d) { return d[angle] === datum; });
|
|
526
526
|
var options = self.getOptions();
|
|
527
527
|
var groupMapsTo = options.data.groupMapsTo;
|
|
528
|
-
var valueMapsTo = Tools.getProperty(options,
|
|
528
|
+
var valueMapsTo = Tools.getProperty(options, 'radar', 'axes', 'value');
|
|
529
529
|
// Show tooltip
|
|
530
530
|
self.services.events.dispatchEvent(Events.Tooltip.SHOW, {
|
|
531
531
|
hoveredElement: hoveredElement,
|
|
532
532
|
items: itemsToHighlight
|
|
533
|
-
.filter(function (datum) { return typeof datum[valueMapsTo] ===
|
|
533
|
+
.filter(function (datum) { return typeof datum[valueMapsTo] === 'number'; })
|
|
534
534
|
.map(function (datum) { return ({
|
|
535
535
|
label: datum[groupMapsTo],
|
|
536
536
|
value: datum[valueMapsTo],
|
|
537
537
|
color: self.model.getFillColor(datum[groupMapsTo]),
|
|
538
538
|
class: self.model.getColorClassName({
|
|
539
539
|
classNameTypes: [ColorClassNameTypes.TOOLTIP],
|
|
540
|
-
dataGroupName: datum[groupMapsTo]
|
|
541
|
-
})
|
|
542
|
-
}); })
|
|
540
|
+
dataGroupName: datum[groupMapsTo],
|
|
541
|
+
}),
|
|
542
|
+
}); }),
|
|
543
543
|
});
|
|
544
544
|
})
|
|
545
|
-
.on(
|
|
545
|
+
.on('mousemove', function (datum) {
|
|
546
546
|
var hoveredElement = select(this);
|
|
547
547
|
// Dispatch mouse event
|
|
548
548
|
self.services.events.dispatchEvent(Events.Radar.X_AXIS_MOUSEMOVE, {
|
|
549
549
|
element: hoveredElement,
|
|
550
|
-
datum: datum
|
|
550
|
+
datum: datum,
|
|
551
551
|
});
|
|
552
552
|
self.services.events.dispatchEvent(Events.Tooltip.MOVE);
|
|
553
553
|
})
|
|
554
|
-
.on(
|
|
554
|
+
.on('click', function (datum) {
|
|
555
555
|
// Dispatch mouse event
|
|
556
556
|
self.services.events.dispatchEvent(Events.Radar.X_AXIS_CLICK, {
|
|
557
557
|
element: select(this),
|
|
558
|
-
datum: datum
|
|
558
|
+
datum: datum,
|
|
559
559
|
});
|
|
560
560
|
})
|
|
561
|
-
.on(
|
|
561
|
+
.on('mouseout', function (datum) {
|
|
562
562
|
var hoveredElement = select(this);
|
|
563
563
|
var axisLine = self.parent.select(".x-axes .x-axis-" + Tools.kebabCase(datum));
|
|
564
564
|
var dots = self.parent.selectAll(".dots circle." + Tools.kebabCase(datum));
|
|
565
565
|
// Change style
|
|
566
566
|
axisLine
|
|
567
|
-
.classed(
|
|
568
|
-
.attr(
|
|
569
|
-
dots.classed(
|
|
567
|
+
.classed('hovered', false)
|
|
568
|
+
.attr('stroke-dasharray', '0');
|
|
569
|
+
dots.classed('hovered', false).attr('opacity', 0).attr('r', 0);
|
|
570
570
|
// Dispatch mouse event
|
|
571
571
|
self.services.events.dispatchEvent(Events.Radar.X_AXIS_MOUSEOUT, {
|
|
572
572
|
element: hoveredElement,
|
|
573
|
-
datum: datum
|
|
573
|
+
datum: datum,
|
|
574
574
|
});
|
|
575
575
|
// Hide tooltip
|
|
576
576
|
self.services.events.dispatchEvent(Events.Tooltip.HIDE);
|