dqxhit3376 2019-06-03 18:47
浏览 116

如何使用printf格式在JPGraph中格式化货币

JPGraph states it uses standard printf formatting for labels. However, I can't figure out how to get my labels to format properly for USD. I need the output to begin with $ and have a comma separator. The string I' trying is:

$%'01.2f

Here's my code for setting the value format:

$bplot->value->SetFormat("$%'01.2f");

What am I missing?

  • 写回答

2条回答 默认 最新

  • dongzhanlian6289 2019-06-04 11:59
    关注

    Use number_format on the value before using SetFormat to add the dollar sign to the value on the graph. If you are NOT using Windows then money_format may be used to do everything in one shot and SeFormat would not be needed.

    评论

报告相同问题?