【问题标题】:plotly tickformat does not apply german locale number formatplotly tickformat 不适用于德语语言环境数字格式
【发布时间】:2016-03-31 11:06:04
【问题描述】:

我正在尝试使用带有德语数字格式的 plotly.js 显示数据,例如:“1.234,0”

布局 = { y轴:{ 刻度格式:',。' } }

但这对我不起作用。

我找到了工作示例:

https://plot.ly/2503/~chris/

我如何做到这一点?

非常感谢您的帮助。

【问题讨论】:

  • 抱歉 - 更正:tickformat: '.,'
  • 你解决了吗?我试图通过使用 hoverformat 来实现它,但没有成功。

标签: numbers format plotly


【解决方案1】:

为此,您应该在布局中使用 separators 属性,如下所示:

layout = { separators = ',.' }

其中第一个字符是小数分隔符,第二个是千位分隔符。更多信息请参考https://plot.ly/javascript-graphing-library/reference/#layout-separators

对于数字格式,您应该使用 layout.xaxis 或 layout.yaxis 中的悬停格式。因此,要解决您的问题,您可以使用以下方法:

layout = { 
           separators = ',.',
           yaxis: { hoverformat = '.1f' }
         }

希望这会有所帮助。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-03-19
    • 2013-07-23
    • 1970-01-01
    • 2011-11-25
    • 1970-01-01
    • 1970-01-01
    • 2020-08-28
    相关资源
    最近更新 更多