You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by "jonoshearman (via GitHub)" <gi...@apache.org> on 2024/09/04 22:36:46 UTC
[I] [Bug] boxplot.encode does not get respected when used with category axis and series.data [echarts]
jonoshearman opened a new issue, #20319:
URL: https://github.com/apache/echarts/issues/20319
### Version
5.5.1
### Link to Minimal Reproduction
https://echarts.apache.org/examples/en/editor.html?c=line-simple&version=5.5.1&code=PYBwLglsB2AEC8sDeAoWsDmAnCATAXLANpKwBGwYYwAtoQOQBsjApPbAL4A0ys1IDACwAGNjwpVaQ0e27J-DZmw4BdLmj7BgAG0gDkG9GBwYMAUywMAhgA8IAZ3obuG7WfPQCxJKvXobAIJ29oREhgbokXwAniBmDJA0ZvR-UZg4uACSnmY2hMKpUdBWSQwAKpkAsgCiAQAamQDKKeEuUahpMXEMAG5W2gCuyYWR2HjZuLmEAIwj6MWlsPQAagEAMgCqtQ3NI22RHWlgsfFLAMZWYO7AWNEtnWNZOXmwAExzsAun9ADCAWXVADiAHkAEoATXqTXukQ4GjUGmiQQcoXChyijwmU1gBVaI3RowyWJeszxaPC6Exz0I71a8NSuEuVnsZjAoUO9mAAywZ1OYU66CI0wKbxFAGYRSIeABWEX0GDJBEC4hisU8MUADnVAE4eFLYNLpTx6AAzLlYehKgVEfWCI0GkXS96wZjGsAACywZkVFNgKmcVpZODMIWI5M6XwSECStgcMKix26SwoNhA2ko8ciZCsWAA6ngPQwJZn0GZoGdgJNCKQXiLoqFZm91XqZSpOB9GWArKjlUKncIxf3hMPhzxhTxXuLJY7hFbOn3J8xXhqR6PYKr1Vr17rYPrDXO0gvhNqAOxixir6d6-2ymXO5j-zqP2H432RpZ9QZmWOOD6J74pmmGYfNmeYFu6RbCCWsCBMExIzB8SJwdSsCkp0ZYVlWvC1jw9bEI2zpqrurbtr6nbdmGva3qhIqTuqV4OgeURCmuG7rluYo7nu0pMZEfYMXaMqOvejDPlEYmke0b4lN8FxXBgNzRD-sADPYEDQBgsBBhAIYAHTkbAAAUZBYMAADWZYAJTQf-DCAemYDQaB-a4IWSzFh8sEOPBTa-kh3kobS6Hl
pWpw1oQ9p4UQIoEc2u5tvsUTkT21rjqK9F6jOxoKpaHyCmxmo6plMr2qa5q5b6gq2jewk8K6Swel6PpPmSUkRjJDBydctzKap6maeRLJgEZADuNxmf11l_icdnAKmDlOTmLlufQHm-l59g-UFaT-ZtgUfBhoXVjBEW4aEMUTnFggJR2TJDfBuJRHC6D-hwADcQA
### Steps to Reproduce
as in the example, data values are set in series.data and series.encode contains rules for x/y axis where x is a category axis.
### Current Behavior
the boxplot series will be created using the first 5 available dimensions ignoring the encode rules.
The axis will show integer numbers instead of the category values.

### Expected Behavior
encoding rules should be respected and the category values be used instead of the category index:

### Environment
```markdown
- OS:
- Browser:
- Framework:
```
### Any additional comments?
If a dataset is used with the identical values then the encode rules are respected and it works ( see example, bottom chart has 2 boxplot series)
ie:
```
{
...
dataset: [
{
source: [
[10, 20, 30, 40, 50, 'one'],
[33, 38, 39, 40, 55, 'four'],
[40, 45, 50, 52, 66, 'three']
]
}
],
series: [
{
name: 'Using series.data (broken)',
type: 'boxplot',
encode: { x: 5, y: [0, 1, 2, 3, 4] }, // <-- this is not being respected
data: [
[10, 20, 30, 40, 50, 'one'],
[33, 38, 39, 40, 55, 'four'],
[40, 45, 50, 52, 66, 'three']
]
},
{
name: 'Using dataset (working)',
type: 'boxplot',
encode: { x: 5, y: [0, 1, 2, 3, 4] }, // <-- this works fine
datasetIndex: 0
}
]
...
}
```
--
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.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
Re: [I] [Bug] boxplot.encode does not get respected when used with category axis and series.data [echarts]
Posted by "jonoshearman (via GitHub)" <gi...@apache.org>.
jonoshearman commented on issue #20319:
URL: https://github.com/apache/echarts/issues/20319#issuecomment-2330305600
my proposal would be this:
```ts
const encodeRules = this.getEncode();
if (xAxisType === 'category') {
option.layout = 'horizontal';
ordinalMeta = xAxisModel.getOrdinalMeta();
addOrdinal = !encodeRules?.data.has('x');
}
else if (yAxisType === 'category') {
option.layout = 'vertical';
ordinalMeta = yAxisModel.getOrdinalMeta();
addOrdinal = !encodeRules?.data?.has('y');
}
else {
option.layout = option.layout || 'horizontal';
}
```
inside the `getInitialData()` function.
It feels a little crude, but I tested it and it works in some simple examples.
Let me know if this would be sufficient and I'll submit a PR
--
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
Re: [I] [Bug] boxplot.encode does not get respected when used with category axis and series.data [echarts]
Posted by "Ovilia (via GitHub)" <gi...@apache.org>.
Ovilia closed issue #20319: [Bug] boxplot.encode does not get respected when used with category axis and series.data
URL: https://github.com/apache/echarts/issues/20319
--
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
Re: [I] [Bug] boxplot.encode does not get respected when used with category axis and series.data [echarts]
Posted by "jonoshearman (via GitHub)" <gi...@apache.org>.
jonoshearman commented on issue #20319:
URL: https://github.com/apache/echarts/issues/20319#issuecomment-2330284719
I investigated this a bit, and it seems the issue is in `WhiskerBoxCommonMixin` when `getInitialData()` is run.
there is a check for category axis and ordinalMeta is set to the 'base' dimension, and inserted as the 0th value dimension in series data. This is always set for category-axis which I think is breaking the encode settings.
I'm happy to submit a PR for this - what is the recommended way to check for encode rules on a series option?
--
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