<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Hello Diego, in Software Archive</title>
    <link>https://community.intel.com/t5/Software-Archive/Google-Charts-from-Web-Service/m-p/1124786#M77577</link>
    <description>&lt;P&gt;Hello Diego,&lt;BR /&gt;
	thank you very much for you answer.&lt;BR /&gt;
	Could I ask you how did you manage to integrate c3js inside XDK code? I'm pretty new to app development, and some code snippets can be very helpful.&lt;/P&gt;

&lt;P&gt;Thank you again,&lt;BR /&gt;
	Alessio&lt;/P&gt;

&lt;P&gt;PS: great app!&lt;/P&gt;</description>
    <pubDate>Wed, 04 Jan 2017 21:13:27 GMT</pubDate>
    <dc:creator>Alessio_R_</dc:creator>
    <dc:date>2017-01-04T21:13:27Z</dc:date>
    <item>
      <title>Google Charts from Web Service</title>
      <link>https://community.intel.com/t5/Software-Archive/Google-Charts-from-Web-Service/m-p/1124784#M77575</link>
      <description>&lt;P&gt;Hello everybody,&lt;/P&gt;

&lt;P&gt;I try to populate a simple pie chart (Google Charts Component) through a WebService which executes a trivial query and returns a JSON formatted string.&lt;/P&gt;

&lt;P&gt;I'm currently stuck with some warnings and errors, showing up into the debugging console.&lt;/P&gt;

&lt;P&gt;Code first: I changed the createChart method, inside the chart.js file, in order to pass only the plain URL to the function performing the http request:&lt;/P&gt;

&lt;P&gt;function createChart(chartObject) {&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var chartWidth = chartObject.dataChartWidth;&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var chartHeight = chartObject.dataChartHeight;&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var url = chartObject.dataURL;&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var param = "/gviz/tq?tq=";&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var queryString = encodeURIComponent(chartObject.dataQueryString);&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var query = new google.visualization.Query(url); //this has been changed&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; query.send(getQueryResponseHandler(chartObject.dataID, chartObject.dataChartType,chartWidth,chartHeight));&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;

&lt;P&gt;My JSON string is as follows:&lt;/P&gt;

&lt;P&gt;{"cols":[{"label":"Paese","type":"string"},{"label":"Qta","type":"number"}],"rows":[{"c":[{"v":"A"},{"v":123.45}]},{"paese_nome":"A","qta":"123.45"},{"c":[{"v":"C"},{"v":49061.73}]},{"paese_nome":"C","qta":"49061.73"},{"c":[{"v":"I"},{"v":90661.31}]},{"paese_nome":"I","qta":"90661.31"},{"c":[{"v":"N"},{"v":1831.9}]},{"paese_nome":"N","qta":"1831.90"}]}&lt;/P&gt;

&lt;P&gt;I got the two following errors in console:&lt;/P&gt;

&lt;P&gt;Resource interpreted as Script but transferred with MIME type text/html: "http://localhost/WS/getData.php?tqx=reqId%3A0". format+en,default+en,ui+en,corechart+en.I.js:294gvjs_1l format+en,default+en,ui+en,corechart+en.I.js:294gvjs_.nw format+en,default+en,ui+en,corechart+en.I.js:365gvjs_.send format+en,default+en,ui+en,corechart+en.I.js:367createChart chart.js:78(anonymous function) chart.js:58initalizeCharts chart.js:57init&lt;/P&gt;

&lt;P&gt;Uncaught SyntaxError: Unexpected token : getData.php?tqx=reqId%3A0:1&lt;BR /&gt;
	Error in query: Request timed out&lt;/P&gt;

&lt;P&gt;I can't understand if&lt;/P&gt;

&lt;P&gt;1) I'm using the component in the way it's meant to be used&lt;BR /&gt;
	2) Is Google Chart the best way to draw charts within XDK (there isn't much material to learn by example... )&lt;BR /&gt;
	&lt;BR /&gt;
	Can anyone help me?&lt;BR /&gt;
	Thank You&lt;BR /&gt;
	Alex&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Jan 2017 13:55:01 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Google-Charts-from-Web-Service/m-p/1124784#M77575</guid>
      <dc:creator>Alessio_R_</dc:creator>
      <dc:date>2017-01-04T13:55:01Z</dc:date>
    </item>
    <item>
      <title>Hi Alessio,</title>
      <link>https://community.intel.com/t5/Software-Archive/Google-Charts-from-Web-Service/m-p/1124785#M77576</link>
      <description>&lt;P&gt;Hi Alessio,&lt;/P&gt;

&lt;P&gt;I can give yousome feedback to your question 2).&lt;/P&gt;

&lt;P&gt;I made this app with XDK using C3.js chart library:&lt;/P&gt;

&lt;P&gt;&lt;A href="https://www.agroideas.com.ar/?page_id=449" target="_blank"&gt;https://www.agroideas.com.ar/?page_id=449&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;The library has a lot of examples, and work very well on mobile devices.&lt;/P&gt;

&lt;P&gt;&lt;A href="http://c3js.org/examples.html" target="_blank"&gt;http://c3js.org/examples.html&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Regards&lt;/P&gt;

&lt;P&gt;Diego&lt;/P&gt;</description>
      <pubDate>Wed, 04 Jan 2017 20:48:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Google-Charts-from-Web-Service/m-p/1124785#M77576</guid>
      <dc:creator>Diego_Calp</dc:creator>
      <dc:date>2017-01-04T20:48:00Z</dc:date>
    </item>
    <item>
      <title>Hello Diego,</title>
      <link>https://community.intel.com/t5/Software-Archive/Google-Charts-from-Web-Service/m-p/1124786#M77577</link>
      <description>&lt;P&gt;Hello Diego,&lt;BR /&gt;
	thank you very much for you answer.&lt;BR /&gt;
	Could I ask you how did you manage to integrate c3js inside XDK code? I'm pretty new to app development, and some code snippets can be very helpful.&lt;/P&gt;

&lt;P&gt;Thank you again,&lt;BR /&gt;
	Alessio&lt;/P&gt;

&lt;P&gt;PS: great app!&lt;/P&gt;</description>
      <pubDate>Wed, 04 Jan 2017 21:13:27 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Google-Charts-from-Web-Service/m-p/1124786#M77577</guid>
      <dc:creator>Alessio_R_</dc:creator>
      <dc:date>2017-01-04T21:13:27Z</dc:date>
    </item>
    <item>
      <title>Hi Alessio,</title>
      <link>https://community.intel.com/t5/Software-Archive/Google-Charts-from-Web-Service/m-p/1124787#M77578</link>
      <description>&lt;P&gt;&lt;SPAN style="font-size: 1em;"&gt;Hi Alessio,&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;In short, the steps are:&lt;/P&gt;

&lt;P&gt;1) include in your index.html the lib files:&lt;/P&gt;

&lt;PRE class="brush:xml;"&gt;        &amp;lt;link rel="stylesheet" href="lib/c3.min.css"&amp;gt;
        &amp;lt;script type="application/javascript" src="lib/d3.min.js"&amp;gt;&amp;lt;/script&amp;gt;
        &amp;lt;script type="application/javascript" src="lib/c3.min.js"&amp;gt;&amp;lt;/script&amp;gt;&lt;/PRE&gt;

&lt;P&gt;2) You need to manually create a div into one of your app pages to hold the chart, for example:&lt;/P&gt;

&lt;PRE class="brush:xml;"&gt;                    &amp;lt;div id="cht_pro" style="width:96%;height:210px"&amp;gt;&amp;lt;/div&amp;gt;
&lt;/PRE&gt;

&lt;P&gt;3) Create the chart pointing that div, I'm just pasting the code from my app, it is part of a function that receives the values after a button press:&lt;/P&gt;

&lt;PRE class="brush:jscript;"&gt;	var chart = c3.generate({
		bindto: '#cht_pro', //this is the line poining to the div above
		data: {
			x : 'x',
			columns: [
				labels,
				promedio,
				propios
			],
			type: 'bar',
			types: {'Mis precios': 'line'},
			colors: {
				'Promedio nacional': '#cc3300',
				'Mis precios': '#9999cc'
			}
		},
		point: {
			r: 5	
		},
		axis: {
			x: {
				type: 'category',
				tick: {
					rotate: 90,
					multiline: false
				}
			}
		},
		tooltip: {
			format: {
				value: function (value, ratio, id) {
					var format = d3.format('.3n');
					return format(value);
				}
			}
		}
	});&lt;/PRE&gt;

&lt;P&gt;Replace the code of point 3) with one of the lib samples to test.&lt;/P&gt;

&lt;P&gt;Regards&lt;/P&gt;

&lt;P&gt;Diego&lt;/P&gt;</description>
      <pubDate>Thu, 05 Jan 2017 02:06:53 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Google-Charts-from-Web-Service/m-p/1124787#M77578</guid>
      <dc:creator>Diego_Calp</dc:creator>
      <dc:date>2017-01-05T02:06:53Z</dc:date>
    </item>
  </channel>
</rss>

