srividya_sharma

Fusioncharts Rails 3 Sample Application

Recommended Posts

Hi everybody,

 

This Christmas, we have upgraded the FusionCharts sample RoR application to Rails 3.

 

I assume the database creation etc to be same as the application provided with FusionCharts download package.

 

Hope you find it useful. :)

 

Await your valuable suggestions/feedback.

 

I have tried to fix everything, in case, you run into any issues please inform me.

 

Merry Christmas,

 

Srividya

Ask and you shall get - FusionCharts

 

SampleAppRails3.zip

Share this post


Link to post
Share on other sites

This is awesome. Thank you so much. Saved me so much time!

 

Hi everybody,

 

This Christmas, we have upgraded the FusionCharts sample RoR application to Rails 3.

 

I assume the database creation etc to be same as the application provided with FusionCharts download package.

 

Hope you find it useful. :)

 

Await your valuable suggestions/feedback.

 

I have tried to fix everything, in case, you run into any issues please inform me.

 

Merry Christmas,

 

Srividya

Ask and you shall get - FusionCharts

 

SampleAppRails3.zip

Share this post


Link to post
Share on other sites

You are most welcome. That gives me motivation to do better work.

Please feel free to post any issues that you face with this.

If you have made any improvement to it, please post it for the benefit of others.

Thanks.

 

Happy New Year ! :)

 

This is awesome. Thank you so much. Saved me so much time!

Share this post


Link to post
Share on other sites

 

Hope you find it useful. :)

 

 

Hey Guys.

 

I just downloaded and tried to run this app and it didn't work "out of the box".

 

First of all it throws up an error message on "Encoding.default_external = Encoding::UTF_8" I presume some gem is missing.

 

Also rake db:migrate doesn't populate the database. Trying to run the SQL files by hand also doesn't work because the schema creates tables in lower case and the sample data attempts to insert the date in Camel_Case.

 

Just thought you'd want to know.

 

I did get the application going by commenting out the encoding statement and doing a search and replace on the data file.

Share this post


Link to post
Share on other sites

Hi

 

Thank you for letting me know.

 

I will take a look and make any changes required.

 

Srividya Sharma

 

I would also like to report one other thing.

 

I tried to make the charts work with another rails application and was unable to do so. Your example rails app works (displays charts) but then I try to port the code to another app it fails because it seems like it's trying to do very specific things.

 

For example when I call

 

- xml = @chart_data

 

- render_chart '/FusionChartsFree/Charts/FCF_MSLine.swf','', xml, 'FactorySum', 700, 400, false, false

 

the javascript FusionCharts.js is trying to fetch /Data.xml if this file does not exist it fails. If I put the file in there it still fails but only gives a vague error.

 

I am not quite sure what is going wrong but if you could provide some pointers I would appreciate it very much.

Share this post


Link to post
Share on other sites

Hi

 

Thank you for letting me know.

 

I will take a look and make any changes required.

 

Srividya Sharma

 

I got past the /Data.xml problem now it's saying "no data to display" even though the debug output is .

 

 

The dataSource used is str_data.The data is <chart xAxisName="Date" showValues="1" labelStep="2" caption="Visitors" palette="2" subcaption="(In Units)"><categories><category label="2011-04-01"/><category label="2011-04-01"/><category label="2011-04-02"/><category label="2011-04-02"/><category label="2011-04-03"/><category label="2011-04-03"/><category label="2011-04-04"/><category label="2011-04-04"/></categories><dataset seriesName="New Visitors"><set value="232"/><set value="222"/><set value="270"/><set value="248"/></dataset><dataset seriesname="Returning Visitors"><set value="43"/><set value="38"/><set value="48"/><set value="48"/></dataset></chart>

 

 

Notice the different capitalizations of seriesName and seriesname I tried both because the docs say to use lowercase but your example uses upper case.

Share this post


Link to post
Share on other sites

Hi Tim,

 

For FusionCharts Free, you would need to use a slightly different xml.

 

Please replace <chart> with <graph>.

 

And use, <category name='2011-04-01'/> -> name in place of label

 

Hope this helps.

 

Srividya Sharma

 

 

 

 

 

I got past the /Data.xml problem now it's saying "no data to display" even though the debug output is .

 

 

