Hello, thank you for the MOV report. The document is useful and very interesting. I am also intrigued by the Open Data side of things.
I have read the article with the Open Data example here, but it would be great if that example was published somewhere, so I can access the full source code.
Do you think this is possible?
thank you
MOVR and the Open Data dataset
-
- Posts: 294
- Joined: Mon Jun 20, 2011 5:04 pm
Re: MOVR and the Open Data dataset
Hey WURFL Lover. Thank you for your message. Please find the fully fledged HTML after this message
------------------------------------------------------------------
<html>
<head>
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript" src="https://code.jquery.com/jquery-2.1.0.js"></script>
<script type="text/javascript">
//load google graph
google.load("visualization", "1", {packages:["corechart"]});
//let's load our data
var json = (function () {
var json = null;
$.ajax({
'async': false,
'global': false,
'url': "http://data.wurfl.io/MOVR/data/2014_q2/ ... 14_q2.json",
'dataType': "json",
'success': function (data) {
json = data;
}
});
return json;
})();
//Let's build an Array out of the JSON data with the data points we intend to visualize
//Percentage of browsers running on given 'form_factor' in given region
var region = 'Africa';
var formfactor = 'smartphone';
var browsers = [['Browser Name','Percentage']];
function drawChart() {
var data = google.visualization.arrayToDataTable(browsers);
var options = {
title: 'Market Percentage of Browser',
vAxis: {title: 'Mobile Browsers in '+region+' ('+ formfactor +')', titleTextStyle: {color: 'black'}}
};
var chart = new google.visualization.BarChart(document.getElementById('chart_div'));
chart.draw(data, options);
}
function drawBrowserChart(first) {
var arrayLength = json.browser.length;
var j = 1;
for (var i = 0; i < arrayLength; i++) {
if (json.browser.region == region && json.browser.form_factor == formfactor) {
var percentage = Math.round(json.browser.percentage*1000)/10;
if (percentage >= 0.1) {
browsers[j++] = [json.browser.browser,percentage];
}
}
}
if (first) {
google.setOnLoadCallback(drawChart);
} else {
drawChart();
}
}
drawBrowserChart(true);
</script>
</head>
<body>
<form>
Select Region:
<select name="myRegion" id="myRegion">
<option value="Africa" selected="selected">Africa</option>
<option value="Asia">Asia</option>
<option value="Europe">Europe</option>
<option value="Global">Global</option>
<option value="North America">North America</option>
<option value="Oceania">Oceania</option>
<option value="South America">South America</option>
</select>
Select Form Factor:
<select name="myFormFactor" id="myFormFactor">
<option value="smartphone" selected="selected">Smartphone</option>
<option value="feature">Feature Phone</option>
<option value="tablet">Tablet</option>
</select>
</form>
<div id="chart_div" style="width: 900px; height: 500px;"></div>
<script>
//events for select elements
$( "select" ).change(function () {
region = $( "#myRegion").val();
formfactor = $( "#myFormFactor").val();
browsers = [['Browser Name','Percentage']];
drawBrowserChart(false);
});
</script>
</body>
</html>
----------------------------------------------------------------------------------
Thanks
ScientiaMobile Support Team
------------------------------------------------------------------
<html>
<head>
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript" src="https://code.jquery.com/jquery-2.1.0.js"></script>
<script type="text/javascript">
//load google graph
google.load("visualization", "1", {packages:["corechart"]});
//let's load our data
var json = (function () {
var json = null;
$.ajax({
'async': false,
'global': false,
'url': "http://data.wurfl.io/MOVR/data/2014_q2/ ... 14_q2.json",
'dataType': "json",
'success': function (data) {
json = data;
}
});
return json;
})();
//Let's build an Array out of the JSON data with the data points we intend to visualize
//Percentage of browsers running on given 'form_factor' in given region
var region = 'Africa';
var formfactor = 'smartphone';
var browsers = [['Browser Name','Percentage']];
function drawChart() {
var data = google.visualization.arrayToDataTable(browsers);
var options = {
title: 'Market Percentage of Browser',
vAxis: {title: 'Mobile Browsers in '+region+' ('+ formfactor +')', titleTextStyle: {color: 'black'}}
};
var chart = new google.visualization.BarChart(document.getElementById('chart_div'));
chart.draw(data, options);
}
function drawBrowserChart(first) {
var arrayLength = json.browser.length;
var j = 1;
for (var i = 0; i < arrayLength; i++) {
if (json.browser.region == region && json.browser.form_factor == formfactor) {
var percentage = Math.round(json.browser.percentage*1000)/10;
if (percentage >= 0.1) {
browsers[j++] = [json.browser.browser,percentage];
}
}
}
if (first) {
google.setOnLoadCallback(drawChart);
} else {
drawChart();
}
}
drawBrowserChart(true);
</script>
</head>
<body>
<form>
Select Region:
<select name="myRegion" id="myRegion">
<option value="Africa" selected="selected">Africa</option>
<option value="Asia">Asia</option>
<option value="Europe">Europe</option>
<option value="Global">Global</option>
<option value="North America">North America</option>
<option value="Oceania">Oceania</option>
<option value="South America">South America</option>
</select>
Select Form Factor:
<select name="myFormFactor" id="myFormFactor">
<option value="smartphone" selected="selected">Smartphone</option>
<option value="feature">Feature Phone</option>
<option value="tablet">Tablet</option>
</select>
</form>
<div id="chart_div" style="width: 900px; height: 500px;"></div>
<script>
//events for select elements
$( "select" ).change(function () {
region = $( "#myRegion").val();
formfactor = $( "#myFormFactor").val();
browsers = [['Browser Name','Percentage']];
drawBrowserChart(false);
});
</script>
</body>
</html>
----------------------------------------------------------------------------------
Thanks
ScientiaMobile Support Team
Who is online
Users browsing this forum: No registered users and 7 guests