JeffersonGarner opened a new issue, #19794:
URL: https://github.com/apache/echarts/issues/19794

   ### What problem does this feature solve?
   
   **Case**
   
   Rather than show a numerical value of the last (upper bound) value on the Y 
Axis, it is sometimes desirable to show something else programmatically. 
   
   **Context**
   
   We had a goal to show a unit of measure (ex: kWh, m/s, or A) on the last Y 
axis label. Since assigning axis.splitNumber doesn't always linearly corelate 
to the number of ticks, we couldn't determine the last tick without risky code.
   
   **Rationale**
   
   By having the final tick number in the axis label formatter, we could 
determine what tick was the last one and easily write that logic within the 
formatter.  Without this, we could only entertain a solution [as described in 
Stack Overflow here](https://stackoverflow.com/a/77102205), which not intended 
to be done, and requires that the chart actually be rendered before we apply 
the actual formatting that we want.
   
   
   ### What does the proposed API look like?
   
   **Current** ([described in 
docs](https://echarts.apache.org/en/option.html#xAxis.axisLabel.formatter))
   
   `
   formatter: function (value, index) {
       return value + 'kg';
   }
   `
   
   **Proposed**
   
   `
   formatter: function (value, index, totalTicks) {
       const desiredLastTickLabel = "desired value here"
       const isLastTick = index === totalTicks - 1
   
       return isLastTick ? desiredLastTickLabel : value + 'kg';
   }
   `
   
   


-- 
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]

Reply via email to