github
Advanced Search
  • Home
  • Pricing and Signup
  • Explore GitHub
  • Blog
  • Login

pullmonkey / open_flash_chart

  • Admin
  • Watch Unwatch
  • Fork
  • Your Fork
  • Pull Request
  • Download Source
    • 233
    • 34
  • Source
  • Commits
  • Network (34)
  • Issues (0)
  • Downloads (5)
  • Wiki (1)
  • Graphs
  • Branch: test

click here to add a description

click here to add a homepage

  • Branches (2)
    • master
    • test ✓
  • Tags (5)
    • v2.1.1
    • v2.0.0
    • LugWyrmCharmer
    • 2.1.2
    • 2.1.0
Sending Request…
Enable Donations

Pledgie Donations

Once activated, we'll place the following badge in your repository's detail box:
Pledgie_example
This service is courtesy of Pledgie.

The ruby on rails plugin for teethgrinder's Open Flash Chart (version 2) — Read more

  cancel

http://pullmonkey.com/projects/open_flash_chart2/

  cancel
  • Private
  • Read-Only
  • HTTP Read-Only

This URL has Read+Write access

the ohter examples need to be required too 
pullmonkey (author)
Thu Apr 30 09:27:34 -0700 2009
commit  f216bf514f0580c4f91abf9f04949ebf2d36409f
tree    0120b2fb02766934684b9b5d2299865d4057de13
parent  7ca9f9dbea795431aafdcc3a20dd4b73900f6fba
open_flash_chart /
name age
history
message
file MIT-LICENSE Thu Jul 24 08:48:52 -0700 2008 Initial commit [pullmonkey]
file README Loading commit data...
file Rakefile Thu Jul 24 08:48:52 -0700 2008 Initial commit [pullmonkey]
directory assets/
file init.rb
file install.rb
directory lib/
directory test/ Fri Nov 07 10:40:19 -0800 2008 remove test app to separate it from the plugin [harryseldon]
file uninstall.rb Thu Jul 24 08:48:52 -0700 2008 Initial commit [pullmonkey]
README
OpenFlashChart  Version 2.0.0  11/14/2008 
==============

1) rails ofc2_test_app
2) cd ofc2_test_app
3) script/plugin install http://github.com/pullmonkey/open_flash_chart.git -r test
4) script/generate controller test_it

5) Add the following to the test_it_controller.rb in RAILS_ROOT/app/controllers:
class TestItController < ApplicationController
  
  def index
    respond_to do |wants|
      wants.html {
        @graph = open_flash_chart_object( 600, 300, url_for( :action => 'index', :format => :json ) )
      }
      wants.json { 
        chart = OpenFlashChart.new( "MY TITLE" ) do |c|
          c << BarGlass.new( :values => (1..10).sort_by{rand} )
        end
        render :text => chart, :layout => false
      }
    end
  end

end

6) Add the following to index.html.erb in RAILS_ROOT/app/views/test_it/:
<html>
<head>
  <script type="text/javascript" src="/javascripts/swfobject.js"></script>
</head>
<body>
<%= @graph %>
</body>
</html>

7) script/server
8) Let me know how it goes, thanks.


Example
=======

# GOT THIS WORKING

    #$data = array();
    data = []

    #for( $i=0; $i<6.2; $i+=0.2 )
    #{
    #  $tmp = sin($i) * 1.9;
    #  $data[] = $tmp;
    #}

    (0..31).each do |x|
      data << Math.sin(x * 0.2) * 1.9
    end

    #include '../php-ofc-library/open-flash-chart.php';

    #$chart = new open_flash_chart();
    #$chart->set_title( new title( 'Area Chart' ) );

    chart = OFC::OpenFlashChart.new
    chart.title = OFC::Title.new(:text => "Area Chart")

    #//
    #// Make our area chart:
    #//
    #$area = new area();
    area = OFC::Area.new

    #// set the circle line width:
    #$area->set_width( 2 );
    area.width = 2

    #$area->set_default_dot_style( new hollow_dot() );
    area.dot_style = OFC::HollowDot.new

    #$area->set_colour( '#838A96' );
    area.colour = '#838A96'

    #$area->set_fill_colour( '#E01B49' );
    area.fill = '#E01B49'

    #$area->set_fill_alpha( 0.4 );
    area.fill_alpha = 0.4

    #$area->set_values( $data );
    area.values = data

    #// add the area object to the chart:
    #$chart->add_element( $area );
    chart.elements = []
    chart.elements << area

    #$y_axis = new y_axis();
    y_axis = OFC::YAxis.new

    #$y_axis->set_range( -2, 2, 2 );
    y_axis.min = -2
    y_axis.max = 2
    y_axis.steps = 2

    #$y_axis->labels = null;
    y_axis.lables = nil

    #$y_axis->set_offset( false );
    y_axis.offset = 0

    #$x_axis = new x_axis();
    x_axis = OFC::XAxis.new

    #$x_axis->labels = $data;
    x_axis.labels = data

    #$x_axis->set_steps( 2 );
    x_axis.steps = 2

    #$x_labels = new x_axis_labels();
    x_labels = OFC::XAxisLabels.new
    #$x_labels->set_steps( 4 );
    x_labels.steps = 4
    #$x_labels->set_vertical();
    x_labels.rotate = 270

    #// Add the X Axis Labels to the X Axis
    #$x_axis->set_labels( $x_labels );
    x_axis.labels = x_labels

    #$chart->add_y_axis( $y_axis );
    chart.y_axis = y_axis
    #$chart->x_axis = $x_axis;
    chart.x_axis = x_axis

    #echo $chart->toPrettyString();
    render :text => chart.render



Example above and more to follow here - http://www.pullmonkey.com/projects/open_flash_chart


Copyright (c) 2008 PullMonkey, released under the MIT license
Blog | Support | Training | Contact | API | Status | Twitter | Help | Security
© 2010 GitHub Inc. All rights reserved. | Terms of Service | Privacy Policy
Powered by the Dedicated Servers and
Cloud Computing of Rackspace Hosting®
Dedicated Server