Right way to display info

36 views
Skip to first unread message

Alfredo Concha

unread,
Mar 29, 2017, 10:20:04 PM3/29/17
to Google Visualization API
Hi!

I have this information to show (info with accents and signs):
{"c":[{"v":"MERCADÓ LIBRE <b>OMG<\/b"'> (14)"},{

It should output:
MERCADÓ LIBRE <b>OMG</b"'>

Instead of that, I have 2 interpretations on code:
On the graphics:
MERCAD&Oacute; LIBRE &lt;b&gt;OMG&lt;\/b&quot;&#039;&gt; (14)

And on a right side where I get and write the output
MERCADÓ LIBRE <b>OMG</b"'>

The info on the JSON it's right, should be encoded but on the graphics should be decoded! like on the right side where I write some details about the info.

How can I write the right interpretation on the graphics? Thanks!

Daniel LaLiberte

unread,
Mar 29, 2017, 10:24:48 PM3/29/17
to Google Visualization API
Hi Alfredo,

What chart are you using?  That makes a lot of difference in how the text of your data values is processed.

You might try adding the "f" property to specify the formatted value.  It might be handled differently from how text is formatted by default.  

You generally have to specify that you have HTML in your text with the isHtml option.  Otherwise it will be encoded for safety.

--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-visualization-api+unsub...@googlegroups.com.
To post to this group, send email to google-visualization-api@googlegroups.com.
Visit this group at https://groups.google.com/group/google-visualization-api.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-visualization-api/f1f97073-afb2-4787-a7c6-fa9c695617d1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Message has been deleted

Daniel LaLiberte

unread,
Mar 30, 2017, 10:10:36 AM3/30/17
to Google Visualization API
The PieChart supports HTML tooltips, but they only work for the text you add to a 'tooltip' column.  It doesn't work with the data itself.

Some charts support the 'allowHtml' option at the top level, to display values as html.  The Table chart is an example.  The reason they can support HTML is that they are rendered in HTML, whereas most charts use SVG, and the HTML tooltips are an exception because they actually use HTML to render the tooltips.

It seems reasonable to support HTML entities in string values, translated automatically to the equivalent unicode characters, and we should have an option for that but we don't.  But I believe you should be able to use the equivalent unicode characters yourself instead of the HTML entities.  

The bolding you might want with <b>OMB</b> won't work except for HTML.


On Wed, Mar 29, 2017 at 10:59 PM, Alfredo Concha <punc...@gmail.com> wrote:
Hi Daniel!

Thanks for your quick answer. We are using a PieChart:

   var data = new google.visualization.DataTable('$DATA');
   
var options = {
       
'pointSize': 6,
       
'showLables': 'true',
       
'vAxis': {format: '$###,###,###'},
       
'legend': {position: 'labeled'},
       
'chartArea': {'left': '5%', 'width': '80%', 'height': '80%'}
   
};
   
   
var chart = new google.visualization.PieChart(document.getElementById('pie_chart'));
    chart
.draw(data, options);

See this image:

https://cdn.pbrd.co/images/Pu3YqEmNS.png
The right text it's fine, the left text its not being interpreted.

I activated the isHtml option for the tooltip, but it did not helped
tooltip: {isHtml: true}

And when you say format the value, what should I format? it's a string.

Thanks! =)

El miércoles, 29 de marzo de 2017, 23:24:48 (UTC-3), Daniel LaLiberte escribió:

Hi Alfredo,

What chart are you using?  That makes a lot of difference in how the text of your data values is processed.

You might try adding the "f" property to specify the formatted value.  It might be handled differently from how text is formatted by default.  

You generally have to specify that you have HTML in your text with the isHtml option.  Otherwise it will be encoded for safety.
On Wed, Mar 29, 2017 at 10:20 PM, Alfredo Concha <punc...@gmail.com> wrote:
Hi!

I have this information to show (info with accents and signs):
{"c":[{"v":"MERCAD&Oacute; LIBRE &lt;b&gt;OMG&lt;\/b&quot;&#039;&gt; (14)"},{

It should output:
MERCADÓ LIBRE <b>OMG</b"'>

Instead of that, I have 2 interpretations on code:
On the graphics:
MERCAD&Oacute; LIBRE &lt;b&gt;OMG&lt;\/b&quot;&#039;&gt; (14)

And on a right side where I get and write the output
MERCADÓ LIBRE <b>OMG</b"'>

The info on the JSON it's right, should be encoded but on the graphics should be decoded! like on the right side where I write some details about the info.

How can I write the right interpretation on the graphics? Thanks!

--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-visualization-api+unsubscr...@googlegroups.com.
To post to this group, send email to google-visua...@googlegroups.com.



--

--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-visualization-api+unsub...@googlegroups.com.
To post to this group, send email to google-visualization-api@googlegroups.com.
Visit this group at https://groups.google.com/group/google-visualization-api.

For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
Message has been deleted
0 new messages