Subversion Repositories cheapmusic

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
98 - 1
<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
2
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /><title>SetNumberFormat</title><link rel="stylesheet" type="text/css" href="phplotdoc.css" /><meta name="generator" content="DocBook XSL Stylesheets V1.78.1" /><link rel="home" href="index.html" title="PHPlot Reference Manual" /><link rel="up" href="reference.html" title="PHPlot Function Reference" /><link rel="prev" href="SetMarginsPixels.html" title="SetMarginsPixels" /><link rel="next" href="SetNumXTicks.html" title="SetNumXTicks" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">SetNumberFormat</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="SetMarginsPixels.html">Prev</a> </td><th width="60%" align="center">PHPlot Function Reference</th><td width="20%" align="right"> <a accesskey="n" href="SetNumXTicks.html">Next</a></td></tr></table><hr /></div><div class="refentry"><a id="SetNumberFormat"></a><div class="titlepage"></div><div class="refnamediv"><h2><span class="refentrytitle">SetNumberFormat</span></h2><p>SetNumberFormat &#8212; Set the separators used when formatting number labels</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><pre class="synopsis">$plot-&gt;SetNumberFormat(<em class="parameter"><code>$decimal_point</code></em>, <em class="parameter"><code>$thousands_sep</code></em>)</pre></div><div class="refsect1"><a id="idp1378398236"></a><h2>Description</h2><p>
3
<code class="function">SetNumberFormat</code> sets the separator characters used when
4
formatting number labels. Labels are formatted as numbers when the 'data'
5
format type is selected with
6
<a class="xref" href="SetXLabelType.html" title="SetXLabelType"><span class="refentrytitle">SetXLabelType</span></a> or <a class="xref" href="SetYLabelType.html" title="SetYLabelType"><span class="refentrytitle">SetYLabelType</span></a>.
7
    </p></div><div class="refsect1"><a id="idp1378400060"></a><h2>Parameters</h2><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>$decimal_point</code></em></span></dt><dd><p>
8
The character used as a decimal point, to separate the integer part of the
9
label from the fraction part.
10
          </p></dd><dt><span class="term"><em class="replaceable"><code>$thousands_sep</code></em></span></dt><dd><p>
11
The character used as a thousands grouping separator (placed between every
12
group of 3 digits left of the decimal point).
13
          </p></dd></dl></div></div><div class="refsect1"><a id="idp1378402612"></a><h2>Notes</h2><p>
14
These separators are only used for labels when 'data' mode formatting is
15
selected with
16
<a class="xref" href="SetXLabelType.html" title="SetXLabelType"><span class="refentrytitle">SetXLabelType</span></a> or <a class="xref" href="SetYLabelType.html" title="SetYLabelType"><span class="refentrytitle">SetYLabelType</span></a>.
17
    </p><p>
18
If <code class="function">SetNumberFormat</code> is not used, PHPlot attempts to get
19
the proper separator characters from your system locale. If this works and
20
your locale is set correctly, you will probably not need to use this function.
21
If locale information is not available, the default for decimal_point is
22
a period, and the default for thousands_sep is a comma.
23
    </p><p>
24
If your system locale is set to "C" or "POSIX", you might find that there
25
are no thousands separators in your formatted labels. This is the correct
26
behavior for those locales. If you cannot select a more specific locale,
27
use <code class="function">SetNumberFormat</code> to set the correct separators.
28
    </p><p>
29
To set the number of decimal places, use
30
<a class="xref" href="SetPrecisionX.html" title="SetPrecisionX"><span class="refentrytitle">SetPrecisionX</span></a> and <a class="xref" href="SetPrecisionY.html" title="SetPrecisionY"><span class="refentrytitle">SetPrecisionY</span></a>.
31
    </p><p>
32
If you are trying to force a specific locale with setlocale(), it will not
33
work, because PHPlot uses setlocale(LC_ALL, '') to import locale
34
information from the system, and this overrides a forced locale from your
35
script. On non-Windows platforms, you can force a locale using environment
36
variables, but this does not work on Windows. To address this,
37
PHPlot has (see the History section below) a special member variable
38
<em class="parameter"><code>locale_override</code></em> that prevents PHPlot from importing
39
locale settings from the system. For example, if the following code is used,
40
numeric formatting will use the fr_CA locale settings, regardless of
41
the system locale.
42
      </p><pre class="programlisting">setlocale(LC_ALL, 'fr_CA');  # On Windows use: 'French_Canada'
43
$plot = new PHPlot(800, 600);
44
$plot-&gt;locale_override = True;
45
</pre><p>
46
    </p></div><div class="refsect1"><a id="idp1378408348"></a><h2>History</h2><p>
47
The <em class="parameter"><code>locale_override</code></em> hook was added in PHPlot-5.1.0.
48
Before that, there was no way to force a specific locale on Windows, and on
49
other platforms a locale could be forced only by using environment variables.
50
The hook was added primarily for testing on Windows, but could be needed in
51
other situations too.
52
    </p><p>
53
This function was added to PHPlot-5.0.4. Versions up to and including 5.0rc3
54
always used a period for decimal point, and comma for thousands separator.
55
    </p></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="SetMarginsPixels.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="reference.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="SetNumXTicks.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">SetMarginsPixels </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> SetNumXTicks</td></tr></table></div></body></html>