Charts in Ruby on rails 3 web app - ruby-on-rails-3

I need to generate some charts and graphs in a Ruby on Rails 3 app.
I have searched around for a gem to help me out and I have found gchartrb, googlecharts and gruff, but the first two seem to be too old to support Rails 3 (last commit is around 2008) and gruff I read that it is not recommended because it depends on ImageMagick and RMagick. But this was also from the year 2007.
HighCharts also have nice looking charts, but I don't have much JavaScript skills
So what gem or what approach would be best to have some bar/line/pie charts in a rails app?

Google has a great library for drawing charts with HTML5 and JavaScript. It's called Google Chart Tools.
You can pick the chart type you want from their Chart Gallery and use it with JavaScript. Even if you don't have much JavaScript skills, the examples should help you to get the job done.

Even if the question was already answered, I would like to suggest Morris for those that will pass here, even with "not much JavaScript skills" you could create nice charts. I also do not have much Javascript skills, but so far it is being easy. You have basically to create a JSON on the server side and set it to a #variable on your Controller. From your view you access this variable from a Javascript code passing it to the Morris calls.

I started using Highcharts a few weeks ago and can tell you that you don't need that much Javascript knowledge (depending on your needs and the complexity of the data). Apart from that those charts look really nice, in my opinion.
There are good tutorials and examples available which can help you. There's also a railscast regarding this topic.

I've another own option - https://github.com/railsjazz/rails_charts
It's using Apache eCharts, so same powerful as Highcharts and have convinient helpers to generate charts in your RoR app.

Related

I don't understand the Dojo documentation

I'm a beginner in dojo. First of all is everything javascript based? For example to create a form I have to use JavaScript or HTML tags?
Also I cannot understand their documentation and tutorials. It's very confusing.
Is there a proper website (other then dojo itself) that has good tutorials?
You can use Dojo's components's (widgets) in two ways. Programmatic and declaritive. The programmatic way (what you are talking about) is by defining widgets through the use of javascript. With declaritive you can define them using HTML markup. David Walsh has a nice short writeup and if you search for "declaritive programmatic dojo" you'll find some questions and answers on the matter:
https://davidwalsh.name/dojo-widget
Difference between programmatically vs declaratively created widgets in dojo?
Declarative coding or programmatic coding in Dojo Projects?
Declarative or programatic approach in DOJO?
If you're having trouble with the tutorials on the Dojo website, i suspect you're better off, first diving into some basic beginner javascript tutorials before trying to learn a framework like Dojo. I concur with the comment Ferry made on your question, there are no better resources than the actual Dojo website. I recommend following every tutorial, starting with the Hello Dojo tutorial and working your way up so that you don't miss out on the basic concepts which you'll need when you read the harder tutorials. Good luck!
For your first question: dojo is javascript-based platform that provide you with a basic javascript library and a bunch of basic widgets (UI controls like button, dialogue, layouts,...), and some extra things. However, you don't really have to use dojo all the time: you still can use dojo to manipulate a html form button; it's just dojo button comes with extra functionalities and might save you some time.
For the second question, I agree with iH8 that dojo website is the best place to start. There are three different ways dojo websites can help you:
Look at the tutorial: Basic steps on how to set it up and use provided functionalities as-is
Look at thetoolkit api: This provides a very detailed view of dojo javascript object (See what extra things you can do with dojo objects)
Look at the nightlytest: I found this very helpful in term of showing me what can be done outside of the tutorial (i.e. how to use things you found in the api)
Other than these, you can look at existing implementation to learn about the toolkit.
Basically, this is how I am learning Dojo. Without more-specific questions, it's hard to tell what is confusing about the tutorial. I would recommend you give it a try and post a question: everyone here will be willing to help you.
I recommend starting with some video tutorial like this.
When you understand the concept, you can try to copy and paste some code from Dojo documentation tutorials or Reference Guide, because all books are out-of-date.
Also you may find some useful information on IBM-related sites like http://www.ibm.com/developerworks because IBM invested in Dojo and uses it for its products.
If you have enough resources ($) you can take participation in Workshops (sitepen.com/workshops)

Ruby Rails--easy way to get animated front end?

I am developing a web-based simulation where I want the front-end to be "animated" in real-time--it will be a mapping application, and I want to have little icons (representing the components of my simulation) moving all over the map as the simulation runs. I am developing the back-end in Rails, but I am wondering what are good packages to use for the front-end / animation part? I used Graphviz to generate the base map (a directed graph), but it doesn't seem well suited for live animations.
Something like Hans Rosling's Gapminder (if it's even possible to do in real-time). Or should I be doing something similar and "recording" the data then playing it back? What packages should I consider in that case?
Gapminder
Currently using Rails 3.0, Ruby 1.9.2, Graphviz 2.28.
Here are 2 javascript libraries that may help. You could use ajax calls to your rails backend to populate their data. I'm unsure if D3 has mapping capability, but I believe Raphael does. As far as real-time, you'll have to check out their documenation. In Rails 4, I believe the streaming capability may benefit you as well, but I've not investigated.
Raphael
D3

