-
Notifications
You must be signed in to change notification settings - Fork 1
Heatmap provides a simple, single helper method that generates a cloud-style heatmap based on a provided histogram.
License
CoralineAda/heatmap
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Heatmap ======= Heatmap provides a simple, single helper method that generates a cloud-style heatmap based on a provided histogram. Installation ============ Install the plugin as usual: script/plugin install git@github.com:Bantik/heatmap.git Then add this line to your application controller: helper_method :heatmap That's it! Example ======= To generate a heatmap, simply call the method from the view, passing in a preprepared histogram. The size and color of each key is calculated based on the associated value from the histogram. In the controller: def index @histogram = { 'Foo' => 13, 'Bar' => 15, 'Trouble' => 5, 'Braids' => 1, 'Something' => 9, 'Else' => 13, 'Many' => 20, 'Zombies' => 7, 'nothing' => 0 } end In your view: <%= heatmap(@histogram) -%> You'll probably want to style the heatmap. There are two classes that you need to set styles for: heatmap, which is the enclosing div, and heatmap_element, which is applied to each key in the heatmap. Sample CSS to get you started: .heatmap { border-top: 1px solid #aaaaaa; border-bottom: 1px solid #aaaaaa; width: 300px; padding: 1em; } .heatmap_element { display: block; text-align: center; margin: .25em; padding-top: 0em; float: left; } Copyright (c) 2010 Corey Ehmke, released under the MIT license
About
Heatmap provides a simple, single helper method that generates a cloud-style heatmap based on a provided histogram.
Resources
License
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published