Comments on: Open Flash Chart II – Javascript (Part 1) http://pullmonkey.com/2008/09/21/open-flash-chart-ii-javascript-part-1/ Wed, 06 Jan 2010 23:47:01 +0000 hourly 1 https://wordpress.org/?v=5.6 By: PullMonkey Blog » Blog Archive » Open Flash Chart II - Javascript (Part 3) http://pullmonkey.com/2008/09/21/open-flash-chart-ii-javascript-part-1/comment-page-1/#comment-4033 Wed, 06 Jan 2010 23:47:01 +0000 /2008/09/23/open-flash-chart-ii-javascript-part-1#comment-4033 […] article is a follow on to Part 1 and Part 2. In this article, I will discuss how we can change between various charts on the fly – […]

]]>
By: PullMonkey Blog » Blog Archive » Open Flash Chart II - Javascript (Part 2) http://pullmonkey.com/2008/09/21/open-flash-chart-ii-javascript-part-1/comment-page-1/#comment-4031 Wed, 06 Jan 2010 23:44:50 +0000 /2008/09/23/open-flash-chart-ii-javascript-part-1#comment-4031 […] article is a follow on to Part 1. In this article, I will discuss how we can change between various charts on the fly – meaning, […]

]]>
By: Harry Seldon http://pullmonkey.com/2008/09/21/open-flash-chart-ii-javascript-part-1/comment-page-1/#comment-796 Sun, 21 Sep 2008 19:15:00 +0000 /2008/09/23/open-flash-chart-ii-javascript-part-1#comment-796 It will surely help ! I will have a deep look into it tonight. Thanks a lot.

H

]]>
By: Harry Seldon http://pullmonkey.com/2008/09/21/open-flash-chart-ii-javascript-part-1/comment-page-1/#comment-797 Sun, 21 Sep 2008 19:15:00 +0000 /2008/09/23/open-flash-chart-ii-javascript-part-1#comment-797 So I have had a look at this. That works perfectly. And I managed to see where I made some beginner mistakes.
For the controller I had the same code as you : I am giving it because it has the fun of having the php code in it (by the way the $ makes php code really ugly).
<filter:code attributes=lang="ruby">
title = Title.new("tuto_5")
#$title = new title( date("D M d Y") );
#$chart = new open_flash_chart();
@chart = OpenFlashChart.new
#$bar = new bar();
bar = BarGlass.new
#$bar->set_values( array(9,8,7,6,5,4,3,2,1) );
bar.set_values([1,2,3,4,5,6,7,8,9])
#$chart->set_title( $title );
@chart.set_title(title)
#$chart->add_element( $bar );
@chart.add_element(bar)
</filter:code>

Then I had directly coded the view code without helpers (and quite ugly) :
<filter:code attributes=lang="html">

<head>
<script type="text/javascript" src="/javascripts/json2.js"></script>
<script type="text/javascript" src="/javascripts/swfobject.js"></script>
</head>

<body>
<script type="text/javascript">
swfobject.embedSWF("/open-flash-chart.swf", "my_chart", "350", "200", "9.0.0");
</script>
<script type="text/javascript">

function ofc_ready()
{
alert(‘ofc_ready’);
}

function open_flash_chart_data()
{
alert( ‘reading data’ );
return JSON.stringify(data);
}

function findSWF(movieName) {
if (navigator.appName.indexOf("Microsoft")!= -1) {
return window[movieName];
} else {
return document[movieName];
}
}

var data = <%= @chart.to_s %>;
</script>

<p>Hello World</p>
<div id="my_chart"></div>
</body>
</filter:code>

This code works (thanks to you) you can check it out <a href="http://thinkosphere.com/test_it/tuto_5">here</a&gt;
But I had made some stupid mistakes : I forgot the / in "/open-flash-chart.swf" and I actually forgot to link the json2.js lib.

Thanks to you and I am looking forward to reading the next chapters !
H

]]>
By: charlie http://pullmonkey.com/2008/09/21/open-flash-chart-ii-javascript-part-1/comment-page-1/#comment-798 Sun, 21 Sep 2008 19:15:00 +0000 /2008/09/23/open-flash-chart-ii-javascript-part-1#comment-798 @Harry Seldon – Glad everything is working for you – the next chapter is available <a href="http://pullmonkey.com/2008/9/22/open-flash-chart-ii-javascript-part-2">here</a&gt;.

]]>
By: Kevin Motschiedler http://pullmonkey.com/2008/09/21/open-flash-chart-ii-javascript-part-1/comment-page-1/#comment-799 Sun, 21 Sep 2008 19:15:00 +0000 /2008/09/23/open-flash-chart-ii-javascript-part-1#comment-799 Just wanted to make a comment that older versions of prototype don’t implement the toJSON method. I believe it was added in version 1.5.1. This caused some head scratching for me since I had 1.5 installed in my project.

]]>
By: charlie http://pullmonkey.com/2008/09/21/open-flash-chart-ii-javascript-part-1/comment-page-1/#comment-800 Sun, 21 Sep 2008 19:15:00 +0000 /2008/09/23/open-flash-chart-ii-javascript-part-1#comment-800 @Kevin – sorry about that. Thanks for helping the next person though 🙂

]]>
By: Wesley http://pullmonkey.com/2008/09/21/open-flash-chart-ii-javascript-part-1/comment-page-1/#comment-801 Sun, 21 Sep 2008 19:15:00 +0000 /2008/09/23/open-flash-chart-ii-javascript-part-1#comment-801 I was just checking out your plugin, and I came across a problem. When it gets to the line:

@chart.js_open_flash_chart_object(…)

I get a:

undefined method `js_open_flash_chart_object’ for #<OpenFlashChart::OpenFlashChart:0x2b214cc68f70>

Any ideas? It works when I don’t put @chart, but then the self.render obviously doesn’t work. This happens to any of the methods I try to call in OpenFlashChart::View.

Thanks in advance!

]]>
By: charlie http://pullmonkey.com/2008/09/21/open-flash-chart-ii-javascript-part-1/comment-page-1/#comment-802 Sun, 21 Sep 2008 19:15:00 +0000 /2008/09/23/open-flash-chart-ii-javascript-part-1#comment-802 @Wesley – fixed in the latest release. Something happened recently in the pushing/pulling 🙁

]]>
By: Wesley http://pullmonkey.com/2008/09/21/open-flash-chart-ii-javascript-part-1/comment-page-1/#comment-803 Sun, 21 Sep 2008 19:15:00 +0000 /2008/09/23/open-flash-chart-ii-javascript-part-1#comment-803 Thanks. In the meantime, I also managed to fix the problem. Looks like your solution and mine were the same. Wonderful little plugin. Keep up the good work. Cheers!

]]>