@progress/kendo-charts 2.5.4-dev.202410140828 → 2.6.0-dev.202410171740
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/dist/cdn/js/kendo-charts.js +1 -1
- package/dist/cdn/main.js +1 -1
- package/dist/es/chart/area-chart/area-segment.js +3 -2
- package/dist/es/chart/bar-chart/bar.js +3 -3
- package/dist/es/chart/bubble-chart/bubble.js +3 -2
- package/dist/es/chart/bullet-chart/bullet.js +3 -2
- package/dist/es/chart/candlestick-chart/candlestick.js +3 -2
- package/dist/es/chart/chart.js +39 -0
- package/dist/es/chart/constants.js +2 -0
- package/dist/es/chart/donut-chart/donut-chart.js +2 -0
- package/dist/es/chart/funnel-chart/funnel-chart.js +2 -0
- package/dist/es/chart/funnel-chart/funnel-segment.js +3 -2
- package/dist/es/chart/heatmap-chart/heatmap-chart.js +1 -0
- package/dist/es/chart/heatmap-chart/heatmap-point.js +1 -0
- package/dist/es/chart/legend/legend-item.js +21 -1
- package/dist/es/chart/line-chart/line-point.js +1 -0
- package/dist/es/chart/mixins/pie-chart-mixin.js +1 -0
- package/dist/es/chart/pie-chart/pie-chart.js +2 -0
- package/dist/es/chart/pie-chart/pie-segment.js +3 -3
- package/dist/es/chart/register-charts.js +13 -13
- package/dist/es/core/box-element.js +3 -2
- package/dist/es/core/pattern.js +27 -0
- package/dist/es/core.js +1 -0
- package/dist/es2015/chart/area-chart/area-segment.js +3 -2
- package/dist/es2015/chart/bar-chart/bar.js +3 -3
- package/dist/es2015/chart/bubble-chart/bubble.js +3 -2
- package/dist/es2015/chart/bullet-chart/bullet.js +3 -2
- package/dist/es2015/chart/candlestick-chart/candlestick.js +3 -2
- package/dist/es2015/chart/chart.js +39 -0
- package/dist/es2015/chart/constants.js +2 -0
- package/dist/es2015/chart/donut-chart/donut-chart.js +2 -0
- package/dist/es2015/chart/funnel-chart/funnel-chart.js +2 -0
- package/dist/es2015/chart/funnel-chart/funnel-segment.js +3 -2
- package/dist/es2015/chart/heatmap-chart/heatmap-chart.js +1 -0
- package/dist/es2015/chart/heatmap-chart/heatmap-point.js +1 -0
- package/dist/es2015/chart/legend/legend-item.js +19 -1
- package/dist/es2015/chart/line-chart/line-point.js +1 -0
- package/dist/es2015/chart/mixins/pie-chart-mixin.js +1 -0
- package/dist/es2015/chart/pie-chart/pie-chart.js +2 -0
- package/dist/es2015/chart/pie-chart/pie-segment.js +3 -3
- package/dist/es2015/chart/register-charts.js +13 -13
- package/dist/es2015/core/box-element.js +3 -2
- package/dist/es2015/core/pattern.js +23 -0
- package/dist/es2015/core.js +1 -0
- package/dist/npm/main.js +126 -30
- package/dist/systemjs/kendo-charts.js +1 -1
- package/package.json +3 -3
|
@@ -330,6 +330,7 @@ class Chart extends Class {
|
|
|
330
330
|
this._createPannable();
|
|
331
331
|
this._createZoomSelection();
|
|
332
332
|
this._createMousewheelZoom();
|
|
333
|
+
this._setComputedStyles();
|
|
333
334
|
|
|
334
335
|
this.trigger(RENDER);
|
|
335
336
|
triggerPaneRender(this._plotArea.panes);
|
|
@@ -341,7 +342,16 @@ class Chart extends Class {
|
|
|
341
342
|
this._redrawFocusHighlight();
|
|
342
343
|
}
|
|
343
344
|
|
|
345
|
+
_setComputedStyles() {
|
|
346
|
+
const titleHeight = this.titleHeight();
|
|
347
|
+
this.element.style.setProperty('--kendo-chart-computed-title-height', `${titleHeight}px`);
|
|
348
|
+
}
|
|
349
|
+
|
|
344
350
|
_redrawFocusHighlight() {
|
|
351
|
+
if (this._destroyed) {
|
|
352
|
+
return;
|
|
353
|
+
}
|
|
354
|
+
|
|
345
355
|
const { _focusState: { legendInFocus, preserveHighlight } } = this;
|
|
346
356
|
|
|
347
357
|
if (legendInFocus && preserveHighlight) {
|
|
@@ -528,9 +538,30 @@ class Chart extends Class {
|
|
|
528
538
|
model.append(plotArea);
|
|
529
539
|
model.reflow();
|
|
530
540
|
|
|
541
|
+
this._setTitleBox(title, subtitle);
|
|
542
|
+
|
|
531
543
|
return model;
|
|
532
544
|
}
|
|
533
545
|
|
|
546
|
+
_setTitleBox(title, subtitle) {
|
|
547
|
+
if (!title && !subtitle) {
|
|
548
|
+
return;
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
this._titleBox = (title || subtitle).box.clone();
|
|
552
|
+
|
|
553
|
+
const titlePosition = title ? title.options.position : '';
|
|
554
|
+
const subtitlePosition = subtitle ? subtitle.options.position : '';
|
|
555
|
+
const samePosition = titlePosition === subtitlePosition;
|
|
556
|
+
const subtitleAtTop = subtitlePosition !== 'bottom';
|
|
557
|
+
|
|
558
|
+
if (samePosition && subtitle) {
|
|
559
|
+
this._titleBox.wrap(subtitle.box);
|
|
560
|
+
} else if (title && subtitle && subtitleAtTop) {
|
|
561
|
+
this._titleBox = subtitle.box.clone();
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
|
|
534
565
|
_modelOptions() {
|
|
535
566
|
const options = this.options;
|
|
536
567
|
const size = this.getSize();
|
|
@@ -647,6 +678,14 @@ class Chart extends Class {
|
|
|
647
678
|
return isDefaultPrevented;
|
|
648
679
|
}
|
|
649
680
|
|
|
681
|
+
titleHeight() {
|
|
682
|
+
if (!this._titleBox) {
|
|
683
|
+
return 0;
|
|
684
|
+
}
|
|
685
|
+
|
|
686
|
+
return this._titleBox.height();
|
|
687
|
+
}
|
|
688
|
+
|
|
650
689
|
_attachEvents() {
|
|
651
690
|
const element = this.element;
|
|
652
691
|
|
|
@@ -122,6 +122,7 @@ const MOUSEWHEEL_ZOOM_RATE = 0.3;
|
|
|
122
122
|
|
|
123
123
|
const DRILLDOWN = "drilldown";
|
|
124
124
|
const DRILLDOWN_FIELD = "drilldown";
|
|
125
|
+
const PATTERN_FIELD = "pattern";
|
|
125
126
|
|
|
126
127
|
const MIN_MOVING_AVERAGE_PERIOD = 2;
|
|
127
128
|
|
|
@@ -158,6 +159,7 @@ export {
|
|
|
158
159
|
TRENDLINE_MOVING_AVERAGE,
|
|
159
160
|
TRENDLINE_POLYNOMIAL,
|
|
160
161
|
TRENDLINE_POWER,
|
|
162
|
+
PATTERN_FIELD,
|
|
161
163
|
CHART_POINT_ROLE, CHART_POINT_CLASSNAME, CHART_POINT_ROLE_DESCRIPTION,
|
|
162
164
|
LEGEND_ITEM_ROLE, LEGEND_ITEM_CLASSNAME,
|
|
163
165
|
LEGEND_ITEM_ARIA_ROLE_DESCRIPTION
|
|
@@ -10,6 +10,8 @@ const DONUT_SECTOR_ANIM_DELAY = 50;
|
|
|
10
10
|
class DonutChart extends PieChart {
|
|
11
11
|
addValue(value, sector, fields) {
|
|
12
12
|
const segmentOptions = deepExtend({}, fields.series, { index: fields.index });
|
|
13
|
+
segmentOptions.pattern = fields.pattern || segmentOptions.pattern;
|
|
14
|
+
|
|
13
15
|
this.evalSegmentOptions(segmentOptions, value, fields);
|
|
14
16
|
|
|
15
17
|
this.createLegendItem(value, segmentOptions, fields);
|
|
@@ -85,6 +85,8 @@ class FunnelChart extends ChartElement {
|
|
|
85
85
|
|
|
86
86
|
createSegment(value, fields) {
|
|
87
87
|
const seriesOptions = deepExtend({}, fields.series);
|
|
88
|
+
seriesOptions.pattern = fields.pattern || seriesOptions.pattern;
|
|
89
|
+
|
|
88
90
|
this.evalSegmentOptions(seriesOptions, value, fields);
|
|
89
91
|
|
|
90
92
|
this.createLegendItem(value, seriesOptions, fields);
|
|
@@ -7,6 +7,7 @@ import { WHITE } from '../../common/constants';
|
|
|
7
7
|
import { deepExtend, setDefaultOptions, getTemplate } from '../../common';
|
|
8
8
|
import AccessibilityAttributesMixin from '../mixins/accessibility-attributes-mixin';
|
|
9
9
|
import { CHART_POINT_CLASSNAME, CHART_POINT_ROLE, CHART_POINT_ROLE_DESCRIPTION } from '../constants';
|
|
10
|
+
import { createPatternFill } from '../../core/pattern';
|
|
10
11
|
|
|
11
12
|
class FunnelSegment extends ChartElement {
|
|
12
13
|
constructor(value, options, segmentOptions) {
|
|
@@ -74,10 +75,10 @@ class FunnelSegment extends ChartElement {
|
|
|
74
75
|
const options = this.options;
|
|
75
76
|
const border = options.border;
|
|
76
77
|
const path = draw.Path.fromPoints(this.points, {
|
|
77
|
-
fill: {
|
|
78
|
+
fill: createPatternFill(options.pattern, {
|
|
78
79
|
color: options.color,
|
|
79
80
|
opacity: options.opacity
|
|
80
|
-
},
|
|
81
|
+
}),
|
|
81
82
|
stroke: {
|
|
82
83
|
color: border.color,
|
|
83
84
|
opacity: border.opacity,
|
|
@@ -116,6 +116,7 @@ class HeatmapChart extends ChartElement {
|
|
|
116
116
|
let pointOptions = this.pointOptions(series, fields.seriesIx);
|
|
117
117
|
let color = fields.color || series.color;
|
|
118
118
|
|
|
119
|
+
pointOptions.pattern = fields.pattern || pointOptions.pattern;
|
|
119
120
|
pointOptions = this.evalPointOptions(pointOptions, value, fields);
|
|
120
121
|
|
|
121
122
|
if (isFunction(series.color)) {
|
|
@@ -148,6 +148,7 @@ class HeatmapPoint extends ChartElement {
|
|
|
148
148
|
rotation: markerOptions.rotation,
|
|
149
149
|
background: this.color,
|
|
150
150
|
border: this.markerBorder(),
|
|
151
|
+
pattern: options.pattern,
|
|
151
152
|
borderRadius: markerOptions.borderRadius,
|
|
152
153
|
opacity: this.series.opacity || options.opacity,
|
|
153
154
|
zIndex: valueOrDefault(options.zIndex, this.series.zIndex),
|
|
@@ -108,14 +108,32 @@ class LegendItem extends BoxElement {
|
|
|
108
108
|
return this._markerLineArea;
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
+
_reduceSize(object, prop, factor = 0.6) {
|
|
112
|
+
if (typeof object[prop] === 'number') {
|
|
113
|
+
object[prop] = object[prop] * factor;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
111
117
|
_createSquare() {
|
|
112
118
|
const options = this.options;
|
|
113
119
|
if (options.type === AREA) {
|
|
120
|
+
let pattern = options.pattern || (options.series || {}).pattern;
|
|
121
|
+
if (pattern) {
|
|
122
|
+
if (typeof pattern === 'function') {
|
|
123
|
+
pattern = pattern(options.series);
|
|
124
|
+
}
|
|
125
|
+
pattern = structuredClone(pattern);
|
|
126
|
+
this._reduceSize(pattern, 'gap');
|
|
127
|
+
this._reduceSize(pattern, 'width');
|
|
128
|
+
this._reduceSize(pattern, 'radius');
|
|
129
|
+
}
|
|
130
|
+
|
|
114
131
|
this._square = new LegendItemSquare(Object.assign({}, {border: options.border,
|
|
115
132
|
vAlign: options.markers.visible ? BOTTOM : CENTER,
|
|
116
133
|
highlight: this._highlightOptions()},
|
|
117
134
|
options.area,
|
|
118
|
-
{
|
|
135
|
+
{pattern: pattern,
|
|
136
|
+
background: options.area.background || options.markerColor}));
|
|
119
137
|
this.markerWrap.append(this._square);
|
|
120
138
|
}
|
|
121
139
|
return this._square;
|
|
@@ -115,6 +115,7 @@ class LinePoint extends ChartElement {
|
|
|
115
115
|
background: options.background,
|
|
116
116
|
border: this.markerBorder(),
|
|
117
117
|
opacity: options.opacity,
|
|
118
|
+
pattern: this.options.pattern,
|
|
118
119
|
zIndex: valueOrDefault(options.zIndex, this.series.zIndex),
|
|
119
120
|
animation: options.animation,
|
|
120
121
|
visual: options.visual,
|
|
@@ -73,6 +73,7 @@ class PieChart extends ChartElement {
|
|
|
73
73
|
callback(value, new Ring(null, 0, 0, currentAngle, angle), {
|
|
74
74
|
owner: this,
|
|
75
75
|
category: defined(fields.category) ? fields.category : "",
|
|
76
|
+
pattern: defined(fields.pattern) ? fields.pattern : currentSeries.pattern,
|
|
76
77
|
index: i,
|
|
77
78
|
series: currentSeries,
|
|
78
79
|
seriesIx: seriesIx,
|
|
@@ -109,6 +110,7 @@ class PieChart extends ChartElement {
|
|
|
109
110
|
|
|
110
111
|
addValue(value, sector, fields) {
|
|
111
112
|
const segmentOptions = deepExtend({}, fields.series, { index: fields.index });
|
|
113
|
+
segmentOptions.pattern = fields.pattern || segmentOptions.pattern;
|
|
112
114
|
this.evalSegmentOptions(segmentOptions, value, fields);
|
|
113
115
|
|
|
114
116
|
this.createLegendItem(value, segmentOptions, fields);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { drawing as draw, geometry as geom } from '@progress/kendo-drawing';
|
|
2
2
|
|
|
3
|
-
import { ChartElement, ShapeBuilder, TextBox, Box } from '../../core';
|
|
3
|
+
import { ChartElement, ShapeBuilder, TextBox, Box, createPatternFill } from '../../core';
|
|
4
4
|
|
|
5
5
|
import PointEventsMixin from '../mixins/point-events-mixin';
|
|
6
6
|
|
|
@@ -163,10 +163,10 @@ class PieSegment extends ChartElement {
|
|
|
163
163
|
}
|
|
164
164
|
} : {};
|
|
165
165
|
const color = options.color;
|
|
166
|
-
const fill = {
|
|
166
|
+
const fill = createPatternFill(options.pattern, {
|
|
167
167
|
color: color,
|
|
168
168
|
opacity: options.opacity
|
|
169
|
-
};
|
|
169
|
+
});
|
|
170
170
|
const visual = this.createSegment(sector, deepExtend({
|
|
171
171
|
fill: fill,
|
|
172
172
|
stroke: {
|
|
@@ -15,7 +15,7 @@ import { COLUMN, DONUT, PIE, FUNNEL, PYRAMID, BAR, LINE, VERTICAL_LINE, AREA, VE
|
|
|
15
15
|
RANGE_BAR, WATERFALL, HORIZONTAL_WATERFALL, SCATTER, SCATTER_LINE, BUBBLE,
|
|
16
16
|
POLAR_AREA, POLAR_LINE, POLAR_SCATTER, RADAR_AREA, RADAR_COLUMN, RADAR_LINE, CATEGORY,
|
|
17
17
|
RANGE_AREA, VERTICAL_RANGE_AREA, X_ERROR_LOW_FIELD, X_ERROR_HIGH_FIELD, Y_ERROR_LOW_FIELD, Y_ERROR_HIGH_FIELD,
|
|
18
|
-
ERROR_LOW_FIELD, ERROR_HIGH_FIELD, HEATMAP, DRILLDOWN_FIELD, TRENDLINE_SERIES } from './constants';
|
|
18
|
+
ERROR_LOW_FIELD, ERROR_HIGH_FIELD, HEATMAP, DRILLDOWN_FIELD, TRENDLINE_SERIES, PATTERN_FIELD } from './constants';
|
|
19
19
|
import { X, Y, VALUE } from '../common/constants';
|
|
20
20
|
|
|
21
21
|
const COLOR = "color";
|
|
@@ -57,25 +57,25 @@ PlotAreaFactory.current.register(HeatmapPlotArea, [ HEATMAP ]);
|
|
|
57
57
|
|
|
58
58
|
SeriesBinder.current.register(
|
|
59
59
|
[ BAR, COLUMN, LINE, VERTICAL_LINE, AREA, VERTICAL_AREA ],
|
|
60
|
-
[ VALUE ], [ CATEGORY, COLOR, NOTE_TEXT, ERROR_LOW_FIELD, ERROR_HIGH_FIELD, DRILLDOWN_FIELD ]
|
|
60
|
+
[ VALUE ], [ CATEGORY, COLOR, NOTE_TEXT, ERROR_LOW_FIELD, ERROR_HIGH_FIELD, DRILLDOWN_FIELD, PATTERN_FIELD ]
|
|
61
61
|
);
|
|
62
62
|
|
|
63
63
|
SeriesBinder.current.register(
|
|
64
64
|
[ RANGE_COLUMN, RANGE_BAR, RANGE_AREA, VERTICAL_RANGE_AREA ],
|
|
65
|
-
[ FROM, TO ], [ CATEGORY, COLOR, NOTE_TEXT, DRILLDOWN_FIELD ]
|
|
65
|
+
[ FROM, TO ], [ CATEGORY, COLOR, NOTE_TEXT, DRILLDOWN_FIELD, PATTERN_FIELD ]
|
|
66
66
|
);
|
|
67
67
|
|
|
68
68
|
SeriesBinder.current.register(
|
|
69
69
|
[ WATERFALL, HORIZONTAL_WATERFALL ],
|
|
70
|
-
[ VALUE ], [ CATEGORY, COLOR, NOTE_TEXT, SUMMARY_FIELD, DRILLDOWN_FIELD ]
|
|
70
|
+
[ VALUE ], [ CATEGORY, COLOR, NOTE_TEXT, SUMMARY_FIELD, DRILLDOWN_FIELD, PATTERN_FIELD ]
|
|
71
71
|
);
|
|
72
72
|
|
|
73
|
-
SeriesBinder.current.register([ POLAR_AREA, POLAR_LINE, POLAR_SCATTER ], [ X, Y ], [ COLOR, DRILLDOWN_FIELD ]);
|
|
74
|
-
SeriesBinder.current.register([ RADAR_AREA, RADAR_COLUMN, RADAR_LINE ], [ VALUE ], [ CATEGORY, COLOR, DRILLDOWN_FIELD ]);
|
|
73
|
+
SeriesBinder.current.register([ POLAR_AREA, POLAR_LINE, POLAR_SCATTER ], [ X, Y ], [ COLOR, DRILLDOWN_FIELD, PATTERN_FIELD ]);
|
|
74
|
+
SeriesBinder.current.register([ RADAR_AREA, RADAR_COLUMN, RADAR_LINE ], [ VALUE ], [ CATEGORY, COLOR, DRILLDOWN_FIELD, PATTERN_FIELD ]);
|
|
75
75
|
|
|
76
76
|
SeriesBinder.current.register(
|
|
77
77
|
[ FUNNEL, PYRAMID ],
|
|
78
|
-
[ VALUE ], [ CATEGORY, COLOR, "visibleInLegend", "visible", DRILLDOWN_FIELD ]
|
|
78
|
+
[ VALUE ], [ CATEGORY, COLOR, "visibleInLegend", "visible", DRILLDOWN_FIELD, PATTERN_FIELD ]
|
|
79
79
|
);
|
|
80
80
|
|
|
81
81
|
DefaultAggregates.current.register(
|
|
@@ -99,17 +99,17 @@ SeriesBinder.current.register(
|
|
|
99
99
|
);
|
|
100
100
|
|
|
101
101
|
SeriesBinder.current.register(
|
|
102
|
-
[ BUBBLE ], [ X, Y, "size" ], [ COLOR, CATEGORY, NOTE_TEXT ]
|
|
102
|
+
[ BUBBLE ], [ X, Y, "size" ], [ COLOR, CATEGORY, NOTE_TEXT, PATTERN_FIELD ]
|
|
103
103
|
);
|
|
104
104
|
|
|
105
105
|
SeriesBinder.current.register(
|
|
106
106
|
[ HEATMAP ],
|
|
107
|
-
[ X, Y, VALUE ], [ COLOR, NOTE_TEXT ]
|
|
107
|
+
[ X, Y, VALUE ], [ COLOR, NOTE_TEXT, PATTERN_FIELD ]
|
|
108
108
|
);
|
|
109
109
|
|
|
110
110
|
SeriesBinder.current.register(
|
|
111
111
|
[ CANDLESTICK, OHLC ],
|
|
112
|
-
[ "open", "high", "low", "close" ], [ CATEGORY, COLOR, "downColor", NOTE_TEXT ]
|
|
112
|
+
[ "open", "high", "low", "close" ], [ CATEGORY, COLOR, "downColor", NOTE_TEXT, PATTERN_FIELD ]
|
|
113
113
|
);
|
|
114
114
|
|
|
115
115
|
DefaultAggregates.current.register(
|
|
@@ -120,7 +120,7 @@ DefaultAggregates.current.register(
|
|
|
120
120
|
|
|
121
121
|
SeriesBinder.current.register(
|
|
122
122
|
[ BOX_PLOT, VERTICAL_BOX_PLOT ],
|
|
123
|
-
[ "lower", "q1", "median", "q3", "upper", "mean", "outliers" ], [ CATEGORY, COLOR, NOTE_TEXT, DRILLDOWN_FIELD ]
|
|
123
|
+
[ "lower", "q1", "median", "q3", "upper", "mean", "outliers" ], [ CATEGORY, COLOR, NOTE_TEXT, DRILLDOWN_FIELD, PATTERN_FIELD ]
|
|
124
124
|
);
|
|
125
125
|
|
|
126
126
|
DefaultAggregates.current.register(
|
|
@@ -131,7 +131,7 @@ DefaultAggregates.current.register(
|
|
|
131
131
|
|
|
132
132
|
SeriesBinder.current.register(
|
|
133
133
|
[ BULLET, VERTICAL_BULLET ],
|
|
134
|
-
[ "current", "target" ], [ CATEGORY, COLOR, "visibleInLegend", NOTE_TEXT, DRILLDOWN_FIELD ]
|
|
134
|
+
[ "current", "target" ], [ CATEGORY, COLOR, "visibleInLegend", NOTE_TEXT, DRILLDOWN_FIELD, PATTERN_FIELD ]
|
|
135
135
|
);
|
|
136
136
|
|
|
137
137
|
DefaultAggregates.current.register(
|
|
@@ -141,5 +141,5 @@ DefaultAggregates.current.register(
|
|
|
141
141
|
|
|
142
142
|
SeriesBinder.current.register(
|
|
143
143
|
[ PIE, DONUT ],
|
|
144
|
-
[ VALUE ], [ CATEGORY, COLOR, "explode", "visibleInLegend", "visible", DRILLDOWN_FIELD ]
|
|
144
|
+
[ VALUE ], [ CATEGORY, COLOR, "explode", "visibleInLegend", "visible", DRILLDOWN_FIELD, PATTERN_FIELD ]
|
|
145
145
|
);
|
|
@@ -5,6 +5,7 @@ import Box from './box';
|
|
|
5
5
|
|
|
6
6
|
import { BLACK, LEFT, TOP, X, Y } from '../common/constants';
|
|
7
7
|
import { getSpacing, setDefaultOptions, valueOrDefault } from '../common';
|
|
8
|
+
import { createPatternFill } from './pattern';
|
|
8
9
|
|
|
9
10
|
class BoxElement extends ChartElement {
|
|
10
11
|
constructor(options) {
|
|
@@ -100,10 +101,10 @@ class BoxElement extends ChartElement {
|
|
|
100
101
|
opacity: valueOrDefault(border.opacity, options.opacity),
|
|
101
102
|
dashType: border.dashType
|
|
102
103
|
},
|
|
103
|
-
fill: {
|
|
104
|
+
fill: createPatternFill(options.pattern, {
|
|
104
105
|
color: options.background,
|
|
105
106
|
opacity: options.opacity
|
|
106
|
-
},
|
|
107
|
+
}, undefined),
|
|
107
108
|
cursor: options.cursor
|
|
108
109
|
};
|
|
109
110
|
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { drawing } from '@progress/kendo-drawing';
|
|
2
|
+
import { isFunction } from './../common';
|
|
3
|
+
|
|
4
|
+
const { dotsPattern, verticalStripesPattern, crosshatchPattern, diagonalStripesPattern, gridPattern } = drawing;
|
|
5
|
+
|
|
6
|
+
const patternMap = {
|
|
7
|
+
dots: dotsPattern,
|
|
8
|
+
verticalStripes: verticalStripesPattern,
|
|
9
|
+
crosshatch: crosshatchPattern,
|
|
10
|
+
diagonalStripes: diagonalStripesPattern,
|
|
11
|
+
grid: gridPattern
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export function evaluatePattern(options, point) {
|
|
15
|
+
return isFunction(options) ? options(point) : options;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function createPatternFill(options, fill, point) {
|
|
19
|
+
const patternOptions = evaluatePattern(options, point);
|
|
20
|
+
const pattern = patternOptions && patternMap[patternOptions.type];
|
|
21
|
+
|
|
22
|
+
return pattern ? pattern(Object.assign({}, fill, patternOptions)) : fill;
|
|
23
|
+
}
|
package/dist/es2015/core.js
CHANGED
|
@@ -27,3 +27,4 @@ export { default as RadarLogarithmicAxis } from './core/radar-logarithmic-axis';
|
|
|
27
27
|
export { default as CurveProcessor } from './core/curve-processor';
|
|
28
28
|
export { default as Gradients } from './core/gradients';
|
|
29
29
|
export { default as rectToBox } from './core/utils/rect-to-box';
|
|
30
|
+
export { createPatternFill } from './core/pattern';
|