You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by "Justin-ZS (via GitHub)" <gi...@apache.org> on 2025/02/20 01:43:33 UTC
[I] [Feature] How to customize the dataMax/dataMin of axis rather than fixed max/min [echarts]
Justin-ZS opened a new issue, #20770:
URL: https://github.com/apache/echarts/issues/20770
### What problem does this feature solve?
[demo](https://echarts.apache.org/examples/zh/editor.html?c=line-smooth&code=PYBwLglsB2AEC8sDeAoWsAeBBDEDOAXMmurGAJ4gCmRA5AMYCGYVA5sAE7m0A0J6AE2aMiAbVoBZGL1i0AKgFcqM2gHUqAlXIAWClQDEOEFQGVmphdFoBdEgF8-6cjnxFUpMpRqyAbowA2Srz8sAC2jBhEAIwArHGOpAD0iUJgjBIR0XExPLDJZNpUsBH4YRGwAO4Q_v6wAEZFjLAcwJYCGrDQEPRF0AqhDRyw_hAA1kVRABwADNP2CXhURlSEsKIh7h6wqSJrkwBM07kAnADM-yfTUSenACy5UfvHR7BRp6cvb4fWCR4U1HQRtBlL9SHhQsBgGBtEQwBwlCE7CRbHYANxAA)
Like this demo, the axis.max/min just change the aixs range to [min, max].
I want a dataMin/dataMax property that set the aixs range to [rounded(dataMin),rounded(dataMax)]
### What does the proposed API look like?
```ts
type ValueAxis = {
// other properties
dataMax: number,
dataMin: number
}
```
--
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] [Feature] able to customize the dataMax/dataMin of axis rather than fixed max/min [echarts]
Posted by "Justin-ZS (via GitHub)" <gi...@apache.org>.
Justin-ZS commented on issue #20770:
URL: https://github.com/apache/echarts/issues/20770#issuecomment-2673113800
> Another possible workaround would be to use an inviseble helper series that only contains your min and max values. Could be problematic combined with `tooltip: { trigger: 'axis' }`.
>
> [Example](https://echarts.apache.org/examples/zh/editor.html?c=line-smooth&code=PYBwLglsB2AEC8sDeAoWsAeBBDEDOAXMmurGAJ4gCmRA5AMYCGYVA5sAE7m0A0J6AE2aMiAbVoBZGL1i0AKgFcqM2gHUqAlXIAWClQDEOEFQGVmphdFoBdEgF8-6cjnxFUpMpRqyAbowA2Srz8sHhM_t5gHEr2jqFURlSEsKIh7h6wQmAiKQAcAEwADDywAJwAzPklpYUAjNXlACwltfk1LeXlxbC1lYXWcR4U1HT-ENDKg6R4ALbAwGDaRFExHg5pIejD3gwKeGDAM8EZoRAR0GDL0VRTgsJim6Si3QDsuf0l6AD0X7Az4490M8WgBWMHWUg_P6MDCPWxrEi2OwAbiAA)
Yes. It's exactly the workaround i'm using for now.
I append an invisible line series to meet the requirement, but an official API would be much better
```js
const invisibleSeries = {
type: 'line',
symbolSize: 0,
lineStyle: {
width: 0,
opacity: 0,
},
emphasis: {
scale: false,
disabled: true,
},
select: {
disabled: true,
},
silent: true,
animation: false,
label: {
show: false,
formatter: '',
},
tooltip: {
show: false,
formatter: '',
},
}
```
--
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] [Feature] able to customize the dataMax/dataMin of axis rather than fixed max/min [echarts]
Posted by "Justin-ZS (via GitHub)" <gi...@apache.org>.
Justin-ZS commented on issue #20770:
URL: https://github.com/apache/echarts/issues/20770#issuecomment-2670331663
> The scale attribute in the axis options might be what you need.
>
> [doc](https://echarts.apache.org/en/option.html#yAxis.scale) [demo](https://echarts.apache.org/examples/zh/editor.html?c=line-smooth&code=PYBwLglsB2AEC8sDeAoWsAeBBDEDOAXMmurGAJ4gCmRA5AMYCGYVA5sAE7m0A0J6AE2aMiAbVoBZGL1i0AKgFcqM2gHUqAlXIAWClQDEOEFQGVmphdFoBdEgF8-6cjnxFUpMpRqyAbowA2Srz8sAC2jBhEAIwArHGOpAD0iUJgjBIR0XExPLDJZNpUsBH4YRGwAO4Q_v6wAEZFjLAcwJYCGrDQEPRF0AqhDRyw_hAA1kVRABwADNP2CXhURlSEsKIh7h6wqSJrkwBM07kAnADM-yfTUSenACy5UfvHR7BRp6cvb4fWCR4U1HQRtBlL9SHhQsBgGBtEQwBwlCE7CRbHYANxAA)
No. The `scale` is used for other cases and doesn't work when max/min are set
> This configuration item is unavailable when the [min](https://echarts.apache.org/en/option.html#yAxis.min) and [max](https://echarts.apache.org/en/option.html#yAxis.max) are set.
--
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] [Feature] able to customize the dataMax/dataMin of axis rather than fixed max/min [echarts]
Posted by "Ovilia (via GitHub)" <gi...@apache.org>.
Ovilia closed issue #20770: [Feature] able to customize the dataMax/dataMin of axis rather than fixed max/min
URL: https://github.com/apache/echarts/issues/20770
--
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] [Feature] able to customize the dataMax/dataMin of axis rather than fixed max/min [echarts]
Posted by "linghaoSu (via GitHub)" <gi...@apache.org>.
linghaoSu commented on issue #20770:
URL: https://github.com/apache/echarts/issues/20770#issuecomment-2670210013
The scale attribute in the axis options might be what you need.
[doc](https://echarts.apache.org/en/option.html#yAxis.scale) [demo](https://echarts.apache.org/examples/zh/editor.html?c=line-smooth&code=PYBwLglsB2AEC8sDeAoWsAeBBDEDOAXMmurGAJ4gCmRA5AMYCGYVA5sAE7m0A0J6AE2aMiAbVoBZGL1i0AKgFcqM2gHUqAlXIAWClQDEOEFQGVmphdFoBdEgF8-6cjnxFUpMpRqyAbowA2Srz8sAC2jBhEAIwArHGOpAD0iUJgjBIR0XExPLDJZNpUsBH4YRGwAO4Q_v6wAEZFjLAcwJYCGrDQEPRF0AqhDRyw_hAA1kVRABwADNP2CXhURlSEsKIh7h6wqSJrkwBM07kAnADM-yfTUSenACy5UfvHR7BRp6cvb4fWCR4U1HQRtBlL9SHhQsBgGBtEQwBwlCE7CRbHYANxAA)
--
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] [Feature] able to customize the dataMax/dataMin of axis rather than fixed max/min [echarts]
Posted by "MatthiasMert (via GitHub)" <gi...@apache.org>.
MatthiasMert commented on issue #20770:
URL: https://github.com/apache/echarts/issues/20770#issuecomment-2670691528
You can pass a function to [axis.min / axis.max](https://echarts.apache.org/en/option.html#yAxis.max) and compute the axis boundary values from the min and max in your data.
[Example ](https://echarts.apache.org/examples/zh/editor.html?c=line-smooth&code=PYBwLglsB2AEC8sDeAoWsAeBBDEDOAXMmurGAJ4gCmRA5AMYCGYVA5sAE7m0A0J6AE2aMiAbVoBZGL1i0AKgFcqM2gHUqAlXIAWClQDEOEFQGVmphdFoBdEgF8-6cjnxFUpMpRqyAbowA2Srz8sAC2jBhEABR-gVQAlAgAfMQe6PQweGBhjBysEHCIAAwAdACMANwh6ZnZIMAA7lQcCLASzNol9Q1RZUU8bR0lAGb-wJxR7WCdY6x9MQFKJeEY8YkAtLBl8VVpsBxUYAoccFOd9FQQ_lELccsRsABUsL2wANQ5eQVrsAD0sN1molnoCOLtSA4QqECtFYkpEvAUu40hloFlPvlCrBSpVqrBUejQa0zl1Gr1-oNpiMxhMSbN5nCqPdVhstjs8QcjidKZ1RuMODdGcsCk8XmVYJtwl9oD9_qDgQDGs1weg7PZHLA8M0IFRCLBRCFkR4hGARPqABwAJgpAE4AMyWgY2oplJ12gAsAzKludXrtdopZQdRWsGo8FGodH8BWUYdIeFC42mRDAHCUITV6FsdgqQA)
--
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] [Feature] able to customize the dataMax/dataMin of axis rather than fixed max/min [echarts]
Posted by "MatthiasMert (via GitHub)" <gi...@apache.org>.
MatthiasMert commented on issue #20770:
URL: https://github.com/apache/echarts/issues/20770#issuecomment-2671061762
Another possible workaround would be to use an inviseble helper series that only contains your min and max values. Could be problematic combined with `tooltip: { trigger: 'axis' }`.
[Example](https://echarts.apache.org/examples/zh/editor.html?c=line-smooth&code=PYBwLglsB2AEC8sDeAoWsAeBBDEDOAXMmurGAJ4gCmRA5AMYCGYVA5sAE7m0A0J6AE2aMiAbVoBZGL1i0AKgFcqM2gHUqAlXIAWClQDEOEFQGVmphdFoBdEgF8-6cjnxFUpMpRqyAbowA2Srz8sHhM_t5gHEr2jqFURlSEsKIh7h6wQmAiKQAcAEwADDywAJwAzPklpYUAjNXlACwltfk1LeXlxbC1lYXWcR4U1HT-ENDKg6R4ALbAwGDaRFExHg5pIejD3gwKeGDAM8EZoRAR0GDL0VRTgsJim6Si3QDsuf0l6AD0X7Az4490M8WgBWMHWUg_P6MDCPWxrEi2OwAbiAA)
--
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] [Feature] able to customize the dataMax/dataMin of axis rather than fixed max/min [echarts]
Posted by "Justin-ZS (via GitHub)" <gi...@apache.org>.
Justin-ZS commented on issue #20770:
URL: https://github.com/apache/echarts/issues/20770#issuecomment-2670982506
> You can pass a function to [axis.min / axis.max](https://echarts.apache.org/en/option.html#yAxis.max) and compute the axis boundary values from the min and max in your data.
>
> [Example ](https://echarts.apache.org/examples/zh/editor.html?c=line-smooth&code=PYBwLglsB2AEC8sDeAoWsAeBBDEDOAXMmurGAJ4gCmRA5AMYCGYVA5sAE7m0A0J6AE2aMiAbVoBZGL1i0AKgFcqM2gHUqAlXIAWClQDEOEFQGVmphdFoBdEgF8-6cjnxFUpMpRqyAbowA2Srz8sAC2jBhEABR-gVQAlAgAfMQe6PQweGBhjBysEHCIAAwAdACMANwh6ZnZIMAA7lQcCLASzNol9Q1RZUU8bR0lAGb-wJxR7WCdY6x9MQFKJeEY8YkAtLBl8VVpsBxUYAoccFOd9FQQ_lELccsRsABUsL2wANQ5eQVrsAD0sN1molnoCOLtSA4QqECtFYkpEvAUu40hloFlPvlCrBSpVqrBUejQa0zl1Gr1-oNpiMxhMSbN5nCqPdVhstjs8QcjidKZ1RuMODdGcsCk8XmVYJtwl9oD9_qDgQDGs1weg7PZHLA8M0IFRCLBRCFkR4hGARPqABwAJgpAE4AMyWgY2oplJ12gAsAzKludXrtdopZQdRWsGo8FGodH8BWUYdIeFC42mRDAHCUITV6FsdgqQA)
It's realy a good solution for simple cases.
However, mantaining a function to handle many edge cases — such as negtive, small numbers, big numbers — can be quite annoying.
ECharts already handles these cases effectively.
All we need is a new API to seamlessly integrate our custom `dataMax/dataMin` values.
--
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