You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by GitBox <gi...@apache.org> on 2021/09/28 05:02:04 UTC
[GitHub] [echarts] quillblue commented on a change in pull request #15601: Add support for StreamGraph algorithm#14643
quillblue commented on a change in pull request #15601:
URL: https://github.com/apache/echarts/pull/15601#discussion_r717222040
##########
File path: src/chart/themeRiver/themeRiverLayout.ts
##########
@@ -128,38 +137,46 @@ function doThemeRiverLayout(data: SeriesData<ThemeRiverSeriesModel>, seriesModel
*
* @param data the points in each layer
*/
-function computeBaseline(data: number[][][]) {
- const layerNum = data.length;
- const pointNum = data[0].length;
- const sums = [];
- const y0 = [];
+ function computeBaseline(data: number[][][]) {
+ //console.log(data);
+ const layerNum = data.length;//6
+ const pointNum = data[0].length;//21
+ const sums = [];//sums of each vertical row at a single time point
+ const sums1 = [];
+ const y0_symmetric = [];
+ const y0_wiggle = [];
let max = 0;
for (let i = 0; i < pointNum; ++i) {
let temp = 0;
+ let temp1 = 0;
for (let j = 0; j < layerNum; ++j) {
temp += data[j][i][1];
+ temp1 += (layerNum-(j+1))*data[j][i][1];
}
if (temp > max) {
max = temp;
}
sums.push(temp);
+ sums1.push(temp1)
}
- for (let k = 0; k < pointNum; ++k) {
- y0[k] = (max - sums[k]) / 2;
+
+ for (let k = 0 ; k < pointNum; ++k) {
+ y0_symmetric[k] = (max-sums[k])/2
Review comment:
should it be `(max - sums[k]) / 2` ? (according to code style requirement of community)
##########
File path: src/chart/themeRiver/themeRiverLayout.ts
##########
@@ -128,38 +137,46 @@ function doThemeRiverLayout(data: SeriesData<ThemeRiverSeriesModel>, seriesModel
*
* @param data the points in each layer
*/
-function computeBaseline(data: number[][][]) {
- const layerNum = data.length;
- const pointNum = data[0].length;
- const sums = [];
- const y0 = [];
+ function computeBaseline(data: number[][][]) {
+ //console.log(data);
+ const layerNum = data.length;//6
+ const pointNum = data[0].length;//21
+ const sums = [];//sums of each vertical row at a single time point
+ const sums1 = [];
+ const y0_symmetric = [];
+ const y0_wiggle = [];
let max = 0;
for (let i = 0; i < pointNum; ++i) {
let temp = 0;
+ let temp1 = 0;
Review comment:
Considering optimize name `temp1` to indicate the meaning of this temp
##########
File path: src/chart/themeRiver/themeRiverLayout.ts
##########
@@ -95,7 +96,15 @@ function doThemeRiverLayout(data: SeriesData<ThemeRiverSeriesModel>, seriesModel
});
const base = computeBaseline(layerPoints);
- const baseLine = base.y0;
+ var baseLine;
+ if(drawMode == "symmetrical")
Review comment:
Coding style: [MUST] Place 1 space after `if` / `else` / `for` / `while` / `function` / `switch` / `do` / `try` / `catch` / `finally`.
Code smell: use `===` instead of `==` for strict requirement
##########
File path: src/chart/themeRiver/ThemeRiverSeries.ts
##########
@@ -69,6 +69,12 @@ export interface ThemeRiverSeriesOption extends SeriesOption<ThemeRiverStateOpti
* [date, value, name]
*/
data?: ThemerRiverDataItem[]
+
+ /**
+ * draw mode symmetrical or asymmetical
+ * default symmetrical
+ */
+ drawMode ?:"symmetrical"|"wiggle"
Review comment:
Coding Style: should it be `drawMode?: "symmetrical"|"wiggle"`?
##########
File path: src/chart/themeRiver/themeRiverLayout.ts
##########
@@ -128,38 +137,46 @@ function doThemeRiverLayout(data: SeriesData<ThemeRiverSeriesModel>, seriesModel
*
* @param data the points in each layer
*/
-function computeBaseline(data: number[][][]) {
- const layerNum = data.length;
- const pointNum = data[0].length;
- const sums = [];
- const y0 = [];
+ function computeBaseline(data: number[][][]) {
+ //console.log(data);
+ const layerNum = data.length;//6
Review comment:
What did this comment mean?
##########
File path: test/themeRiver.html
##########
@@ -88,6 +88,7 @@
shadowColor: 'rgba(0, 0, 0, 0.8)'
}
},
+ drawMode:"wiggle",
Review comment:
`drawMode: 'wiggle'`
##########
File path: src/chart/themeRiver/ThemeRiverSeries.ts
##########
@@ -134,7 +140,6 @@ class ThemeRiverSeriesModel extends SeriesModel<ThemeRiverSeriesOption> {
const timeValue = layerData[k].dataList[j][0] + '';
timeValueKeys[timeValue] = k;
}
-
Review comment:
[Code Style] remaining empty line here (according to Code Style requirement of community)
##########
File path: src/chart/themeRiver/themeRiverLayout.ts
##########
@@ -128,38 +137,46 @@ function doThemeRiverLayout(data: SeriesData<ThemeRiverSeriesModel>, seriesModel
*
* @param data the points in each layer
*/
-function computeBaseline(data: number[][][]) {
- const layerNum = data.length;
- const pointNum = data[0].length;
- const sums = [];
- const y0 = [];
+ function computeBaseline(data: number[][][]) {
+ //console.log(data);
Review comment:
Remove unused commented code
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org