The dataSource used is str_data.The data is <chart xAxisName="Date" showValues="1" labelStep="2" caption="Visitors" palette="2" subcaption="(In Units)"><categories><category label="2011-04-01"/><category label="2011-04-01"/><category label="2011-04-02"/><category label="2011-04-02"/><category label="2011-04-03"/><category label="2011-04-03"/><category label="2011-04-04"/><category label="2011-04-04"/></categories><dataset seriesName="New Visitors"><set value="232"/><set value="222"/><set value="270"/><set value="248"/></dataset><dataset seriesname="Returning Visitors"><set value="43"/><set value="38"/><set value="48"/><set value="48"/></dataset></chart>

 

 

Notice the different capitalizations of seriesName and seriesname I tried both because the docs say to use lowercase but your example uses upper case.

Share this post


Link to post
Share on other sites

Hi Tim,

 

For FusionCharts Free, you would need to use a slightly different xml.

 

Please replace <chart> with <graph>.

 

And use, <category name='2011-04-01'/> -> name in place of label

 

Hope this helps.

 

Srividya Sharma

 

 

 

Thanks I will try that.

 

I do have one other question though.

 

When plotting multiple series I have to specify all the keys for all the series but I might not have a corresponding value in all the series. For example let's say I am plotting the sales of various items over the week. Every day I sold some things so categories keys would be mon, tues, wed, etc. But maybe I did not sell any white shirts on monday so I don't have an entry in my database for white shirts with monday's date on it. When I pull the data out of my database there is no entry for that database and when fill out the XML it's missing an item.

 

Wouldn't it make more sense to specify both the key and the value for the data points and let fusion charts figure how to plot them? This is how all the javascript libraries work, you specify a JSON document with the key value pairs or an array of arrays containing keys and values.

 

Thanks.

Share this post


Link to post
Share on other sites

Currently, this is the mechanism followed by FusionCharts. We have to programmatically fill-in the missing values.

Hope this clarifies.

Srividya Sharma

 

Thanks I will try that.

 

I do have one other question though.

 

When plotting multiple series I have to specify all the keys for all the series but I might not have a corresponding value in all the series. For example let's say I am plotting the sales of various items over the week. Every day I sold some things so categories keys would be mon, tues, wed, etc. But maybe I did not sell any white shirts on monday so I don't have an entry in my database for white shirts with monday's date on it. When I pull the data out of my database there is no entry for that database and when fill out the XML it's missing an item.

 

Wouldn't it make more sense to specify both the key and the value for the data points and let fusion charts figure how to plot them? This is how all the javascript libraries work, you specify a JSON document with the key value pairs or an array of arrays containing keys and values.

 

Thanks.

Share this post


Link to post
Share on other sites

Hey Guys.

 

I just downloaded and tried to run this app and it didn't work "out of the box".

 

First of all it throws up an error message on "Encoding.default_external = Encoding::UTF_8" I presume some gem is missing.

 

Also rake db:migrate doesn't populate the database. Trying to run the SQL files by hand also doesn't work because the schema creates tables in lower case and the sample data attempts to insert the date in Camel_Case.

 

Just thought you'd want to know.

 

I did get the application going by commenting out the encoding statement and doing a search and replace on the data file.

 

I have made modifications to the sample application to correct these errors.

I have added the migrations and schema files so that the database migration issues are fixed.

I have also modified the scripts to use lower case table names only.

 

I am not sure about the error related to the Default External Encoding present in the environment.rb file. I am unable to replicate it. Anyway, I have commented it out. If you can provide me more details on the error you faced when this line was not commented, it would be helpful.

 

Please find attached the latest Sample Application for Rails 3 with the above mentioned changes. :)

 

Thanks

Srividya Sharma

Ask and get more from FusionCharts

SampleAppRails3v2.zip

Share this post


Link to post
Share on other sites

Hi,

 

I could do with a hand.

 

Using rails3 on a windows machine.

 

I downloaded recently

 

sample for rails3

fusionchart (free)

 

I am have a hard time to get the sample running.

 

When in the ../sampleapps directory I start rails.

immediately I get an error "can not find rmagick 2.13.1"

 

But I have that on installed in my machine.

 

Would appreciate a response,

Thanks

 

Ernst

post-20041-0-30191800-1312557589_thumb.png

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now