@wavemaker-ai/app-rn-runtime 1.0.0-rc.326 → 1.0.0-rc.330
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/components/advanced/offline-banner/offline-banner.component.js +68 -0
- package/components/advanced/offline-banner/offline-banner.component.js.map +1 -0
- package/components/advanced/offline-banner/offline-banner.props.js +12 -0
- package/components/advanced/offline-banner/offline-banner.props.js.map +1 -0
- package/components/advanced/offline-banner/offline-banner.styles.js +99 -0
- package/components/advanced/offline-banner/offline-banner.styles.js.map +1 -0
- package/components/advanced/webview/webview.component.js +2 -2
- package/components/advanced/webview/webview.component.js.map +1 -1
- package/components/advanced/webview/webview.props.js +1 -1
- package/components/advanced/webview/webview.props.js.map +1 -1
- package/components/chart/area-chart/area-chart.component.js +86 -93
- package/components/chart/area-chart/area-chart.component.js.map +1 -1
- package/components/chart/area-chart/area-chart.props.js +2 -0
- package/components/chart/area-chart/area-chart.props.js.map +1 -1
- package/components/chart/bar-chart/bar-chart.component.js +79 -97
- package/components/chart/bar-chart/bar-chart.component.js.map +1 -1
- package/components/chart/basechart.component.js +117 -96
- package/components/chart/basechart.component.js.map +1 -1
- package/components/chart/basechart.props.js +12 -0
- package/components/chart/basechart.props.js.map +1 -1
- package/components/chart/basechart.styles.js.map +1 -1
- package/components/chart/bubble-chart/bubble-chart.component.js +72 -70
- package/components/chart/bubble-chart/bubble-chart.component.js.map +1 -1
- package/components/chart/bubble-chart/bubble-chart.props.js +1 -0
- package/components/chart/bubble-chart/bubble-chart.props.js.map +1 -1
- package/components/chart/line-chart/line-chart.component.js +105 -79
- package/components/chart/line-chart/line-chart.component.js.map +1 -1
- package/components/chart/pie-chart/pie-chart.component.js +70 -166
- package/components/chart/pie-chart/pie-chart.component.js.map +1 -1
- package/components/chart/pie-chart/pie-chart.props.js +1 -0
- package/components/chart/pie-chart/pie-chart.props.js.map +1 -1
- package/components/container/accordion/accordionpane/accordionpane.component.js +6 -2
- package/components/container/accordion/accordionpane/accordionpane.component.js.map +1 -1
- package/components/container/container.component.js +3 -0
- package/components/container/container.component.js.map +1 -1
- package/components/container/tabs/tabpane/tabpane.component.js +6 -2
- package/components/container/tabs/tabpane/tabpane.component.js.map +1 -1
- package/components/container/wizard/wizardstep/wizardstep.component.js +6 -2
- package/components/container/wizard/wizardstep/wizardstep.component.js.map +1 -1
- package/components/data/list/list-template/list-template.component.js +3 -0
- package/components/data/list/list-template/list-template.component.js.map +1 -1
- package/components/data/list/list.component.js +6 -4
- package/components/data/list/list.component.js.map +1 -1
- package/components/data/list/list.styles.js +1 -14
- package/components/data/list/list.styles.js.map +1 -1
- package/components/page/page-content/page-content.component.js +3 -0
- package/components/page/page-content/page-content.component.js.map +1 -1
- package/components/page/page-content/page-content.props.js +2 -0
- package/components/page/page-content/page-content.props.js.map +1 -1
- package/components/page/page.component.js +95 -2
- package/components/page/page.component.js.map +1 -1
- package/components/page/page.props.js +3 -0
- package/components/page/page.props.js.map +1 -1
- package/components/page/tabbar/tabbar.component.js +3 -2
- package/components/page/tabbar/tabbar.component.js.map +1 -1
- package/components/page/tabbar/tabbar.props.js +1 -0
- package/components/page/tabbar/tabbar.props.js.map +1 -1
- package/components-prism/basic/search/search.component.js +206 -0
- package/components-prism/basic/search/search.component.js.map +1 -0
- package/components-prism/basic/search/search.props.js +14 -0
- package/components-prism/basic/search/search.props.js.map +1 -0
- package/components-prism/basic/search/search.styles.js +127 -0
- package/components-prism/basic/search/search.styles.js.map +1 -0
- package/core/accessibility.js +9 -0
- package/core/accessibility.js.map +1 -1
- package/core/auto-layout.utils.js +59 -0
- package/core/auto-layout.utils.js.map +1 -1
- package/core/base.component.js +22 -1
- package/core/base.component.js.map +1 -1
- package/core/network.service.js.map +1 -1
- package/npm-shrinkwrap.json +588 -1421
- package/package-lock.json +588 -1421
- package/package.json +11 -6
- package/runtime/base-fragment.component.js +7 -1
- package/runtime/base-fragment.component.js.map +1 -1
- package/runtime/base-page.component.js +24 -0
- package/runtime/base-page.component.js.map +1 -1
- package/runtime/base-partial.component.js.map +1 -1
- package/variables/http.service.js +6 -1
- package/variables/http.service.js.map +1 -1
- package/variables/interceptor/intercept-context.impl.js +46 -0
- package/variables/interceptor/intercept-context.impl.js.map +1 -0
- package/variables/interceptor/interceptor.factory.js +78 -0
- package/variables/interceptor/interceptor.factory.js.map +1 -0
- package/variables/interceptor/persistent.storage.js +142 -0
- package/variables/interceptor/persistent.storage.js.map +1 -0
- package/variables/interceptor/service-variable-interceptor.js +52 -0
- package/variables/interceptor/service-variable-interceptor.js.map +1 -0
- package/variables/service-variable.js +109 -1
- package/variables/service-variable.js.map +1 -1
|
@@ -7,6 +7,8 @@ export default class WmAreaChartProps extends BaseChartComponentProps {
|
|
|
7
7
|
super(...args);
|
|
8
8
|
_defineProperty(this, "linethickness", 2);
|
|
9
9
|
_defineProperty(this, "onSelect", void 0);
|
|
10
|
+
_defineProperty(this, "areafill", 'gradient');
|
|
11
|
+
_defineProperty(this, "areaopacity", 0.6);
|
|
10
12
|
}
|
|
11
13
|
}
|
|
12
14
|
//# sourceMappingURL=area-chart.props.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["BaseChartComponentProps","WmAreaChartProps","constructor","args","_defineProperty"],"sources":["area-chart.props.ts"],"sourcesContent":["import BaseChartComponentProps from \"@wavemaker-ai/app-rn-runtime/components/chart/basechart.props\";\n\nexport default class WmAreaChartProps extends BaseChartComponentProps {\n
|
|
1
|
+
{"version":3,"names":["BaseChartComponentProps","WmAreaChartProps","constructor","args","_defineProperty"],"sources":["area-chart.props.ts"],"sourcesContent":["import BaseChartComponentProps from \"@wavemaker-ai/app-rn-runtime/components/chart/basechart.props\";\n\nexport default class WmAreaChartProps extends BaseChartComponentProps {\n linethickness: number = 2;\n onSelect?: any;\n areafill?: 'gradient' | 'transparent' | 'solid' = 'gradient';\n areaopacity?: number = 0.6;\n}\n"],"mappings":";;;AAAA,OAAOA,uBAAuB,MAAM,+DAA+D;AAEnG,eAAe,MAAMC,gBAAgB,SAASD,uBAAuB,CAAC;EAAAE,YAAA,GAAAC,IAAA;IAAA,SAAAA,IAAA;IAAAC,eAAA,wBAC5C,CAAC;IAAAA,eAAA;IAAAA,eAAA,mBAEyB,UAAU;IAAAA,eAAA,sBACrC,GAAG;EAAA;AAC5B","ignoreList":[]}
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
2
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
3
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
4
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
2
5
|
import React from 'react';
|
|
3
|
-
import { View, Text
|
|
6
|
+
import { View, Text } from 'react-native';
|
|
7
|
+
import { ColumnChart } from '@wavemaker/react-native-echarts';
|
|
4
8
|
import { AccessibilityWidgetType, getAccessibilityProps } from '@wavemaker-ai/app-rn-runtime/core/accessibility';
|
|
5
|
-
import { VictoryChart, VictoryBar, VictoryStack, VictoryGroup } from "victory-native";
|
|
6
9
|
import { BaseChartComponent, BaseChartComponentState } from "@wavemaker-ai/app-rn-runtime/components/chart/basechart.component";
|
|
7
10
|
import WmBarChartProps from './bar-chart.props';
|
|
8
11
|
import { DEFAULT_CLASS } from './bar-chart.styles';
|
|
@@ -11,99 +14,55 @@ export class WmBarChartState extends BaseChartComponentState {}
|
|
|
11
14
|
export default class WmBarChart extends BaseChartComponent {
|
|
12
15
|
constructor(props) {
|
|
13
16
|
super(props, DEFAULT_CLASS, new WmBarChartProps(), new WmBarChartState());
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
alignment: this.isRTL ? 'end' : 'start',
|
|
28
|
-
style: props.customcolors ? {
|
|
29
|
-
data: {
|
|
30
|
-
fill: isNested ? this.state.colors[i % this.state.colors.length] : ({
|
|
31
|
-
datum
|
|
32
|
-
}) => {
|
|
33
|
-
var _this$state$colors$da;
|
|
34
|
-
return (_this$state$colors$da = this.state.colors[datum.x]) !== null && _this$state$colors$da !== void 0 ? _this$state$colors$da : this.state.colors[datum.x % this.state.colors.length];
|
|
35
|
-
},
|
|
36
|
-
stroke: isNested ? this.state.colors[i % this.state.colors.length] : ({
|
|
37
|
-
datum
|
|
38
|
-
}) => {
|
|
39
|
-
var _this$state$colors$da2;
|
|
40
|
-
return (_this$state$colors$da2 = this.state.colors[datum.x]) !== null && _this$state$colors$da2 !== void 0 ? _this$state$colors$da2 : this.state.colors[datum.x % this.state.colors.length];
|
|
41
|
-
},
|
|
42
|
-
strokeWidth: props.showzerothvalue ? 3 : 0
|
|
43
|
-
}
|
|
44
|
-
} : {
|
|
45
|
-
data: {
|
|
46
|
-
strokeWidth: props.showzerothvalue ? 3 : 0
|
|
47
|
-
}
|
|
48
|
-
},
|
|
49
|
-
cornerRadius: {
|
|
50
|
-
topLeft: this.styles.bar.borderTopLeftRadius,
|
|
51
|
-
topRight: this.styles.bar.borderTopRightRadius,
|
|
52
|
-
bottomLeft: this.styles.bar.borderBottomLeftRadius,
|
|
53
|
-
bottomRight: this.styles.bar.borderBottomRightRadius
|
|
54
|
-
},
|
|
55
|
-
events: [{
|
|
56
|
-
target: 'data',
|
|
57
|
-
eventHandlers: Platform.OS == "web" ? {
|
|
58
|
-
onClick: this.onSelect.bind(this)
|
|
59
|
-
} : {
|
|
60
|
-
onPress: this.onSelect.bind(this)
|
|
61
|
-
}
|
|
62
|
-
}]
|
|
63
|
-
}, props.barwidth ? {
|
|
64
|
-
barWidth: props.barwidth
|
|
65
|
-
} : {}));
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
onSelect(event, data) {
|
|
69
|
-
if (!this.viewRef.current) return;
|
|
70
|
-
if (!this.state.props.dataset) return;
|
|
71
|
-
this.viewRef.current.measureInWindow((chartX, chartY) => {
|
|
72
|
-
let value = data.data[data.index].y;
|
|
73
|
-
let label = this.state.xaxisDatakeyArr[data.datum.x];
|
|
74
|
-
let selectedItem = this.props.dataset[data.index];
|
|
75
|
-
const nativeEvent = event.nativeEvent;
|
|
76
|
-
let tooltipX = nativeEvent.pageX - chartX;
|
|
77
|
-
let tooltipY = nativeEvent.pageY - chartY;
|
|
78
|
-
let selectedChartItem = [{
|
|
79
|
-
series: 0,
|
|
80
|
-
x: data.index,
|
|
81
|
-
y: value,
|
|
17
|
+
_defineProperty(this, "onSelect", event => {
|
|
18
|
+
if (!this.viewRef.current) return;
|
|
19
|
+
if (!this.state.props.dataset) return;
|
|
20
|
+
const {
|
|
21
|
+
dataIndex,
|
|
22
|
+
y,
|
|
23
|
+
seriesIndex
|
|
24
|
+
} = event;
|
|
25
|
+
const selectedItem = this.props.dataset[dataIndex];
|
|
26
|
+
const selectedChartItem = [{
|
|
27
|
+
series: seriesIndex,
|
|
28
|
+
x: dataIndex,
|
|
29
|
+
y,
|
|
82
30
|
_dataObj: selectedItem
|
|
83
|
-
},
|
|
31
|
+
}, dataIndex];
|
|
84
32
|
this.updateState({
|
|
85
|
-
tooltipXaxis: label,
|
|
86
|
-
tooltipYaxis: value,
|
|
87
|
-
isTooltipOpen: true,
|
|
88
33
|
selectedItem: {
|
|
89
34
|
...selectedItem,
|
|
90
|
-
index:
|
|
91
|
-
}
|
|
92
|
-
tooltipXPosition: tooltipX - this.state.tooltipoffsetx,
|
|
93
|
-
tooltipYPosition: tooltipY - this.state.tooltipoffsety
|
|
35
|
+
index: dataIndex
|
|
36
|
+
}
|
|
94
37
|
});
|
|
95
|
-
this.invokeEventCallback('onSelect', [
|
|
38
|
+
this.invokeEventCallback('onSelect', [null, this.proxy, selectedItem, selectedChartItem]);
|
|
96
39
|
});
|
|
97
40
|
}
|
|
41
|
+
labelFn(data) {
|
|
42
|
+
return this.abbreviateNumber(data.datum.y);
|
|
43
|
+
}
|
|
98
44
|
renderWidget(props) {
|
|
45
|
+
var _this$state$data, _this$state$colors, _props$tooltip;
|
|
99
46
|
this.invokeEventCallback('onBeforerender', [this.proxy, null]);
|
|
100
|
-
if (!this.state.data.length) {
|
|
47
|
+
if (!((_this$state$data = this.state.data) !== null && _this$state$data !== void 0 && _this$state$data.length)) {
|
|
101
48
|
return null;
|
|
102
49
|
}
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
};
|
|
50
|
+
const chartData = this.state.data.map((series, i) => ({
|
|
51
|
+
name: this.state.yAxis[i],
|
|
52
|
+
data: series.map(pt => pt.y)
|
|
53
|
+
}));
|
|
54
|
+
const showLegend = props.showlegend !== 'hide';
|
|
55
|
+
const legendPosition = ['top', 'bottom', 'left', 'right'].includes(props.showlegend) ? props.showlegend : 'bottom';
|
|
56
|
+
const minDomain = this.getMinDomain();
|
|
57
|
+
|
|
58
|
+
// ColumnChart swaps category/value axes when horizontal=true. WaveMaker x-axis props
|
|
59
|
+
// refer to categories (xaxisdatakey) and y-axis props refer to values (yaxisdatakey).
|
|
60
|
+
const isHorizontal = !!props.horizontal;
|
|
61
|
+
const series = ((_this$state$colors = this.state.colors) !== null && _this$state$colors !== void 0 && _this$state$colors.length ? this.state.colors : ['#000']).map(color => ({
|
|
62
|
+
color
|
|
63
|
+
}));
|
|
64
|
+
const xAxisTickLabelFormatter = isHorizontal ? this.getYAxisTickLabelFormatter() : this.getXAxisTickLabelFormatter();
|
|
65
|
+
const yAxisTickLabelFormatter = isHorizontal ? this.getXAxisTickLabelFormatter() : this.getYAxisTickLabelFormatter();
|
|
107
66
|
return /*#__PURE__*/React.createElement(View, _extends({}, getAccessibilityProps(AccessibilityWidgetType.LINECHART, props), {
|
|
108
67
|
style: this.styles.root,
|
|
109
68
|
onLayout: this.onViewLayoutChange.bind(this)
|
|
@@ -120,25 +79,48 @@ export default class WmBarChart extends BaseChartComponent {
|
|
|
120
79
|
style: this.styles.title
|
|
121
80
|
}, props.title) : null) : null, props.subheading ? /*#__PURE__*/React.createElement(Text, {
|
|
122
81
|
style: this.styles.subHeading
|
|
123
|
-
}, props.subheading) : null), /*#__PURE__*/React.createElement(View, {
|
|
82
|
+
}, props.subheading) : null), this.state.chartWidth ? /*#__PURE__*/React.createElement(View, {
|
|
124
83
|
ref: this.viewRef
|
|
125
|
-
},
|
|
126
|
-
|
|
127
|
-
height: this.styles.root.height,
|
|
84
|
+
}, /*#__PURE__*/React.createElement(ColumnChart, {
|
|
85
|
+
data: chartData,
|
|
128
86
|
width: this.state.chartWidth || this.screenWidth,
|
|
129
|
-
|
|
130
|
-
|
|
87
|
+
height: this.styles.root.height,
|
|
88
|
+
colors: this.state.colors,
|
|
89
|
+
theme: this.getChartTheme(isHorizontal, series),
|
|
90
|
+
horizontal: props.horizontal,
|
|
91
|
+
stack: props.viewtype === 'Stacked' ? 'total' : false,
|
|
92
|
+
stackNormalize: props.stacknormalize,
|
|
93
|
+
cornerRadius: [this.styles.bar.borderTopLeftRadius, this.styles.bar.borderTopRightRadius, this.styles.bar.borderBottomRightRadius, this.styles.bar.borderBottomLeftRadius],
|
|
94
|
+
barOutsideLabelFormatter: props.showvalues ? value => String(this.abbreviateNumber(value)) : undefined,
|
|
95
|
+
minY: minDomain.y,
|
|
96
|
+
maxY: this.state.chartMaxY,
|
|
97
|
+
minX: minDomain.x,
|
|
98
|
+
maxX: this.state.chartMaxX,
|
|
99
|
+
grid: {
|
|
131
100
|
top: props.offsettop,
|
|
132
101
|
bottom: props.offsetbottom,
|
|
133
102
|
left: this.isRTL ? props.offsetright : props.offsetleft,
|
|
134
103
|
right: this.isRTL ? props.offsetleft : props.offsetright
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
104
|
+
},
|
|
105
|
+
showXAxis: isHorizontal ? props.showyaxis : props.showxaxis,
|
|
106
|
+
showXAxisTicks: isHorizontal ? props.showyaxisticks : props.showxaxisticks,
|
|
107
|
+
showYAxis: isHorizontal ? props.showxaxis : props.showyaxis,
|
|
108
|
+
showYAxisTicks: isHorizontal ? props.showxaxisticks : props.showyaxisticks,
|
|
109
|
+
showXAxisSplitLines: isHorizontal ? !props.hidegridyaxis : !props.hidegridxaxis,
|
|
110
|
+
showYAxisSplitLines: isHorizontal ? !props.hidegridxaxis : !props.hidegridyaxis,
|
|
111
|
+
xAxisLabel: isHorizontal ? this.state.yLabel || '' : this.state.xLabel || '',
|
|
112
|
+
yAxisLabel: isHorizontal ? this.state.xLabel || '' : this.state.yLabel || '',
|
|
113
|
+
xAxisTickLabelFormatter: xAxisTickLabelFormatter,
|
|
114
|
+
yAxisTickLabelFormatter: yAxisTickLabelFormatter,
|
|
115
|
+
showLegend: showLegend,
|
|
116
|
+
legendPosition: legendPosition,
|
|
117
|
+
tooltip: props.tooltips ? this.hasCustomTooltip ? 'none' : (_props$tooltip = props.tooltip) !== null && _props$tooltip !== void 0 ? _props$tooltip : 'card' : 'none',
|
|
118
|
+
renderTooltip: this.getRenderTooltip(),
|
|
119
|
+
showHighlighter: props.showhighlighter,
|
|
120
|
+
onSelect: this.onSelect,
|
|
121
|
+
intervalX: isHorizontal ? props.intervaly : props.intervalx,
|
|
122
|
+
intervalY: isHorizontal ? props.intervalx : props.intervaly
|
|
123
|
+
})) : null);
|
|
142
124
|
}
|
|
143
125
|
}
|
|
144
126
|
//# sourceMappingURL=bar-chart.component.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","View","Text","Platform","AccessibilityWidgetType","getAccessibilityProps","VictoryChart","VictoryBar","VictoryStack","VictoryGroup","BaseChartComponent","BaseChartComponentState","WmBarChartProps","DEFAULT_CLASS","WmIcon","WmBarChartState","WmBarChart","constructor","props","labelFn","data","abbreviateNumber","datum","y","getBarChart","isNested","Array","isArray","state","length","map","d","i","createElement","_extends","key","name","horizontal","labels","showvalues","bind","undefined","isRTL","toReversed","height","alignment","style","customcolors","fill","colors","_this$state$colors$da","x","stroke","_this$state$colors$da2","strokeWidth","showzerothvalue","cornerRadius","topLeft","styles","bar","borderTopLeftRadius","topRight","borderTopRightRadius","bottomLeft","borderBottomLeftRadius","bottomRight","borderBottomRightRadius","events","target","eventHandlers","OS","onClick","onSelect","onPress","barwidth","barWidth","event","viewRef","current","dataset","measureInWindow","chartX","chartY","value","index","label","xaxisDatakeyArr","selectedItem","nativeEvent","tooltipX","pageX","tooltipY","pageY","selectedChartItem","series","_dataObj","updateState","tooltipXaxis","tooltipYaxis","isTooltipOpen","tooltipXPosition","tooltipoffsetx","tooltipYPosition","tooltipoffsety","invokeEventCallback","proxy","renderWidget","mindomain","xdomain","chartMinX","ydomain","chartMinY","LINECHART","root","onLayout","onViewLayoutChange","title","iconclass","testID","flexDirection","alignItems","icon","subheading","subHeading","ref","getTooltip","theme","width","chartWidth","screenWidth","minDomain","padding","top","offsettop","bottom","offsetbottom","left","offsetright","offsetleft","right","getLegendView","getXaxis","getYAxis","viewtype","colorScale","offset"],"sources":["bar-chart.component.tsx"],"sourcesContent":["import React from 'react';\nimport { View, Text, Platform, LayoutChangeEvent } from 'react-native';\nimport { AccessibilityWidgetType, getAccessibilityProps } from '@wavemaker-ai/app-rn-runtime/core/accessibility';\nimport {\n VictoryChart,\n VictoryBar,\n VictoryLegend,\n VictoryStack,\n VictoryGroup\n} from \"victory-native\";\n\nimport {\n BaseChartComponent,\n BaseChartComponentState\n} from \"@wavemaker-ai/app-rn-runtime/components/chart/basechart.component\";\nimport WmBarChartProps from './bar-chart.props';\nimport { DEFAULT_CLASS, WmBarChartStyles } from './bar-chart.styles';\nimport WmIcon from \"@wavemaker-ai/app-rn-runtime/components/basic/icon/icon.component\";\nimport { min } from 'moment';\nimport { isWebPreviewMode } from '@wavemaker-ai/app-rn-runtime/core/utils';\n\nexport class WmBarChartState extends BaseChartComponentState<WmBarChartProps> {}\n\nexport default class WmBarChart extends BaseChartComponent<WmBarChartProps, WmBarChartState, WmBarChartStyles> {\n\n constructor(props: WmBarChartProps) {\n super(props, DEFAULT_CLASS, new WmBarChartProps(), new WmBarChartState());\n }\n\n labelFn(data: any): string | number | string[] | number[] | null {\n return this.abbreviateNumber(data.datum.y);\n }\n\n getBarChart(props: WmBarChartProps) {\n const isNested = Array.isArray(this.state.data[0]) && this.state.data.length > 1;\n return this.state.data.map((d: any, i: number) => {\n return <VictoryBar key={props.name + '_' + i}\n horizontal={props.horizontal} labels={props.showvalues ? this.labelFn.bind(this) : undefined}\n data={this.isRTL?d.toReversed():d}\n height={100}\n alignment={this.isRTL ? 'end' : 'start'}\n style={props.customcolors?{\n data: {\n fill:isNested ? this.state.colors[i % this.state.colors.length] : ({ datum }) => this.state.colors[datum.x] ?? this.state.colors[datum.x % this.state.colors.length],\n stroke: isNested ? this.state.colors[i % this.state.colors.length] : ({ datum }) => this.state.colors[datum.x] ?? this.state.colors[datum.x % this.state.colors.length],\n strokeWidth: props.showzerothvalue ? 3 : 0\n }\n }:{\n data: {\n strokeWidth: props.showzerothvalue ? 3 : 0\n }\n }}\n cornerRadius={{topLeft: this.styles.bar.borderTopLeftRadius, topRight: this.styles.bar.borderTopRightRadius, bottomLeft: this.styles.bar.borderBottomLeftRadius, bottomRight: this.styles.bar.borderBottomRightRadius}}\n events={[{\n target: 'data',\n eventHandlers: Platform.OS == \"web\" ? {\n onClick: this.onSelect.bind(this)\n }:{\n onPress: this.onSelect.bind(this)\n }\n }]}\n {...(props.barwidth ? { barWidth: props.barwidth } : {})} />\n });\n }\n\nonSelect(event: any, data: any){\n if (!this.viewRef.current) return;\n if (!this.state.props.dataset) return;\n this.viewRef.current.measureInWindow((chartX: number, chartY: number) => {\n let value = data.data[data.index].y;\n let label = this.state.xaxisDatakeyArr[data.datum.x];\n let selectedItem = this.props.dataset[data.index];\n const nativeEvent = event.nativeEvent;\n let tooltipX = nativeEvent.pageX - chartX;\n let tooltipY = nativeEvent.pageY - chartY;\n let selectedChartItem = [{series: 0, x: data.index, y: value,_dataObj: selectedItem},data.index];\n this.updateState({\n tooltipXaxis: label,\n tooltipYaxis: value,\n isTooltipOpen: true,\n selectedItem: {...selectedItem, index: data.index},\n tooltipXPosition: tooltipX - this.state.tooltipoffsetx,\n tooltipYPosition: tooltipY - this.state.tooltipoffsety\n } as WmBarChartState)\n this.invokeEventCallback('onSelect', [event.nativeEvent, this.proxy, selectedItem, selectedChartItem ]);\n });\n}\n\n renderWidget(props: WmBarChartProps) {\n this.invokeEventCallback('onBeforerender', [this.proxy, null]);\n if (!this.state.data.length) {\n return null;\n }\n let mindomain={x: this.props.xdomain === 'Min' ? this.state.chartMinX: undefined, y: this.props.ydomain === 'Min' ? this.state.chartMinY: undefined};\n return (<View\n {...getAccessibilityProps(AccessibilityWidgetType.LINECHART, props)}\n style={this.styles.root}\n onLayout={this.onViewLayoutChange.bind(this)}\n >\n <View>\n { (props.title || props.iconclass) ? (\n <View testID=\"title-icon-container\" style={{flexDirection: 'row', alignItems: 'center'}}>\n {props.iconclass ? (<WmIcon iconclass={props.iconclass} styles={this.styles.icon}></WmIcon>) : null }\n {props.title ? (<Text style={this.styles.title}>{props.title}</Text>) : null }\n </View>\n ) : null }\n { props.subheading ? (\n <Text style={this.styles.subHeading}>{props.subheading}</Text> ) : null }\n </View>\n <View ref={this.viewRef}>\n {this.getTooltip()}\n <VictoryChart theme={this.state.theme}\n height={(this.styles.root.height) as number}\n width={this.state.chartWidth || this.screenWidth}\n minDomain={mindomain}\n padding={{ top: props.offsettop, bottom: props.offsetbottom, left: this.isRTL ? props.offsetright : props.offsetleft, right: this.isRTL ? props.offsetleft : props.offsetright }}>\n {this.getLegendView()}\n {this.getXaxis()}\n {this.getYAxis()}\n {\n props.viewtype === 'Stacked' ? <VictoryStack\n colorScale={!this.theme ? this.state.colors : undefined}>\n {\n this.getBarChart(props)\n }\n </VictoryStack> : <VictoryGroup colorScale={!this.theme ? this.state.colors : undefined} offset={10} >\n {\n this.getBarChart(props)\n }\n </VictoryGroup>\n }\n </VictoryChart></View></View>);\n }\n}\n"],"mappings":";AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,IAAI,EAAEC,IAAI,EAAEC,QAAQ,QAA2B,cAAc;AACtE,SAASC,uBAAuB,EAAEC,qBAAqB,QAAQ,iDAAiD;AAChH,SACEC,YAAY,EACZC,UAAU,EAEVC,YAAY,EACZC,YAAY,QACP,gBAAgB;AAEvB,SACEC,kBAAkB,EAClBC,uBAAuB,QAClB,mEAAmE;AAC1E,OAAOC,eAAe,MAAM,mBAAmB;AAC/C,SAASC,aAAa,QAA0B,oBAAoB;AACpE,OAAOC,MAAM,MAAM,mEAAmE;AAItF,OAAO,MAAMC,eAAe,SAASJ,uBAAuB,CAAkB;AAE9E,eAAe,MAAMK,UAAU,SAASN,kBAAkB,CAAqD;EAE7GO,WAAWA,CAACC,KAAsB,EAAE;IAClC,KAAK,CAACA,KAAK,EAAEL,aAAa,EAAE,IAAID,eAAe,CAAC,CAAC,EAAE,IAAIG,eAAe,CAAC,CAAC,CAAC;EAC3E;EAEAI,OAAOA,CAACC,IAAS,EAAgD;IAC/D,OAAO,IAAI,CAACC,gBAAgB,CAACD,IAAI,CAACE,KAAK,CAACC,CAAC,CAAC;EAC5C;EAEAC,WAAWA,CAACN,KAAsB,EAAE;IAClC,MAAMO,QAAQ,GAAGC,KAAK,CAACC,OAAO,CAAC,IAAI,CAACC,KAAK,CAACR,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,CAACQ,K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,QAAQ,CAAC,CAAC,EAEd5H,KAAK,CAAC6H,QAAQ,KAAK,SAAS,gBAAG/I,KAAA,CAAAiC,aAAA,CAACzB,YAAY;MAC1CwI,UAAU,EAAE,CAAC,IAAI,CAAClB,KAAK,GAAG,IAAI,CAAClG,KAAK,CAACqB,MAAM,GAAGR;IAAU,GAEtD,IAAI,CAACjB,WAAW,CAACN,KAAK,CAEZ,CAAC,gBAAGlB,KAAA,CAAAiC,aAAA,CAACxB,YAAY;MAACuI,UAAU,EAAE,CAAC,IAAI,CAAClB,KAAK,GAAG,IAAI,CAAClG,KAAK,CAACqB,MAAM,GAAGR,SAAU;MAAEwG,MAAM,EAAE;IAAG,GAEjG,IAAI,CAACzH,WAAW,CAACN,KAAK,CAEZ,CAEJ,CAAO,CAAO,CAAC;EACnC;AACF","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["React","View","Text","ColumnChart","AccessibilityWidgetType","getAccessibilityProps","BaseChartComponent","BaseChartComponentState","WmBarChartProps","DEFAULT_CLASS","WmIcon","WmBarChartState","WmBarChart","constructor","props","_defineProperty","event","viewRef","current","state","dataset","dataIndex","y","seriesIndex","selectedItem","selectedChartItem","series","x","_dataObj","updateState","index","invokeEventCallback","proxy","labelFn","data","abbreviateNumber","datum","renderWidget","_this$state$data","_this$state$colors","_props$tooltip","length","chartData","map","i","name","yAxis","pt","showLegend","showlegend","legendPosition","includes","minDomain","getMinDomain","isHorizontal","horizontal","colors","color","xAxisTickLabelFormatter","getYAxisTickLabelFormatter","getXAxisTickLabelFormatter","yAxisTickLabelFormatter","createElement","_extends","LINECHART","style","styles","root","onLayout","onViewLayoutChange","bind","title","iconclass","testID","flexDirection","alignItems","icon","subheading","subHeading","chartWidth","ref","width","screenWidth","height","theme","getChartTheme","stack","viewtype","stackNormalize","stacknormalize","cornerRadius","bar","borderTopLeftRadius","borderTopRightRadius","borderBottomRightRadius","borderBottomLeftRadius","barOutsideLabelFormatter","showvalues","value","String","undefined","minY","maxY","chartMaxY","minX","maxX","chartMaxX","grid","top","offsettop","bottom","offsetbottom","left","isRTL","offsetright","offsetleft","right","showXAxis","showyaxis","showxaxis","showXAxisTicks","showyaxisticks","showxaxisticks","showYAxis","showYAxisTicks","showXAxisSplitLines","hidegridyaxis","hidegridxaxis","showYAxisSplitLines","xAxisLabel","yLabel","xLabel","yAxisLabel","tooltip","tooltips","hasCustomTooltip","renderTooltip","getRenderTooltip","showHighlighter","showhighlighter","onSelect","intervalX","intervaly","intervalx","intervalY"],"sources":["bar-chart.component.tsx"],"sourcesContent":["import React from 'react';\nimport { View, Text } from 'react-native';\nimport { ColumnChart, CartesianChartSelectEvent, AreaChartAxisTooltipParams } from '@wavemaker/react-native-echarts';\nimport { AccessibilityWidgetType, getAccessibilityProps } from '@wavemaker-ai/app-rn-runtime/core/accessibility';\nimport {\n BaseChartComponent,\n BaseChartComponentState\n} from \"@wavemaker-ai/app-rn-runtime/components/chart/basechart.component\";\nimport WmBarChartProps from './bar-chart.props';\nimport { DEFAULT_CLASS, WmBarChartStyles } from './bar-chart.styles';\nimport WmIcon from \"@wavemaker-ai/app-rn-runtime/components/basic/icon/icon.component\";\nimport isEmpty from 'lodash-es/isEmpty';\n\nexport class WmBarChartState extends BaseChartComponentState<WmBarChartProps> {}\n\nexport default class WmBarChart extends BaseChartComponent<WmBarChartProps, WmBarChartState, WmBarChartStyles> {\n\n constructor(props: WmBarChartProps) {\n super(props, DEFAULT_CLASS, new WmBarChartProps(), new WmBarChartState());\n }\n\n labelFn(data: any): string | number | string[] | number[] | null {\n return this.abbreviateNumber(data.datum.y);\n }\n\n\n onSelect = (event: CartesianChartSelectEvent): void => {\n if (!this.viewRef.current) return;\n if (!this.state.props.dataset) return;\n const { dataIndex, y, seriesIndex } = event;\n const selectedItem = this.props.dataset[dataIndex];\n const selectedChartItem = [\n { series: seriesIndex, x: dataIndex, y, _dataObj: selectedItem },\n dataIndex,\n ];\n this.updateState({\n selectedItem: { ...selectedItem, index: dataIndex },\n } as WmBarChartState);\n this.invokeEventCallback('onSelect', [null, this.proxy, selectedItem, selectedChartItem]);\n}\n\n renderWidget(props: WmBarChartProps) {\n this.invokeEventCallback('onBeforerender', [this.proxy, null]);\n if (!this.state.data?.length) {\n return null;\n }\n\n const chartData = this.state.data.map((series: any[], i: number) => ({\n name: this.state.yAxis[i],\n data: series.map((pt: { x: number; y: number }) => pt.y),\n }));\n\n const showLegend = props.showlegend !== 'hide';\n const legendPosition = (['top', 'bottom', 'left', 'right'].includes(props.showlegend)\n ? props.showlegend : 'bottom') as 'top' | 'bottom' | 'left' | 'right';\n const minDomain = this.getMinDomain();\n\n // ColumnChart swaps category/value axes when horizontal=true. WaveMaker x-axis props\n // refer to categories (xaxisdatakey) and y-axis props refer to values (yaxisdatakey).\n const isHorizontal = !!props.horizontal;\n const series = (this.state.colors?.length ? this.state.colors : ['#000']).map((color: string) => ({\n color,\n }));\n const xAxisTickLabelFormatter = isHorizontal\n ? this.getYAxisTickLabelFormatter()\n : this.getXAxisTickLabelFormatter();\n const yAxisTickLabelFormatter = isHorizontal\n ? this.getXAxisTickLabelFormatter()\n : this.getYAxisTickLabelFormatter();\n\n return (\n <View\n {...getAccessibilityProps(AccessibilityWidgetType.LINECHART, props)}\n style={this.styles.root}\n onLayout={this.onViewLayoutChange.bind(this)}\n >\n <View>\n {(props.title || props.iconclass) ? (\n <View testID=\"title-icon-container\" style={{ flexDirection: 'row', alignItems: 'center' }}>\n {props.iconclass ? (<WmIcon iconclass={props.iconclass} styles={this.styles.icon} />) : null}\n {props.title ? (<Text style={this.styles.title}>{props.title}</Text>) : null}\n </View>\n ) : null}\n {props.subheading ? (\n <Text style={this.styles.subHeading}>{props.subheading}</Text>\n ) : null}\n </View>\n {this.state.chartWidth ? (\n <View ref={this.viewRef}>\n <ColumnChart\n data={chartData}\n width={this.state.chartWidth || this.screenWidth}\n height={this.styles.root.height as number}\n colors={this.state.colors}\n theme={this.getChartTheme(isHorizontal, series)}\n horizontal={props.horizontal}\n stack={props.viewtype === 'Stacked' ? 'total' : false}\n stackNormalize={props.stacknormalize}\n cornerRadius={[\n this.styles.bar.borderTopLeftRadius,\n this.styles.bar.borderTopRightRadius,\n this.styles.bar.borderBottomRightRadius,\n this.styles.bar.borderBottomLeftRadius,\n ]}\n barOutsideLabelFormatter={props.showvalues\n ? (value: number) => String(this.abbreviateNumber(value))\n : undefined}\n minY={minDomain.y}\n maxY={this.state.chartMaxY}\n minX={minDomain.x}\n maxX={this.state.chartMaxX}\n grid={{\n top: props.offsettop,\n bottom: props.offsetbottom,\n left: this.isRTL ? props.offsetright : props.offsetleft,\n right: this.isRTL ? props.offsetleft : props.offsetright,\n }}\n showXAxis={isHorizontal ? props.showyaxis : props.showxaxis}\n showXAxisTicks={isHorizontal ? props.showyaxisticks : props.showxaxisticks}\n showYAxis={isHorizontal ? props.showxaxis : props.showyaxis}\n showYAxisTicks={isHorizontal ? props.showxaxisticks : props.showyaxisticks}\n showXAxisSplitLines={isHorizontal ? !props.hidegridyaxis : !props.hidegridxaxis}\n showYAxisSplitLines={isHorizontal ? !props.hidegridxaxis : !props.hidegridyaxis}\n xAxisLabel={isHorizontal ? (this.state.yLabel || '') : (this.state.xLabel || '')}\n yAxisLabel={isHorizontal ? (this.state.xLabel || '') : (this.state.yLabel || '')}\n xAxisTickLabelFormatter={xAxisTickLabelFormatter}\n yAxisTickLabelFormatter={yAxisTickLabelFormatter}\n showLegend={showLegend}\n legendPosition={legendPosition}\n tooltip={props.tooltips ? (this.hasCustomTooltip ? 'none' : (props.tooltip ?? 'card')) : 'none'}\n renderTooltip={this.getRenderTooltip()}\n showHighlighter={props.showhighlighter}\n onSelect={this.onSelect}\n intervalX={isHorizontal ? props.intervaly : props.intervalx}\n intervalY={isHorizontal ? props.intervalx : props.intervaly}\n />\n </View>\n ) : null}\n </View>\n );\n }\n}\n"],"mappings":";;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,IAAI,EAAEC,IAAI,QAAQ,cAAc;AACzC,SAASC,WAAW,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;MAC/BmF,OAAO,EAAEvH,KAAK,CAACwH,QAAQ,GAAI,IAAI,CAACC,gBAAgB,GAAG,MAAM,IAAA/F,cAAA,GAAI1B,KAAK,CAACuH,OAAO,cAAA7F,cAAA,cAAAA,cAAA,GAAI,MAAO,GAAI,MAAO;MAChGgG,aAAa,EAAE,IAAI,CAACC,gBAAgB,CAAC,CAAE;MACvCC,eAAe,EAAE5H,KAAK,CAAC6H,eAAgB;MACvCC,QAAQ,EAAE,IAAI,CAACA,QAAS;MACxBC,SAAS,EAAEvF,YAAY,GAAGxC,KAAK,CAACgI,SAAS,GAAGhI,KAAK,CAACiI,SAAU;MAC5DC,SAAS,EAAE1F,YAAY,GAAGxC,KAAK,CAACiI,SAAS,GAAGjI,KAAK,CAACgI;IAAU,CAC7D,CACG,CAAC,GACL,IACA,CAAC;EAEX;AACF","ignoreList":[]}
|
|
@@ -5,7 +5,7 @@ import React from "react";
|
|
|
5
5
|
import { Dimensions, View, Text } from 'react-native';
|
|
6
6
|
import moment from "moment";
|
|
7
7
|
import { forEach, get, isArray, isEmpty, isObject, maxBy, minBy, set, orderBy } from "lodash-es";
|
|
8
|
-
import {
|
|
8
|
+
import { VictoryLegend } from "victory-native";
|
|
9
9
|
import { BaseComponent, BaseComponentState } from '@wavemaker-ai/app-rn-runtime/core/base.component';
|
|
10
10
|
import WmIcon from "@wavemaker-ai/app-rn-runtime/components/basic/icon/icon.component";
|
|
11
11
|
import ThemeFactory from "@wavemaker-ai/app-rn-runtime/components/chart/theme/chart.theme";
|
|
@@ -161,101 +161,94 @@ export class BaseChartComponent extends BaseComponent {
|
|
|
161
161
|
return yVal.toLocaleString();
|
|
162
162
|
}
|
|
163
163
|
}
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
const maxIndex = this.state.xaxisDatakeyArr.length - 1;
|
|
169
|
-
const props = this.state.props;
|
|
170
|
-
const getTickValueLabel = props.xtickexpr;
|
|
171
|
-
let height = this.styles.root.height || 250;
|
|
172
|
-
let yaxislabeldistance = props.yaxislabeldistance ? props.yaxislabeldistance : height - 20;
|
|
173
|
-
if (height && typeof height === 'string') {
|
|
174
|
-
height = parseInt(height);
|
|
175
|
-
}
|
|
176
|
-
return /*#__PURE__*/React.createElement(VictoryAxis, {
|
|
177
|
-
crossAxis: false,
|
|
178
|
-
label: (props.xaxislabel || props.xaxisdatakey || "name") + (props.xunits ? `(${props.xunits})` : ''),
|
|
179
|
-
style: {
|
|
180
|
-
axisLabel: this.theme.mergeStyle(this.styles.axisLabel, this.styles.yAxisLabel),
|
|
181
|
-
grid: props.hidegridxaxis ? {
|
|
182
|
-
stroke: null
|
|
183
|
-
} : this.theme.mergeStyle(this.styles.grid, this.styles.xGrid),
|
|
184
|
-
axis: props.showxaxis === false ? {
|
|
185
|
-
stroke: 'none'
|
|
186
|
-
} : this.theme.mergeStyle(this.styles.axis, this.styles.xAxis),
|
|
187
|
-
ticks: this.theme.mergeStyle(this.styles.ticks, this.styles.xTicks),
|
|
188
|
-
tickLabels: props.showxaxislabels === false ? {
|
|
189
|
-
fill: 'none'
|
|
190
|
-
} : this.theme.mergeStyle(this.styles.tickLabels, this.styles.xTickLabels)
|
|
191
|
-
},
|
|
192
|
-
fixLabelOverlap: props.autoadjustlabels ? true : false,
|
|
193
|
-
axisLabelComponent: /*#__PURE__*/React.createElement(VictoryLabel, {
|
|
194
|
-
y: yaxislabeldistance
|
|
195
|
-
}),
|
|
196
|
-
tickLabelComponent: /*#__PURE__*/React.createElement(VictoryLabel, {
|
|
197
|
-
y: props.offsetyaxis ? props.offsetyaxis : height - 30,
|
|
198
|
-
angle: props.labelangle || 0
|
|
199
|
-
}),
|
|
200
|
-
theme: this.state.theme,
|
|
201
|
-
tickCount: this.state.xaxisDatakeyArr.length,
|
|
202
|
-
invertAxis: this.isRTL,
|
|
203
|
-
tickFormat: (d, i, ticks) => {
|
|
204
|
-
if (getTickValueLabel) {
|
|
205
|
-
return getTickValueLabel(this.state.xaxisDatakeyArr[d], i, (ticks || []).length);
|
|
206
|
-
} else if (this.state.xaxisDatakeyArr) {
|
|
207
|
-
return this.state.xaxisDatakeyArr[d];
|
|
208
|
-
}
|
|
164
|
+
getXAxisTickLabelFormatter() {
|
|
165
|
+
return (val, idx) => {
|
|
166
|
+
const i = idx !== null && idx !== void 0 ? idx : Number(val);
|
|
167
|
+
if (i < 0 || i >= this.state.xaxisDatakeyArr.length) {
|
|
209
168
|
return '';
|
|
210
169
|
}
|
|
211
|
-
|
|
170
|
+
const label = this.state.xaxisDatakeyArr[i];
|
|
171
|
+
if (this.state.props.xtickexpr) {
|
|
172
|
+
return String(this.state.props.xtickexpr(label, i, this.state.xaxisDatakeyArr.length));
|
|
173
|
+
}
|
|
174
|
+
return String(label !== null && label !== void 0 ? label : val);
|
|
175
|
+
};
|
|
212
176
|
}
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
177
|
+
getYAxisTickLabelFormatter() {
|
|
178
|
+
return (val, idx) => {
|
|
179
|
+
const props = this.state.props;
|
|
180
|
+
if (props.ytickexpr) {
|
|
181
|
+
return String(props.ytickexpr(val, idx !== null && idx !== void 0 ? idx : 0, this.state.xaxisDatakeyArr.length));
|
|
182
|
+
}
|
|
183
|
+
if (props.ynumberformat) {
|
|
184
|
+
return String(this.setYAxisFormat(val, props.ynumberformat));
|
|
185
|
+
}
|
|
186
|
+
return String(this.abbreviateNumber(val));
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
getAxisTheme(axis) {
|
|
190
|
+
var _axisStyle$stroke, _s$axis, _axisStyle$strokeWidt, _s$axis2, _axisLabelStyle$fill, _s$axisLabel, _tickStyle$stroke, _s$ticks, _tickStyle$strokeWidt, _s$ticks2, _tickLabelStyle$fill, _s$tickLabels, _gridStyle$stroke, _s$grid, _gridStyle$strokeWidt, _s$grid2;
|
|
191
|
+
const s = this.styles;
|
|
192
|
+
const axisStyle = axis === 'x' ? s.xAxis : s.yAxis;
|
|
193
|
+
const axisLabelStyle = axis === 'x' ? s.xAxisLabel : s.yAxisLabel;
|
|
194
|
+
const tickStyle = axis === 'x' ? s.xTicks : s.yTicks;
|
|
195
|
+
const tickLabelStyle = axis === 'x' ? s.xTickLabels : s.yTickLabels;
|
|
196
|
+
const gridStyle = axis === 'x' ? s.xGrid : s.yGrid;
|
|
197
|
+
return {
|
|
198
|
+
lineColor: (_axisStyle$stroke = axisStyle === null || axisStyle === void 0 ? void 0 : axisStyle.stroke) !== null && _axisStyle$stroke !== void 0 ? _axisStyle$stroke : (_s$axis = s.axis) === null || _s$axis === void 0 ? void 0 : _s$axis.stroke,
|
|
199
|
+
lineWidth: (_axisStyle$strokeWidt = axisStyle === null || axisStyle === void 0 ? void 0 : axisStyle.strokeWidth) !== null && _axisStyle$strokeWidt !== void 0 ? _axisStyle$strokeWidt : (_s$axis2 = s.axis) === null || _s$axis2 === void 0 ? void 0 : _s$axis2.strokeWidth,
|
|
200
|
+
labelColor: (_axisLabelStyle$fill = axisLabelStyle === null || axisLabelStyle === void 0 ? void 0 : axisLabelStyle.fill) !== null && _axisLabelStyle$fill !== void 0 ? _axisLabelStyle$fill : (_s$axisLabel = s.axisLabel) === null || _s$axisLabel === void 0 ? void 0 : _s$axisLabel.fill,
|
|
201
|
+
tickColor: (_tickStyle$stroke = tickStyle === null || tickStyle === void 0 ? void 0 : tickStyle.stroke) !== null && _tickStyle$stroke !== void 0 ? _tickStyle$stroke : (_s$ticks = s.ticks) === null || _s$ticks === void 0 ? void 0 : _s$ticks.stroke,
|
|
202
|
+
tickWidth: (_tickStyle$strokeWidt = tickStyle === null || tickStyle === void 0 ? void 0 : tickStyle.strokeWidth) !== null && _tickStyle$strokeWidt !== void 0 ? _tickStyle$strokeWidt : (_s$ticks2 = s.ticks) === null || _s$ticks2 === void 0 ? void 0 : _s$ticks2.strokeWidth,
|
|
203
|
+
tickLabelColor: (_tickLabelStyle$fill = tickLabelStyle === null || tickLabelStyle === void 0 ? void 0 : tickLabelStyle.fill) !== null && _tickLabelStyle$fill !== void 0 ? _tickLabelStyle$fill : (_s$tickLabels = s.tickLabels) === null || _s$tickLabels === void 0 ? void 0 : _s$tickLabels.fill,
|
|
204
|
+
splitLineColor: (_gridStyle$stroke = gridStyle === null || gridStyle === void 0 ? void 0 : gridStyle.stroke) !== null && _gridStyle$stroke !== void 0 ? _gridStyle$stroke : (_s$grid = s.grid) === null || _s$grid === void 0 ? void 0 : _s$grid.stroke,
|
|
205
|
+
splitLineWidth: (_gridStyle$strokeWidt = gridStyle === null || gridStyle === void 0 ? void 0 : gridStyle.strokeWidth) !== null && _gridStyle$strokeWidt !== void 0 ? _gridStyle$strokeWidt : (_s$grid2 = s.grid) === null || _s$grid2 === void 0 ? void 0 : _s$grid2.strokeWidth
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
getGridLineTheme(axis) {
|
|
209
|
+
var _gridStyle$stroke2, _s$grid3, _gridStyle$strokeWidt2, _s$grid4;
|
|
210
|
+
const s = this.styles;
|
|
211
|
+
const gridStyle = axis === 'x' ? s.xGrid : s.yGrid;
|
|
212
|
+
return {
|
|
213
|
+
lineColor: (_gridStyle$stroke2 = gridStyle === null || gridStyle === void 0 ? void 0 : gridStyle.stroke) !== null && _gridStyle$stroke2 !== void 0 ? _gridStyle$stroke2 : (_s$grid3 = s.grid) === null || _s$grid3 === void 0 ? void 0 : _s$grid3.stroke,
|
|
214
|
+
lineWidth: (_gridStyle$strokeWidt2 = gridStyle === null || gridStyle === void 0 ? void 0 : gridStyle.strokeWidth) !== null && _gridStyle$strokeWidt2 !== void 0 ? _gridStyle$strokeWidt2 : (_s$grid4 = s.grid) === null || _s$grid4 === void 0 ? void 0 : _s$grid4.strokeWidth
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
getTooltipTheme() {
|
|
218
|
+
const container = this.styles.tooltipContainer || {};
|
|
219
|
+
const xText = this.styles.tooltipXText || {};
|
|
220
|
+
const yText = this.styles.tooltipYText || {};
|
|
221
|
+
return {
|
|
222
|
+
backgroundColor: container.backgroundColor,
|
|
223
|
+
labelColor: xText.fill,
|
|
224
|
+
valueColor: yText.fill,
|
|
225
|
+
borderColor: container.borderColor,
|
|
226
|
+
borderWidth: container.borderWidth,
|
|
227
|
+
borderRadius: container.borderRadius,
|
|
228
|
+
padding: container.padding
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
getChartTheme(swapAxes = false, series) {
|
|
232
|
+
var _this$styles$legendTe, _this$styles$legendTe2, _this$styles$legenedD;
|
|
233
|
+
return {
|
|
234
|
+
axis: {
|
|
235
|
+
x: swapAxes ? this.getAxisTheme('y') : this.getAxisTheme('x'),
|
|
236
|
+
y: swapAxes ? this.getAxisTheme('x') : this.getAxisTheme('y')
|
|
238
237
|
},
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
}),
|
|
243
|
-
tickLabelComponent: /*#__PURE__*/React.createElement(VictoryLabel, {
|
|
244
|
-
x: this.isRTL ? props.offsetxaxis ? screenWidth - props.offsetxaxis - 30 : screenWidth - 80 : props.offsetxaxis || 50
|
|
245
|
-
}),
|
|
246
|
-
theme: this.state.theme,
|
|
247
|
-
tickFormat: (d, i, ticks) => {
|
|
248
|
-
if (getTickValueLabel) {
|
|
249
|
-
return getTickValueLabel(d, i, (ticks || []).length);
|
|
250
|
-
}
|
|
251
|
-
if (ynumberformat) {
|
|
252
|
-
return this.setYAxisFormat(d, ynumberformat);
|
|
253
|
-
}
|
|
254
|
-
return this.abbreviateNumber(d);
|
|
238
|
+
grid: {
|
|
239
|
+
x: swapAxes ? this.getGridLineTheme('y') : this.getGridLineTheme('x'),
|
|
240
|
+
y: swapAxes ? this.getGridLineTheme('x') : this.getGridLineTheme('y')
|
|
255
241
|
},
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
242
|
+
legend: {
|
|
243
|
+
textColor: (_this$styles$legendTe = this.styles.legendText) === null || _this$styles$legendTe === void 0 ? void 0 : _this$styles$legendTe.fill,
|
|
244
|
+
fontSize: (_this$styles$legendTe2 = this.styles.legendText) === null || _this$styles$legendTe2 === void 0 ? void 0 : _this$styles$legendTe2.fontSize,
|
|
245
|
+
backgroundColor: (_this$styles$legenedD = this.styles.legenedDot) === null || _this$styles$legenedD === void 0 ? void 0 : _this$styles$legenedD.backgroundColor
|
|
246
|
+
},
|
|
247
|
+
tooltip: this.getTooltipTheme(),
|
|
248
|
+
...(series ? {
|
|
249
|
+
series
|
|
250
|
+
} : {})
|
|
251
|
+
};
|
|
259
252
|
}
|
|
260
253
|
setTooltipTemplate(partialName) {
|
|
261
254
|
this.updateState({
|
|
@@ -312,10 +305,38 @@ export class BaseChartComponent extends BaseComponent {
|
|
|
312
305
|
style: this.styles.tooltipXText
|
|
313
306
|
}, yAxisData), this.renderPointer()) : null;
|
|
314
307
|
}
|
|
308
|
+
get hasCustomTooltip() {
|
|
309
|
+
return !!this.state.template && !!this.props.renderitempartial;
|
|
310
|
+
}
|
|
311
|
+
getRenderTooltip() {
|
|
312
|
+
if (!this.hasCustomTooltip) return undefined;
|
|
313
|
+
return params => {
|
|
314
|
+
var _this$props$renderite, _this$props$renderite2, _this$props;
|
|
315
|
+
const selectedItem = this.props.dataset[params.dataIndex];
|
|
316
|
+
return (_this$props$renderite = (_this$props$renderite2 = (_this$props = this.props).renderitempartial) === null || _this$props$renderite2 === void 0 ? void 0 : _this$props$renderite2.call(_this$props, {
|
|
317
|
+
...selectedItem,
|
|
318
|
+
index: params.dataIndex
|
|
319
|
+
}, params.dataIndex, this.state.template)) !== null && _this$props$renderite !== void 0 ? _this$props$renderite : null;
|
|
320
|
+
};
|
|
321
|
+
}
|
|
315
322
|
|
|
316
323
|
// X/Y Domain properties are supported only for Column and Area charts
|
|
317
324
|
isAxisDomainSupported(type) {
|
|
318
|
-
return type === 'Column'
|
|
325
|
+
// return type === 'Column'|| type === 'Area';
|
|
326
|
+
return type === 'Area';
|
|
327
|
+
}
|
|
328
|
+
getMinDomain() {
|
|
329
|
+
const props = this.state.props;
|
|
330
|
+
return {
|
|
331
|
+
x: props.xdomain === 'Min' ? this.state.chartMinX : 0,
|
|
332
|
+
y: props.ydomain === 'Min' ? this.state.chartMinY : 0
|
|
333
|
+
};
|
|
334
|
+
}
|
|
335
|
+
getSeriesSymbol(highlightpoints, ticksymbol) {
|
|
336
|
+
if (!highlightpoints || ticksymbol === 'none') {
|
|
337
|
+
return 'none';
|
|
338
|
+
}
|
|
339
|
+
return ticksymbol !== null && ticksymbol !== void 0 ? ticksymbol : 'circle';
|
|
319
340
|
}
|
|
320
341
|
|
|
321
342
|
// Check whether X/Y Domain was set to Min and is supported for the present chart
|
|
@@ -662,16 +683,16 @@ export class BaseChartComponent extends BaseComponent {
|
|
|
662
683
|
$new && this.prepareDataItems($new);
|
|
663
684
|
break;
|
|
664
685
|
case 'xaxislabel':
|
|
665
|
-
if (props.xunits) {
|
|
666
|
-
units = ' (' + props.xunits + ')';
|
|
686
|
+
if (this.props.xunits) {
|
|
687
|
+
units = ' (' + this.props.xunits + ')';
|
|
667
688
|
}
|
|
668
689
|
this.updateState({
|
|
669
690
|
xLabel: $new + units
|
|
670
691
|
});
|
|
671
692
|
break;
|
|
672
693
|
case 'yaxislabel':
|
|
673
|
-
if (props.yunits) {
|
|
674
|
-
units = ' (' + props.yunits + ')';
|
|
694
|
+
if (this.props.yunits) {
|
|
695
|
+
units = ' (' + this.props.yunits + ')';
|
|
675
696
|
}
|
|
676
697
|
this.updateState({
|
|
677
698
|
yLabel: $new + units
|