PPRAMANIK62 commented on code in PR #21325:
URL: https://github.com/apache/echarts/pull/21325#discussion_r2456792819
##########
src/chart/helper/whiskerBoxCommon.ts:
##########
@@ -76,10 +76,37 @@ class WhiskerBoxCommonMixin<Opts extends CommonOption> {
const yAxisType = yAxisModel.get('type');
let addOrdinal;
- // FIXME
- // Consider time axis.
+ const encodeRules = this.getEncode();
+ const hasXEncode = encodeRules && encodeRules.get('x') != null;
+ const hasYEncode = encodeRules && encodeRules.get('y') != null;
+
+ if (hasXEncode && hasYEncode) {
+ const xEncode = encodeRules.get('x');
+ const yEncode = encodeRules.get('y');
+ const xIsArray = zrUtil.isArray(xEncode) && xEncode.length > 1;
+ const yIsArray = zrUtil.isArray(yEncode) && yEncode.length > 1;
- if (xAxisType === 'category') {
+ if (yIsArray && !xIsArray) {
+ option.layout = 'horizontal';
+ }
+ else if (xIsArray && !yIsArray) {
+ option.layout = 'vertical';
+ }
+ else if (xAxisType === 'category') {
+ option.layout = 'horizontal';
+ ordinalMeta = xAxisModel.getOrdinalMeta();
+ addOrdinal = !this._hasEncodeRule('x');
+ }
+ else if (yAxisType === 'category') {
+ option.layout = 'vertical';
+ ordinalMeta = yAxisModel.getOrdinalMeta();
+ addOrdinal = !this._hasEncodeRule('y');
+ }
+ else {
+ option.layout = option.layout || 'horizontal';
+ }
+ }
+ else if (xAxisType === 'category') {
Review Comment:
Thanks for this, it's actually a better solution.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]