[GitHub] 100pah commented on a change in pull request #8997: Pie chart adds filterValue parameter
100pah commented on a change in pull request #8997: Pie chart adds filterValue parameter URL: https://github.com/apache/incubator-echarts/pull/8997#discussion_r229185836 ## File path: src/chart/pie/PieView.js ## @@ -319,7 +327,8 @@ var PieView = ChartView.extend({ ); var selectedMode = seriesModel.get('selectedMode'); - +var valueDim = data.mapDimension('value'); +data._sum = data.getSum(valueDim) || 0; Review comment: By convention, a property name prefixed by a single `'_'` represents a "private member" of a class. We should not add other that kind of properties (`_xxx`) outside the class definition dynamically. Otherwise, it probably confuses the code reader and might overwrite the inner private members with the same name. If we need to save the `sum` here, it's OK to save it to `this`, because in this module we have the legal control of `this`. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services - To unsubscribe, e-mail: dev-unsubscr...@echarts.apache.org For additional commands, e-mail: dev-h...@echarts.apache.org
[GitHub] 100pah commented on a change in pull request #8997: Pie chart adds filterValue parameter
100pah commented on a change in pull request #8997: Pie chart adds filterValue parameter URL: https://github.com/apache/incubator-echarts/pull/8997#discussion_r229185836 ## File path: src/chart/pie/PieView.js ## @@ -319,7 +327,8 @@ var PieView = ChartView.extend({ ); var selectedMode = seriesModel.get('selectedMode'); - +var valueDim = data.mapDimension('value'); +data._sum = data.getSum(valueDim) || 0; Review comment: By convention, a property name prefixed by a single `'_'` represents the property is a "private member" of an class. We should not add other that kind of properties (`_xxx`) outside the class definition dynamically. Otherwise, that probably confuse the code reader and might overwrite the inner private members with the same name. If we need save the `sum` here, it's OK to to save it to `this`, because in this module we have the legal control of `this`. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services - To unsubscribe, e-mail: dev-unsubscr...@echarts.apache.org For additional commands, e-mail: dev-h...@echarts.apache.org
[GitHub] 100pah commented on a change in pull request #8997: Pie chart adds filterValue parameter
100pah commented on a change in pull request #8997: Pie chart adds filterValue parameter URL: https://github.com/apache/incubator-echarts/pull/8997#discussion_r225533152 ## File path: src/chart/pie/PieView.js ## @@ -211,7 +211,20 @@ piePieceProto.updateData = function (data, idx, firstCreate) { graphic.setHoverStyle(this); }; -piePieceProto._updateLabel = function (data, idx) { +piePieceProto._getFilterIgnore = function(data, idx) { +var seriesModel = data.hostModel; +var itemModel = data.getItemModel(idx); +var valueDim = data.mapDimension('value'); +var sum = data.getSum(valueDim); +var filterValue = seriesModel.get('labelDisplayThreshold'); +var filterIgnore = false; +if (sum * filterValue.option > itemModel.option.value) { +filterIgnore = true; +} +return filterIgnore; Review comment: Just ```js return xxx * yyy > zzz; ``` This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services - To unsubscribe, e-mail: dev-unsubscr...@echarts.apache.org For additional commands, e-mail: dev-h...@echarts.apache.org
[GitHub] 100pah commented on a change in pull request #8997: Pie chart adds filterValue parameter
100pah commented on a change in pull request #8997: Pie chart adds filterValue parameter URL: https://github.com/apache/incubator-echarts/pull/8997#discussion_r225534419 ## File path: src/chart/pie/PieView.js ## @@ -211,7 +211,20 @@ piePieceProto.updateData = function (data, idx, firstCreate) { graphic.setHoverStyle(this); }; -piePieceProto._updateLabel = function (data, idx) { +piePieceProto._getFilterIgnore = function(data, idx) { +var seriesModel = data.hostModel; +var itemModel = data.getItemModel(idx); Review comment: create an `itemModel` is not necessary here (and should not fetch value from itemModel). Just using `data.get(valueDim, idx)` the get the value. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services - To unsubscribe, e-mail: dev-unsubscr...@echarts.apache.org For additional commands, e-mail: dev-h...@echarts.apache.org
[GitHub] 100pah commented on a change in pull request #8997: Pie chart adds filterValue parameter
100pah commented on a change in pull request #8997: Pie chart adds filterValue parameter URL: https://github.com/apache/incubator-echarts/pull/8997#discussion_r225531517 ## File path: src/chart/pie/PieView.js ## @@ -211,7 +211,20 @@ piePieceProto.updateData = function (data, idx, firstCreate) { graphic.setHoverStyle(this); }; -piePieceProto._updateLabel = function (data, idx) { +piePieceProto._getFilterIgnore = function(data, idx) { Review comment: (1) Code style: should be `function (data, idx)`, for anonymous function declaration. (2) Both `get`, `filter`, and `ignore` are verb. that makes the function name a bit strange. Should the name has some relationship with `labelDisplayThreshold`? This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services - To unsubscribe, e-mail: dev-unsubscr...@echarts.apache.org For additional commands, e-mail: dev-h...@echarts.apache.org
[GitHub] 100pah commented on a change in pull request #8997: Pie chart adds filterValue parameter
100pah commented on a change in pull request #8997: Pie chart adds filterValue parameter URL: https://github.com/apache/incubator-echarts/pull/8997#discussion_r225535214 ## File path: src/chart/pie/PieView.js ## @@ -211,7 +211,20 @@ piePieceProto.updateData = function (data, idx, firstCreate) { graphic.setHoverStyle(this); }; -piePieceProto._updateLabel = function (data, idx) { +piePieceProto._getFilterIgnore = function(data, idx) { +var seriesModel = data.hostModel; +var itemModel = data.getItemModel(idx); +var valueDim = data.mapDimension('value'); +var sum = data.getSum(valueDim); Review comment: The `sum` is not necessary to be calculated in each iteration of the loop. Only calculate it once outside the loop. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services - To unsubscribe, e-mail: dev-unsubscr...@echarts.apache.org For additional commands, e-mail: dev-h...@echarts.apache.org
[GitHub] 100pah commented on a change in pull request #8997: Pie chart adds filterValue parameter
100pah commented on a change in pull request #8997: Pie chart adds filterValue parameter URL: https://github.com/apache/incubator-echarts/pull/8997#discussion_r225532737 ## File path: src/chart/pie/PieView.js ## @@ -211,7 +211,20 @@ piePieceProto.updateData = function (data, idx, firstCreate) { graphic.setHoverStyle(this); }; -piePieceProto._updateLabel = function (data, idx) { +piePieceProto._getFilterIgnore = function(data, idx) { +var seriesModel = data.hostModel; +var itemModel = data.getItemModel(idx); +var valueDim = data.mapDimension('value'); +var sum = data.getSum(valueDim); +var filterValue = seriesModel.get('labelDisplayThreshold'); +var filterIgnore = false; +if (sum * filterValue.option > itemModel.option.value) { Review comment: does `seriesModel.get('labelDisplayThreshold')` returns an `object`? This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services - To unsubscribe, e-mail: dev-unsubscr...@echarts.apache.org For additional commands, e-mail: dev-h...@echarts.apache.org
[GitHub] 100pah commented on a change in pull request #8997: Pie chart adds filterValue parameter
100pah commented on a change in pull request #8997: Pie chart adds filterValue parameter URL: https://github.com/apache/incubator-echarts/pull/8997#discussion_r216170248 ## File path: src/chart/pie/PieView.js ## @@ -211,7 +211,20 @@ piePieceProto.updateData = function (data, idx, firstCreate) { graphic.setHoverStyle(this); }; -piePieceProto._updateLabel = function (data, idx) { +piePieceProto._getFilterIgnore = function(data, idx) { +var seriesModel = data.hostModel; +var itemModel = data.getItemModel(idx); +var valueDim = data.mapDimension('value'); +var sum = data.getSum(valueDim); +var filterValue = seriesModel.getModel('filterValue'); Review comment: // Should be var xxxValue = seriesModel.get('xxxValue'); This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services - To unsubscribe, e-mail: dev-unsubscr...@echarts.apache.org For additional commands, e-mail: dev-h...@echarts.apache.org