My favorites | Sign in
Project Home Downloads Wiki Issues Source
READ-ONLY: This project has been archived. For more information see this post.
Search
for
  Advanced search   Search tips   Subscriptions
Issue 2: gvisMotionChart doesn't seem to recognize Date despite date.format give
1 person starred this issue and may be notified of changes. Back to list
Status:  Invalid
Owner:  ----
Closed:  Feb 2011


 
Reported by matteo.z...@gmail.com, Feb 1, 2011
What steps will reproduce the problem?
> gvisData
        Stock       Date     Price
1  ftsemib.mi 2004-12-31 100.00000
2  ftsemib.mi 2005-03-31 104.52707
3  ftsemib.mi 2005-06-30 104.65974
4  ftsemib.mi 2005-09-30 112.52953
5  ftsemib.mi 2005-12-31 115.53571
6  ftsemib.mi 2006-03-31 122.73242
7        gold 2004-12-31 100.00000
8        gold 2005-03-31  93.31369
9        gold 2005-06-30  94.37897
10       gold 2005-09-30 116.02448
11       gold 2005-12-31 135.56210
12       gold 2006-03-31 161.32140
13     ucg.mi 2004-12-31 100.00000
14     ucg.mi 2005-03-31 107.11974
15     ucg.mi 2005-06-30 113.26861
16     ucg.mi 2005-09-30 121.68285
17     ucg.mi 2005-12-31 151.13269
18     ucg.mi 2006-03-31 155.01618
19     trn.mi 2004-12-31 100.00000
20     trn.mi 2005-03-31  96.73203
21     trn.mi 2005-06-30 104.57516
22     trn.mi 2005-09-30 104.57516
23     trn.mi 2005-12-31 104.57516
24     trn.mi 2006-03-31 108.49673
> 
> M <- gvisMotionChart(gvisData, idvar="Stock", timevar="Date", date.format = "%Y-%m-%d")

> M

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
 "http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<%@include file="../src/simpleHead.rsp"%>
<body>
<%@include file="../src/simpleHeader.rsp"%>
 <!-- MotionChart generated in R 2.12.0 by googleVis 0.2.3 package -->
<!-- Tue Feb  1 14:23:42 2011 -->


<script type="text/javascript" src="http://www.google.com/jsapi">
</script>
<script type="text/javascript">
google.load("visualization", "1", { packages:["motionchart"] });
google.setOnLoadCallback(drawChart);
function drawChart() {
var data = new google.visualization.DataTable();
var datajson = [
 [
 "ftsemib.mi",
new Date(2004,11,31),
   100 
],
[
 "ftsemib.mi",
new Date(2005,2,31),
104.53 
],
...
[
 "trn.mi",
new Date(2006,2,31),
 108.5 
] 
];
data.addColumn('string','Stock');
data.addColumn('date','Date');
data.addRows(datajson);
var chart = new google.visualization.MotionChart(
   document.getElementById('MotionChart_2011-02-01-14-23-42')
);
var options ={};
options["width"] =    600;
options["height"] =    500;
chart.draw(data,options);
}
</script>
<div id="MotionChart_2011-02-01-14-23-42" style="width: 600px; height: 500px;">
</div>
 Data: gvisData, Chart ID: MotionChart_2011-02-01-14-23-42
<BR>
R version 2.12.0 (2010-10-15),
<a href="https://code.google.com/apis/visualization/terms.html">
Google Terms of Use</a>
<BR>
<BR>
 
<%@include file="../src/simpleFooter.rsp"%>
</body>
</html>


What is the expected output? What do you see instead?
the provided html code doesn't load the expected graph in firefox 4, Price is not considered (no data.addColumn statement)

What version of the product are you using? On what operating system?
googleVis-0.2.3 on OSX 10.6.5

Please provide any additional information below.
Using

M <- gvisMotionChart(Fruits, idvar="Fruit", timevar="Date", date.format="%Y-%m-%d")

doesn't work either (note Date instead of Year)

Feb 1, 2011
#1 matteo.z...@gmail.com
Sorry, the title is misleading and Fruits with Date instead of Year works. 

The issue is solved by adding a data.addColumn statement for Price manually.
Feb 5, 2011
Project Member #2 markus.g...@googlemail.com
The issue was invalid. 
Status: Invalid

Powered by Google Project Hosting