visualifyjs 2.5.3-2.dev → 2.5.3-9-dev
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.
Potentially problematic release.
This version of visualifyjs might be problematic. Click here for more details.
- package/.github/workflows/{static.yml.bak → build.yaml} +51 -51
- package/LICENSE +674 -674
- package/README.md +40 -58
- package/config-overrides.js +31 -31
- package/dist/visualify.js +3 -3
- package/docs/CLI.md +15 -0
- package/docs/{docs/README.md → README.md} +41 -65
- package/docs/{docs/Rechart → Rechart}/bar.md +190 -190
- package/docs/{docs/Rechart → Rechart}/funnel.md +193 -241
- package/docs/{docs/Rechart → Rechart}/line.md +355 -355
- package/docs/{docs/Rechart → Rechart}/pie.md +225 -225
- package/docs/{docs/Rechart → Rechart}/radar.md +253 -253
- package/docs/{docs/_404.md → _404.md} +51 -51
- package/docs/{docs/_coverpage.md → _coverpage.md} +11 -11
- package/docs/{docs/_sidebar.md → _sidebar.md} +42 -44
- package/docs/{docs/components → components}/dotBio.md +34 -34
- package/docs/{docs/components → components}/echart.md +82 -82
- package/docs/{docs/components → components}/html.md +34 -34
- package/docs/{docs/components → components}/macaron.md +145 -145
- package/docs/components/markdown.md +0 -0
- package/docs/{docs/components → components}/more.md +142 -142
- package/docs/{docs/components → components}/plotly.md +62 -62
- package/docs/{docs/components → components}/scatterL.md +70 -70
- package/docs/{docs/components → components}/visium.md +56 -56
- package/docs/{docs/configuration.md → configuration.md} +123 -121
- package/docs/{docs/deploy.md → deploy.md} +23 -31
- package/docs/index.html +70 -70
- package/docs/log.md +1 -0
- package/docs/manifest.json +23 -23
- package/docs/{docs/more-pages.md → more-pages.md} +23 -23
- package/docs/{docs/quickstart.md → quickstart.md} +115 -124
- package/docs/{docs/rechart-attributes.md → rechart-attributes.md} +74 -74
- package/docs/{docs/rechart-basic-usage.md → rechart-basic-usage.md} +162 -162
- package/docs/static/css/fluff-stuff.css +169 -169
- package/docs/static/css/font-awesome.min.css +4 -4
- package/docs/static/css/visualify.css +25 -25
- package/docs/static/js/configuration.js +448 -448
- package/docs/static/js/visualify.js +24 -23
- package/docs/theme.md +3 -0
- package/package.json +74 -83
- package/rollup.config.mjs +75 -75
- package/src/_css/404.css +115 -115
- package/src/_css/App.css +37 -37
- package/src/_css/autoSuggestion.css +26 -26
- package/src/_css/circular-progress.css +32 -32
- package/src/_css/index.css +36 -36
- package/src/_css/modern.css +24 -24
- package/src/_media/corner.svg +8 -8
- package/src/_media/download.svg +3 -3
- package/src/_media/logo.svg +14 -14
- package/src/_test/App.test.js +15 -15
- package/src/_utils/reportWebVitals.js +13 -13
- package/src/core/appContext.js +27 -27
- package/src/core/components/Scatter.js +188 -188
- package/src/core/components/ScatterBio.js +572 -572
- package/src/core/components/VisiumPlot.js +165 -165
- package/src/core/components/browser.js +42 -42
- package/src/core/components/dotplot.js +413 -413
- package/src/core/components/html.js +29 -29
- package/src/core/components/list.js +178 -178
- package/src/core/components/macaron.js +201 -201
- package/src/core/components/markdown.js +56 -56
- package/src/core/components/parser.scatterBio.js +579 -587
- package/src/core/components/ratio.js +80 -80
- package/src/core/components/scatterL.js +173 -173
- package/src/core/components/searchbar.js +131 -131
- package/src/core/components/selection.js +193 -193
- package/src/core/components/timeline.js +281 -281
- package/src/core/components/visium.js +97 -97
- package/src/core/fetch/condfetch.js +82 -82
- package/src/core/fetch/fetch.js +92 -92
- package/src/core/fetch/json.js +29 -29
- package/src/core/fetch/vfetch.js +42 -42
- package/src/core/liveEditor.js +44 -44
- package/src/core/modules/codeEditorWithPreview.js +104 -104
- package/src/core/modules/echarts/common.js +20 -20
- package/src/core/modules/echarts/presetHandler.js +41 -41
- package/src/core/modules/echarts/presets/esodev.chromium.js +172 -172
- package/src/core/modules/echarts/presets/esodev.codex.js +130 -130
- package/src/core/modules/echarts/presets/esodev.visium.js +123 -123
- package/src/core/modules/echarts/presets/mmtrbc.js +186 -186
- package/src/core/modules/echarts.js +71 -71
- package/src/core/modules/echartsUtils.js +43 -43
- package/src/core/modules/echartswitcher.js +152 -152
- package/src/core/modules/replotly/presetHandler.js +24 -24
- package/src/core/modules/replotly/presets/minimum.js +18 -18
- package/src/core/modules/replotly/presets/mmtrbc.dot.js +114 -114
- package/src/core/modules/replotly/presets/mmtrbc.violin.js +100 -100
- package/src/core/modules/replotly.js +71 -71
- package/src/core/pages/404.js +50 -50
- package/src/core/pages/error.js +27 -27
- package/src/core/pages/jsonPage.js +62 -62
- package/src/core/pages/loading.js +44 -44
- package/src/core/parser/echart.data.js +183 -183
- package/src/core/parser/echart.features.js +125 -125
- package/src/core/parser/echart.general.js +143 -147
- package/src/core/parser/echart.hilbert.js +57 -57
- package/src/core/parser/echart.parser.js +210 -210
- package/src/core/parser/echart.series.js +67 -67
- package/src/core/parser/echart.types.js +76 -76
- package/src/core/parser/plotly.config.js +10 -10
- package/src/core/parser/plotly.data.js +132 -132
- package/src/core/parser/plotly.layout.js +9 -9
- package/src/core/parser/plotly.violin.js +18 -18
- package/src/core/recharts.js +62 -62
- package/src/core/router/alias.js +49 -49
- package/src/core/router/jsonRouter.js +31 -31
- package/src/core/themes/modern.js +32 -32
- package/src/core/themes/themeSelector.js +33 -33
- package/src/core/visualify.js +47 -47
- package/src/core/widgets/circularProgress.js +23 -23
- package/src/core/widgets/controller.js +83 -83
- package/src/core/widgets/errorBoundary.js +36 -36
- package/src/core/widgets/footer.js +177 -177
- package/src/core/widgets/header.js +234 -234
- package/src/core/widgets/layout/Grid.js +31 -31
- package/src/core/widgets/layout.js +36 -36
- package/src/core/widgets/mapping.js +42 -42
- package/src/index.js +62 -62
- package/src/setupTests.js +5 -5
- package/docs/docs/CLI.md +0 -34
- package/docs/docs/Rechart/scatter.md +0 -298
- package/docs/docs/log.md +0 -9
- package/docs/docs/static/logo/favicon.ico +0 -0
- package/docs/docs/static/logo/logo_128x128.png +0 -0
- package/docs/docs/static/logo/logo_192x192.png +0 -0
- package/docs/docs/static/logo/logo_256x256.png +0 -0
- package/docs/docs/static/logo/logo_512x512.png +0 -0
- package/docs/docs/static/logo/logo_64x64.png +0 -0
- package/docs/docs/theme.md +0 -5
- /package/docs/{docs/Rechart → Rechart}/geo.md +0 -0
- /package/docs/{docs/Rechart → Rechart}/liquidfill.md +0 -0
- /package/docs/{docs/Rechart → Rechart}/polar.md +0 -0
- /package/docs/{docs/Rechart → Rechart}/sankey.md +0 -0
- /package/docs/{docs/Rechart/sunburst.md → Rechart/scatter.md} +0 -0
- /package/docs/{docs/Rechart/tree.md → Rechart/sunburst.md} +0 -0
- /package/docs/{docs/Rechart/wordcloud.md → Rechart/tree.md} +0 -0
- /package/docs/{docs/components/markdown.md → Rechart/wordcloud.md} +0 -0
- /package/docs/{docs/static → static}/_images/deploy-github-pages.png +0 -0
@@ -1,125 +1,125 @@
|
|
1
|
-
/*
|
2
|
-
* @Author : Lihao leolihao@arizona.edu
|
3
|
-
* @Date : 2023-12-03 13:01:48
|
4
|
-
* @FilePath : /visualifyjs/src/core/parser/echart.features.js
|
5
|
-
* @Description :
|
6
|
-
* Copyright (c) 2023 by Lihao (leolihao@arizona.edu), All Rights Reserved.
|
7
|
-
*/
|
8
|
-
|
9
|
-
export function _parsePeakvalley(options, seriesObject) {
|
10
|
-
if (options.valley || options.peak) {
|
11
|
-
seriesObject.markPoint = {};
|
12
|
-
seriesObject.markPoint.data = [];
|
13
|
-
if (options.peak) {
|
14
|
-
seriesObject.markPoint.data.push({
|
15
|
-
type: 'max',
|
16
|
-
name: 'Max',
|
17
|
-
label: {
|
18
|
-
formatter:
|
19
|
-
typeof options.peak === 'string' ? options.peak : 'Max',
|
20
|
-
},
|
21
|
-
});
|
22
|
-
}
|
23
|
-
if (options.valley) {
|
24
|
-
seriesObject.markPoint.data.push({
|
25
|
-
type: 'min',
|
26
|
-
name: 'Min',
|
27
|
-
label: {
|
28
|
-
formatter:
|
29
|
-
typeof options.valley === 'string'
|
30
|
-
? options.valley
|
31
|
-
: 'Min',
|
32
|
-
},
|
33
|
-
});
|
34
|
-
}
|
35
|
-
}
|
36
|
-
}
|
37
|
-
|
38
|
-
export function _parseMarkArea(markAreaOption, seriesIndex) {
|
39
|
-
const markAreaOptions = {};
|
40
|
-
|
41
|
-
const formatAreaData = (option) => {
|
42
|
-
let areas = [];
|
43
|
-
|
44
|
-
const processAxis = (axisData, axisName) => {
|
45
|
-
if (Array.isArray(axisData)) {
|
46
|
-
axisData.forEach((data) =>
|
47
|
-
areas.push([
|
48
|
-
{ [axisName]: data.start, name: data.name },
|
49
|
-
{ [axisName]: data.end },
|
50
|
-
]),
|
51
|
-
);
|
52
|
-
} else {
|
53
|
-
areas.push([
|
54
|
-
{ [axisName]: axisData.start, name: axisData.name },
|
55
|
-
{ [axisName]: axisData.end },
|
56
|
-
]);
|
57
|
-
}
|
58
|
-
};
|
59
|
-
|
60
|
-
if (option.xAxis) {
|
61
|
-
processAxis(option.xAxis, 'xAxis');
|
62
|
-
}
|
63
|
-
if (option.yAxis) {
|
64
|
-
processAxis(option.yAxis, 'yAxis');
|
65
|
-
}
|
66
|
-
|
67
|
-
return areas;
|
68
|
-
};
|
69
|
-
|
70
|
-
let areaData = [];
|
71
|
-
let selectedOption =
|
72
|
-
Array.isArray(markAreaOption) && seriesIndex < markAreaOption.length
|
73
|
-
? markAreaOption[seriesIndex]
|
74
|
-
: markAreaOption;
|
75
|
-
|
76
|
-
areaData = formatAreaData(selectedOption);
|
77
|
-
markAreaOptions.data = areaData;
|
78
|
-
|
79
|
-
// Add emphasis and other additional properties
|
80
|
-
Object.keys(selectedOption).forEach((key) => {
|
81
|
-
if (key === 'data') {
|
82
|
-
markAreaOptions[key] = markAreaOptions[key].concat(
|
83
|
-
selectedOption[key],
|
84
|
-
);
|
85
|
-
} else if (key !== 'xAxis' && key !== 'yAxis') {
|
86
|
-
markAreaOptions[key] = selectedOption[key];
|
87
|
-
}
|
88
|
-
});
|
89
|
-
|
90
|
-
return markAreaOptions;
|
91
|
-
}
|
92
|
-
|
93
|
-
export function _parseMarkLine(markLineOption, seriesIndex) {
|
94
|
-
const markLineOptions = {};
|
95
|
-
|
96
|
-
let selectedOption =
|
97
|
-
Array.isArray(markLineOption) && seriesIndex < markLineOption.length
|
98
|
-
? markLineOption[seriesIndex]
|
99
|
-
: markLineOption;
|
100
|
-
|
101
|
-
markLineOptions.emphasis = {
|
102
|
-
lineStyle: {
|
103
|
-
width: 5,
|
104
|
-
type: 'solid',
|
105
|
-
},
|
106
|
-
};
|
107
|
-
|
108
|
-
markLineOptions.blur = {
|
109
|
-
lineStyle: {
|
110
|
-
opacity: 0.5, // Example blur style
|
111
|
-
},
|
112
|
-
};
|
113
|
-
|
114
|
-
markLineOptions.lineStyle = {
|
115
|
-
type: 'dashed', // 'solid','dashed'
|
116
|
-
width: 3,
|
117
|
-
};
|
118
|
-
|
119
|
-
// Add additional properties from markLineOption
|
120
|
-
Object.keys(selectedOption).forEach((key) => {
|
121
|
-
markLineOptions[key] = selectedOption[key];
|
122
|
-
});
|
123
|
-
|
124
|
-
return markLineOptions;
|
125
|
-
}
|
1
|
+
/*
|
2
|
+
* @Author : Lihao leolihao@arizona.edu
|
3
|
+
* @Date : 2023-12-03 13:01:48
|
4
|
+
* @FilePath : /visualifyjs/src/core/parser/echart.features.js
|
5
|
+
* @Description :
|
6
|
+
* Copyright (c) 2023 by Lihao (leolihao@arizona.edu), All Rights Reserved.
|
7
|
+
*/
|
8
|
+
|
9
|
+
export function _parsePeakvalley(options, seriesObject) {
|
10
|
+
if (options.valley || options.peak) {
|
11
|
+
seriesObject.markPoint = {};
|
12
|
+
seriesObject.markPoint.data = [];
|
13
|
+
if (options.peak) {
|
14
|
+
seriesObject.markPoint.data.push({
|
15
|
+
type: 'max',
|
16
|
+
name: 'Max',
|
17
|
+
label: {
|
18
|
+
formatter:
|
19
|
+
typeof options.peak === 'string' ? options.peak : 'Max',
|
20
|
+
},
|
21
|
+
});
|
22
|
+
}
|
23
|
+
if (options.valley) {
|
24
|
+
seriesObject.markPoint.data.push({
|
25
|
+
type: 'min',
|
26
|
+
name: 'Min',
|
27
|
+
label: {
|
28
|
+
formatter:
|
29
|
+
typeof options.valley === 'string'
|
30
|
+
? options.valley
|
31
|
+
: 'Min',
|
32
|
+
},
|
33
|
+
});
|
34
|
+
}
|
35
|
+
}
|
36
|
+
}
|
37
|
+
|
38
|
+
export function _parseMarkArea(markAreaOption, seriesIndex) {
|
39
|
+
const markAreaOptions = {};
|
40
|
+
|
41
|
+
const formatAreaData = (option) => {
|
42
|
+
let areas = [];
|
43
|
+
|
44
|
+
const processAxis = (axisData, axisName) => {
|
45
|
+
if (Array.isArray(axisData)) {
|
46
|
+
axisData.forEach((data) =>
|
47
|
+
areas.push([
|
48
|
+
{ [axisName]: data.start, name: data.name },
|
49
|
+
{ [axisName]: data.end },
|
50
|
+
]),
|
51
|
+
);
|
52
|
+
} else {
|
53
|
+
areas.push([
|
54
|
+
{ [axisName]: axisData.start, name: axisData.name },
|
55
|
+
{ [axisName]: axisData.end },
|
56
|
+
]);
|
57
|
+
}
|
58
|
+
};
|
59
|
+
|
60
|
+
if (option.xAxis) {
|
61
|
+
processAxis(option.xAxis, 'xAxis');
|
62
|
+
}
|
63
|
+
if (option.yAxis) {
|
64
|
+
processAxis(option.yAxis, 'yAxis');
|
65
|
+
}
|
66
|
+
|
67
|
+
return areas;
|
68
|
+
};
|
69
|
+
|
70
|
+
let areaData = [];
|
71
|
+
let selectedOption =
|
72
|
+
Array.isArray(markAreaOption) && seriesIndex < markAreaOption.length
|
73
|
+
? markAreaOption[seriesIndex]
|
74
|
+
: markAreaOption;
|
75
|
+
|
76
|
+
areaData = formatAreaData(selectedOption);
|
77
|
+
markAreaOptions.data = areaData;
|
78
|
+
|
79
|
+
// Add emphasis and other additional properties
|
80
|
+
Object.keys(selectedOption).forEach((key) => {
|
81
|
+
if (key === 'data') {
|
82
|
+
markAreaOptions[key] = markAreaOptions[key].concat(
|
83
|
+
selectedOption[key],
|
84
|
+
);
|
85
|
+
} else if (key !== 'xAxis' && key !== 'yAxis') {
|
86
|
+
markAreaOptions[key] = selectedOption[key];
|
87
|
+
}
|
88
|
+
});
|
89
|
+
|
90
|
+
return markAreaOptions;
|
91
|
+
}
|
92
|
+
|
93
|
+
export function _parseMarkLine(markLineOption, seriesIndex) {
|
94
|
+
const markLineOptions = {};
|
95
|
+
|
96
|
+
let selectedOption =
|
97
|
+
Array.isArray(markLineOption) && seriesIndex < markLineOption.length
|
98
|
+
? markLineOption[seriesIndex]
|
99
|
+
: markLineOption;
|
100
|
+
|
101
|
+
markLineOptions.emphasis = {
|
102
|
+
lineStyle: {
|
103
|
+
width: 5,
|
104
|
+
type: 'solid',
|
105
|
+
},
|
106
|
+
};
|
107
|
+
|
108
|
+
markLineOptions.blur = {
|
109
|
+
lineStyle: {
|
110
|
+
opacity: 0.5, // Example blur style
|
111
|
+
},
|
112
|
+
};
|
113
|
+
|
114
|
+
markLineOptions.lineStyle = {
|
115
|
+
type: 'dashed', // 'solid','dashed'
|
116
|
+
width: 3,
|
117
|
+
};
|
118
|
+
|
119
|
+
// Add additional properties from markLineOption
|
120
|
+
Object.keys(selectedOption).forEach((key) => {
|
121
|
+
markLineOptions[key] = selectedOption[key];
|
122
|
+
});
|
123
|
+
|
124
|
+
return markLineOptions;
|
125
|
+
}
|
@@ -1,147 +1,143 @@
|
|
1
|
-
/*
|
2
|
-
* @Author : Lihao leolihao@arizona.edu
|
3
|
-
* @Date : 2023-12-02 11:56:41
|
4
|
-
* @FilePath : /
|
5
|
-
* @Description :
|
6
|
-
*
|
7
|
-
* Copyright (c) 2023 by Lihao (leolihao@arizona.edu), All Rights Reserved.
|
8
|
-
*/
|
9
|
-
import { handle_alltypes_chart } from './echart.types';
|
10
|
-
import { getArrayEl } from './echart.series';
|
11
|
-
|
12
|
-
const _parser_gereral = (options = {}, preset = {}) => {
|
13
|
-
// Parse the custom options
|
14
|
-
const parsedOptions = handle_alltypes_chart(getArrayEl(options.type), {
|
15
|
-
...preset,
|
16
|
-
});
|
17
|
-
|
18
|
-
// Parse the common options
|
19
|
-
if ('title' in options) {
|
20
|
-
if (typeof options.title === 'string')
|
21
|
-
parsedOptions.title = {
|
22
|
-
...parsedOptions?.title,
|
23
|
-
text: options.title,
|
24
|
-
};
|
25
|
-
else parsedOptions.title = options.title;
|
26
|
-
}
|
27
|
-
|
28
|
-
if ('subtitle' in options) parsedOptions.title.subtext = options.subtitle;
|
29
|
-
|
30
|
-
if (options.legend === false) parsedOptions.legend = { show: false };
|
31
|
-
else if ('legend' in options)
|
32
|
-
parsedOptions.legend = { ...options.legend, ...options.legend };
|
33
|
-
|
34
|
-
if ('xAxis' in options) {
|
35
|
-
if (options.xAxis === false) parsedOptions.xAxis = { show: false };
|
36
|
-
else if (
|
37
|
-
parsedOptions.xAxis = {
|
38
|
-
...parsedOptions?.xAxis,
|
39
|
-
data: options.xAxis,
|
40
|
-
};
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
return parsedOptions;
|
145
|
-
};
|
146
|
-
|
147
|
-
export default _parser_gereral;
|
1
|
+
/*
|
2
|
+
* @Author : Lihao leolihao@arizona.edu
|
3
|
+
* @Date : 2023-12-02 11:56:41
|
4
|
+
* @FilePath : /visualifyjs/src/core/parser/echart.general.js
|
5
|
+
* @Description :
|
6
|
+
*
|
7
|
+
* Copyright (c) 2023 by Lihao (leolihao@arizona.edu), All Rights Reserved.
|
8
|
+
*/
|
9
|
+
import { handle_alltypes_chart } from './echart.types';
|
10
|
+
import { getArrayEl } from './echart.series';
|
11
|
+
|
12
|
+
const _parser_gereral = (options = {}, preset = {}) => {
|
13
|
+
// Parse the custom options
|
14
|
+
const parsedOptions = handle_alltypes_chart(getArrayEl(options.type), {
|
15
|
+
...preset,
|
16
|
+
});
|
17
|
+
|
18
|
+
// Parse the common options
|
19
|
+
if ('title' in options) {
|
20
|
+
if (typeof options.title === 'string')
|
21
|
+
parsedOptions.title = {
|
22
|
+
...parsedOptions?.title,
|
23
|
+
text: options.title,
|
24
|
+
};
|
25
|
+
else parsedOptions.title = options.title;
|
26
|
+
}
|
27
|
+
|
28
|
+
if ('subtitle' in options) parsedOptions.title.subtext = options.subtitle;
|
29
|
+
|
30
|
+
if (options.legend === false) parsedOptions.legend = { show: false };
|
31
|
+
else if ('legend' in options)
|
32
|
+
parsedOptions.legend = { ...options.legend, ...options.legend };
|
33
|
+
|
34
|
+
if ('xAxis' in options) {
|
35
|
+
if (options.xAxis === false) parsedOptions.xAxis = { show: false };
|
36
|
+
else if (options.xAxis)
|
37
|
+
parsedOptions.xAxis = {
|
38
|
+
...parsedOptions?.xAxis,
|
39
|
+
data: options.xAxis,
|
40
|
+
};
|
41
|
+
}
|
42
|
+
|
43
|
+
if ('yAxis' in options) {
|
44
|
+
if (options.yAxis === false) parsedOptions.yAxis = { show: false };
|
45
|
+
else if (Array.isArray(options.yAxis))
|
46
|
+
parsedOptions.yAxis = {
|
47
|
+
...parsedOptions?.yAxis,
|
48
|
+
data: options.yAxis,
|
49
|
+
};
|
50
|
+
}
|
51
|
+
|
52
|
+
if ('xAxisLabel' in options) {
|
53
|
+
parsedOptions.xAxis = {
|
54
|
+
...parsedOptions?.xAxis,
|
55
|
+
name: options.xAxisLabel,
|
56
|
+
};
|
57
|
+
}
|
58
|
+
|
59
|
+
if ('yAxisLabel' in options) {
|
60
|
+
parsedOptions.yAxis = {
|
61
|
+
...parsedOptions?.yAxis,
|
62
|
+
name: options.yAxisLabel,
|
63
|
+
};
|
64
|
+
}
|
65
|
+
|
66
|
+
if ('xAxisLineshow' in options) {
|
67
|
+
parsedOptions.xAxis = {
|
68
|
+
...parsedOptions?.xAxis,
|
69
|
+
axisLine: {
|
70
|
+
...parsedOptions.xAxis?.axisLine,
|
71
|
+
show: options.xAxisLineshow,
|
72
|
+
},
|
73
|
+
};
|
74
|
+
}
|
75
|
+
|
76
|
+
if ('yAxisLineshow' in options) {
|
77
|
+
parsedOptions.yAxis = {
|
78
|
+
...parsedOptions?.yAxis,
|
79
|
+
axisLine: {
|
80
|
+
...parsedOptions.yAxis?.axisLine,
|
81
|
+
show: options.yAxisLineshow,
|
82
|
+
},
|
83
|
+
};
|
84
|
+
}
|
85
|
+
|
86
|
+
if ('xAxisLabelShow' in options) {
|
87
|
+
parsedOptions.xAxis = {
|
88
|
+
...parsedOptions?.xAxis,
|
89
|
+
axisLabel: {
|
90
|
+
...parsedOptions.xAxis?.axisLabel,
|
91
|
+
show: options.xAxisLabelShow,
|
92
|
+
},
|
93
|
+
};
|
94
|
+
}
|
95
|
+
|
96
|
+
if ('yAxisLabelShow' in options) {
|
97
|
+
parsedOptions.yAxis = {
|
98
|
+
...parsedOptions.yAxis,
|
99
|
+
axisLabel: {
|
100
|
+
...parsedOptions.yAxis?.axisLabel,
|
101
|
+
show: options.yAxisLabelShow,
|
102
|
+
},
|
103
|
+
};
|
104
|
+
}
|
105
|
+
|
106
|
+
if ('xAxisLabelColor' in options) {
|
107
|
+
parsedOptions.xAxis = {
|
108
|
+
...parsedOptions?.xAxis, // Copy existing xAxis properties
|
109
|
+
axisLabel: {
|
110
|
+
...parsedOptions.xAxis?.axisLabel, // Copy existing axisLabel properties
|
111
|
+
color: options.xAxisLabelColor,
|
112
|
+
},
|
113
|
+
};
|
114
|
+
}
|
115
|
+
|
116
|
+
if ('yAxisLabelColor' in options) {
|
117
|
+
parsedOptions.yAxis = {
|
118
|
+
...parsedOptions?.yAxis, // Copy existing yAxis properties
|
119
|
+
axisLabel: {
|
120
|
+
...parsedOptions.yAxis?.axisLabel, // Copy existing axisLabel properties
|
121
|
+
color: options.yAxisLabelColor,
|
122
|
+
},
|
123
|
+
};
|
124
|
+
}
|
125
|
+
|
126
|
+
if ('tooltip' in options) {
|
127
|
+
parsedOptions.tooltip = {
|
128
|
+
...parsedOptions?.tooltip,
|
129
|
+
...options.tooltip,
|
130
|
+
};
|
131
|
+
}
|
132
|
+
|
133
|
+
if ('toolbox' in options) {
|
134
|
+
parsedOptions.toolbox = {
|
135
|
+
...parsedOptions?.toolbox,
|
136
|
+
...options.toolbox,
|
137
|
+
};
|
138
|
+
}
|
139
|
+
|
140
|
+
return parsedOptions;
|
141
|
+
};
|
142
|
+
|
143
|
+
export default _parser_gereral;
|
@@ -1,57 +1,57 @@
|
|
1
|
-
import hilbert from 'hilbert';
|
2
|
-
|
3
|
-
const selectPointsForDownsampling = (
|
4
|
-
points,
|
5
|
-
hilbertValues,
|
6
|
-
threshold = 1000,
|
7
|
-
) => {
|
8
|
-
// Pair each point with its Hilbert value
|
9
|
-
const pointsWithHilbert = points.map((point, index) => ({
|
10
|
-
point,
|
11
|
-
hilbert: hilbertValues[index],
|
12
|
-
}));
|
13
|
-
|
14
|
-
// Sort by Hilbert value
|
15
|
-
pointsWithHilbert.sort((a, b) => a.hilbert - b.hilbert);
|
16
|
-
|
17
|
-
// Calculate the step size to achieve the target number of points
|
18
|
-
const step = Math.ceil(points.length / threshold);
|
19
|
-
|
20
|
-
// Select a subset of points
|
21
|
-
const downsampled = [];
|
22
|
-
for (let i = 0; i < points.length; i += step) {
|
23
|
-
downsampled.push(pointsWithHilbert[i].point);
|
24
|
-
}
|
25
|
-
|
26
|
-
return downsampled;
|
27
|
-
};
|
28
|
-
|
29
|
-
const calculateHilbertValue = (point, order = 16) => {
|
30
|
-
// Create a Hilbert curve instance
|
31
|
-
const hilbertInstance = new hilbert.Hilbert2d(); // Replace with the actual class name if different
|
32
|
-
return hilbertInstance.xy2d(point.x, point.y, order);
|
33
|
-
};
|
34
|
-
|
35
|
-
const downsampleSeries = (series, hilbertSettings) => {
|
36
|
-
const { order = 16, threshold } = hilbertSettings;
|
37
|
-
|
38
|
-
const downsampledSeries = series.map((data) => {
|
39
|
-
const hilbertValues = data.data.map((point) =>
|
40
|
-
calculateHilbertValue(point, order),
|
41
|
-
);
|
42
|
-
const downsampledData = selectPointsForDownsampling(
|
43
|
-
data.data,
|
44
|
-
hilbertValues,
|
45
|
-
threshold,
|
46
|
-
);
|
47
|
-
|
48
|
-
return {
|
49
|
-
...data,
|
50
|
-
data: downsampledData,
|
51
|
-
};
|
52
|
-
});
|
53
|
-
|
54
|
-
return downsampledSeries;
|
55
|
-
};
|
56
|
-
|
57
|
-
export default downsampleSeries;
|
1
|
+
import hilbert from 'hilbert';
|
2
|
+
|
3
|
+
const selectPointsForDownsampling = (
|
4
|
+
points,
|
5
|
+
hilbertValues,
|
6
|
+
threshold = 1000,
|
7
|
+
) => {
|
8
|
+
// Pair each point with its Hilbert value
|
9
|
+
const pointsWithHilbert = points.map((point, index) => ({
|
10
|
+
point,
|
11
|
+
hilbert: hilbertValues[index],
|
12
|
+
}));
|
13
|
+
|
14
|
+
// Sort by Hilbert value
|
15
|
+
pointsWithHilbert.sort((a, b) => a.hilbert - b.hilbert);
|
16
|
+
|
17
|
+
// Calculate the step size to achieve the target number of points
|
18
|
+
const step = Math.ceil(points.length / threshold);
|
19
|
+
|
20
|
+
// Select a subset of points
|
21
|
+
const downsampled = [];
|
22
|
+
for (let i = 0; i < points.length; i += step) {
|
23
|
+
downsampled.push(pointsWithHilbert[i].point);
|
24
|
+
}
|
25
|
+
|
26
|
+
return downsampled;
|
27
|
+
};
|
28
|
+
|
29
|
+
const calculateHilbertValue = (point, order = 16) => {
|
30
|
+
// Create a Hilbert curve instance
|
31
|
+
const hilbertInstance = new hilbert.Hilbert2d(); // Replace with the actual class name if different
|
32
|
+
return hilbertInstance.xy2d(point.x, point.y, order);
|
33
|
+
};
|
34
|
+
|
35
|
+
const downsampleSeries = (series, hilbertSettings) => {
|
36
|
+
const { order = 16, threshold } = hilbertSettings;
|
37
|
+
|
38
|
+
const downsampledSeries = series.map((data) => {
|
39
|
+
const hilbertValues = data.data.map((point) =>
|
40
|
+
calculateHilbertValue(point, order),
|
41
|
+
);
|
42
|
+
const downsampledData = selectPointsForDownsampling(
|
43
|
+
data.data,
|
44
|
+
hilbertValues,
|
45
|
+
threshold,
|
46
|
+
);
|
47
|
+
|
48
|
+
return {
|
49
|
+
...data,
|
50
|
+
data: downsampledData,
|
51
|
+
};
|
52
|
+
});
|
53
|
+
|
54
|
+
return downsampledSeries;
|
55
|
+
};
|
56
|
+
|
57
|
+
export default downsampleSeries;
|