You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by GitBox <gi...@apache.org> on 2021/03/22 06:58:32 UTC

[GitHub] [echarts] 100pah commented on pull request #13715: fix(custom): optionally return category from value(). close #12952

100pah commented on pull request #13715:
URL: https://github.com/apache/echarts/pull/13715#issuecomment-803813330


   @pissang @LemniscateX 
   
   I am not sure about the behavior of this API `value()`.
   
   Current behavior:
   + If the dimension is in type of `'ordinal'`, and the dimension is used by an `'category'` axis, `value()` returns the ordinal number rather than the original category string.
   + Else `value()` returns the original category string.
   
   If we change the behavior like the PR did:
   In all cases `value()` returns the original category string.
   The two issues need to be considered.
   1. It is a break change. And in some cases that might not easy to fix that, because users might not know how to get the ordinal number.
   2. As 1 mentioned, users might need to get the ordinal number, which might be used to calculate the coordinate or retrieve something as an index.
   
   So I prefer not to modify the behavior of `value()`.
   
   But since 5.0 there is an extra api `ordinalRawValue()` provided, but not documented, but used in an `test/custom-shape-morphing3.html`. The behavior is:
   + If the original value is 'hahaha' and the dimension type is 'ordinal', `rawValue()` always returns `'hahaha'` whether this dimension is used by a category axis or not.
   + In other cases, it is the same as `value()` did.
   
   Is `ordinalRawValue()` it enough for this issue? Or anything else ideas?
   
   


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

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