Ruby on Rails - using a Themeforest Admin Theme with my project

I am trying to build a CRM tool for a particular niche. I'm a complete newbie. This will be my first app. My only programming experience is with VB and MS Access, so RoR is presenting quite the learning curve. I have worked through the first version of Michael Hartl's Rails Tutorial. (And actually absorbed about 10% of it)
I bought a Themeforest bootstrap admin theme and have two general questions on it:
1) The theme has some PHP code in it. I'm assuming that I should re-write this code in Ruby, right? The code mostly controls things like file uploading, etc.--things that could be re-written in Ruby by an experienced programmer rather quickly (for me, it will take months :)
2) The theme contains a number of different pages. For example, one page is a dashboard, and another is a calendar. Both of these pages have a lot of duplication between them - all the main control buttons, etc., stay the same from page to page. In the theme, each page is a different HTML file where all of the code is simply duplicated. I'm assuming that I'll want to set up some sort of template system in Rails so that I don't cut-and-paste code between a bunch of HTML pages, right? (If I change a main button, I only want to make that change in one place, rather than in each of the 20 HTML files that came with this theme.)
1)
I'm not absolutely sure if there's no other way, but it's most likely the easiest solution.
If you have to rewrite stuff that's common in web apps, like file uploading, there is usually a gem to help you out, so you don't have to do everything from scratch. I can recommend the paperclip gem, Railscast for file uploading, since we use that in our own project.
Note: The Railscast is out of date, so the installation stuff is no longer accurate. Also, paperclip requires ImageMagick to work.
Railscasts also cover lots of other useful gems. If you need to find something specific, just google it. The github page then usually reveals if a gem is still maintained or if you're better off with something else.
2)
Rails prevents duplicated code with partials. Here's the Railscast (syntax might have changed since 2008). Partials let you place code like headers, or buttons in your case, in a file, which can then be rendered in any of your views.
Unfortunately, I can't link the other stuff like the github page and Rubygems.org because I lack the reputation. I hope this still helps a bit.
Extract the common elements of the theme into your application layout.
Extract the modular sections of the theme into their own controllers and actions. For example, create a calendar controller for the calendar section, the actions that appear in the calendar controller will be the views that support the calendar. You can also use partials (views that start with '_'), without having to create a controller action. But if there is data that needs to be sent to the view, it is better to stick with normal controller actions and views.
As for the php code, get rid of it, move as much logic as possible into your model and controllers, with preference to putting in your models. As hobo suggested, check out gems to replicate the functionality of any complicated php code.

Automatic website creation using rails

I am looking for a template generator for rails, much like the scaffolding, but complete with preset pages and css, everything already built-in generically.
I am unsure where or how to search for this.
The reason I want something like that and not create one myself, is that I need to create a website really quickly with a certain preset theme
I had the same problem that you had, and could not find a solution. Therefore I built a gem for it.
https://github.com/bighostkim/simple-layout
It only applies to your development mode and it does not use asset to make it simple.
Hope it helps.
Rails Yard may be the solution you are looking for. It is a CMS written in Rails.
Rails CMS WIKI FORUM 2nd option
Rails Admin is great for data management (Create, Retrieve, Update, Delete).

Is there a non-Adobe equivalent of Axiis?

I want something like Axiis, but without using Flex or other Adobe products.
Have a look at the JavaScript InfoVis Toolkit. Also, maybe the gRaphaël charting library (built on top of Raphaël) can suit your needs.
Others:
Ajax.org
Google Chart API
flot
Style Chart
Bluff
JS Charts
jqPlot
pChart
ExtJS
Vizualize
TufteGraph
milkchart
DojoX Data Chart
jQChart
PlotKit
See whether one of these suits your needs best.
The closest I can think off the top off my head is Google Visualization API
Of course, AFAIK, this will only work for on-line applications. And is Google any less evil than Adobe is a question for you to decide :)
This is a pretty open question, as you havent specified any preference for any particular technology or language.
I do a lot of WPF/C# stuff so I immediately start looking on that stack. Assuming that this would be a suitable platform, then Visifire might be worth looking at... I originally found them here on codeplex.
There seem to be a ton of third party paid for components that can do similar things. Telerik has some visualization tools that may also be worth having a look at.
Is thre any specific scenario that you are looking at, or any specific language? I think we may be able to suggest better alternatives if that was provided.
You could try protovis (JavaScript), looks quite similar.
You can use jqChart - HTML5 jQuery Chart Plugin