XCharts-Team / XCharts

A charting and data visualization library for Unity. Unity数据可视化图表插件。
https://xcharts-team.github.io
MIT License
3.31k stars 571 forks source link

AxisLabel missing {value} placeholder docs #291

Closed cristianofromagio closed 1 year ago

cristianofromagio commented 1 year ago

Context

I was trying to suffix a string to the XAxis entries, so tried to use the formatter field on the Axis Label, in which none of the docs placeholders worked (it rendered the placeholder as a text).

image

Docs

I tried to find the Axis Label formatter placeholders values in the Configuration docs:

Description for LabelStyle.formatter on the docs:

标签内容字符串模版格式器。支持用 \n 换行。 模板变量有: {.}:圆点标记。 {a}:系列名。 {a}:系列名。 {b}:类目值或数据名。 {c}:数据值。 {d}:百分比。 {e}:数据名。 {f}:数据和。 示例:“{b}:{c}”

Translated to english (it is also missing the placeholder values on the english docs file):

Tag content string template formatter. Line breaks with \n are supported. Template variables are: {.}: dot mark. {a}: Series name. {a}: Series name. {b}: Category value or data name. {c}: data value. {d}: Percentage. {e}: data name. {f}: data sum. Example: "{b}:{c}"

Solution

While searching the other formatter fields, the Legend.formatter mentioned the {value} placeholder while also mentioning the template placeholders on Tooltip.itemFormatter (another related issue #290).

I tried using the {value} placeholder and it worked!

image

I also found this information while searching the FAQ files, but the english FAQ does not have the AxisLabel formatter description, which is present in the chinese FAQ.

From chinese FAQ file:

如何让Y轴显示多位小数 答:设置Axis下的AxisLabel中的formatter{value:f1}{value:f2}1.5.0及以上版本通过numericFormatter设置。

Translated to english (it is missing the formatter segment on the english FAQ file):

How to make the Y axis display multiple decimal places Answer: Set the formatter in AxisLabel under Axis to {value:f1} or {value:f2}. Versions 1.5.0 and above are set via numericFormatter.

Suggestion

It would be nice to have the template placeholders for the AxisLabel formatter mentioned in the FAQ also documented in the Configuration docs (namely the {value} placeholder) where applicable.

monitor1394 commented 1 year ago

Very detailed description, thanks for feedback, we will improve the documentation as soon as possible.