Tihauan / jsgauge

Automatically exported from code.google.com/p/jsgauge
0 stars 0 forks source link

Label Unit of Measure does not support literal extended characters #28

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Instantiate a gauge and set label="°C"
2. Display gauge
3.

What is the expected output? What do you see instead?
Expect to see °C
Instead see black diamond with ? (html cannot decode)

I note that mozDrawText is used and wonder if this supports extended 
characters, or whether using strokeText() would work properly?

Original issue reported on code.google.com by KMALIT...@gmail.com on 14 Apr 2012 at 6:57

Attachments:

GoogleCodeExporter commented 9 years ago
However, it will display unicode correctly, as in \u00B0

Original comment by KMALIT...@gmail.com on 14 Apr 2012 at 7:15

GoogleCodeExporter commented 9 years ago
Interesting - its good to know there is a work-around. For what its worth, the 
following code is used to display a degree symbol in the online demo:

unitsLabel: '' + String.fromCharCode(186),

Original comment by justin.e...@gmail.com on 16 Apr 2012 at 4:34

GoogleCodeExporter commented 9 years ago
Also, it looks like mozDrawText has been deprecated:

Note: This method has been deprecated in favor of the official HTML 5 methods 
fillText() and strokeText().

See: 
https://developer.mozilla.org/en/Drawing_text_using_a_canvas#mozDrawText.28.29

Original comment by justin.e...@gmail.com on 16 Apr 2012 at 4:54

GoogleCodeExporter commented 9 years ago
Justin,

Another work around is this:

$asciiString = mb_convert_encoding ($oSens->aUOMInfo['unitsLabel'], 'UTF-8' 
,'US-ASCII');
$aJSInnards['unitsLabel']=$asciiString;

... and later ...

  unitsLabel: '<?php echo $this->unitsLabel;?>',

I've posted the class that manages this here: 
https://github.com/k1mgy/Simple-JSGuage-Class

Didn't fork your stuff, but there are some mods to both .js files, nonetheless.

Now I am working on a method to prevent background updates when the page is not 
in focus.  Currently when it is brought back into focus, I get a whole series 
of updates that were (apparently) queued up.  They render, but since I use a 
blink effect on each control, there's a lot of blinking before things settle 
down.  Looks like an arcade game :)

Original comment by KMALIT...@gmail.com on 16 Apr 2012 at 5:14

GoogleCodeExporter commented 9 years ago
Here's what it looks like now..

Original comment by KMALIT...@gmail.com on 16 Apr 2012 at 5:17

Attachments: