[ 3 posts ]

Tim Ginn

  • Username: tdginn01
  • Joined: Thu Jun 28, 2012 8:28 am
  • Posts: 3
  • Location: Fort Knox, KY
  • Twitter: @ginnburg
  • Offline
  • Profile
Tags:

Yahoo Charts

Post Posted: Thu Jun 28, 2012 8:38 am
+0-
I am trying to user the Yahoo Charts piece of this API.

I am able to get the example to work as long as the div is standing alone on the page.

But the moment that I nest it down into the page where it is supposed to appear it will not work;

Example code I am using is the exact script from the example page. I would post it but apparently yahoo is to cheap to allow longer post....

This works if its just in the page somewhere not nested.

But if I:
Code:
<table><tr><td><div id="myContainer"></div></td></tr></table>
or
<div><div id="myContainer"></div></div>

No go

Oh and I also added a on ready function all ready to run when the DOM was ready and still the same results.


Any help would be appreciated.

Tim Ginn

  • Username: tdginn01
  • Joined: Thu Jun 28, 2012 8:28 am
  • Posts: 3
  • Location: Fort Knox, KY
  • Twitter: @ginnburg
  • Offline
  • Profile

Re: Yahoo Charts

Post Posted: Thu Jun 28, 2012 8:48 am
+0-
The code I am using:

<div id="myContainer" style="width:100%">
</div>

<script type="text/javascript">

// YAHOO.util.Event.onDOMReady(init);

function init() {
YAHOO.widget.Chart.SWFURL = "http://yui.yahooapis.com/2.9.0/build/charts/assets/charts.swf";
YAHOO.example.publicOpinion =
[
{ response: "Summer", count: 564815 },
{ response: "Fall", count: 664182 },
{ response: "Spring", count: 248124 },
{ response: "Winter", count: 271214 },
{ response: "Undecided", count: 81845 }
]
var opinionData = new YAHOO.util.DataSource(YAHOO.example.publicOpinion);
opinionData.responseType = YAHOO.util.DataSource.TYPE_JSARRAY;
opinionData.responseSchema = { fields: ["response", "count"] };
//--- chart
var mychart = new YAHOO.widget.PieChart("myContainer", opinionData,
{
dataField: "count",
categoryField: "response",
style:
{
padding: 20,
legend:
{
display: "right",
padding: 10,
spacing: 5,
font:
{
family: "Arial",
size: 13
}
}
}
});
};

function TestObj(id) {
YAHOO.util.Event.onAvailable(id, this.handleOnAvailable, this);
}

TestObj.prototype.handleOnAvailable = init();


var obj = new TestObj("myContainer");

Tim Ginn

  • Username: tdginn01
  • Joined: Thu Jun 28, 2012 8:28 am
  • Posts: 3
  • Location: Fort Knox, KY
  • Twitter: @ginnburg
  • Offline
  • Profile

Re: Yahoo Charts

Post Posted: Thu Jun 28, 2012 11:09 am
+1-
Well I have it fixed guess I wasn't holding my head just right when pasting the example in. Because on the 500th paste of the example it worked.
  [ 3 posts ]
Display posts from previous:  Sort by  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum