From b89a845cd604dded7ed43224bfb11771c3f4b914 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 21 Oct 2010 17:35:13 -0400 Subject: [PATCH] Upgraded open_flash_chart --- README.markdown | 4 + app/controllers/polls_controller.rb | 39 +- app/views/polls/show.rhtml | 3 +- config/routes.rb | 4 +- public/javascripts/swfobject.js | 238 +---- public/open-flash-chart-bar-clicking.swf | Bin 0 -> 459061 bytes public/open-flash-chart.swf | Bin 64600 -> 276186 bytes vendor/plugins/open_flash_chart/MIT-LICENSE | 2 +- vendor/plugins/open_flash_chart/README | 80 +- .../assets/javascripts/swfobject.js | 5 + .../assets/open-flash-chart-bar-clicking.swf | Bin 0 -> 459061 bytes .../assets/open-flash-chart.swf | Bin 0 -> 276186 bytes vendor/plugins/open_flash_chart/init.rb | 8 +- vendor/plugins/open_flash_chart/install.rb | 18 +- .../open_flash_chart/lib/open_flash_chart.rb | 905 +----------------- .../lib/open_flash_chart/area_base.rb | 18 + .../lib/open_flash_chart/area_hollow.rb | 10 + .../lib/open_flash_chart/area_line.rb | 10 + .../lib/open_flash_chart/arrow.rb | 13 + .../lib/open_flash_chart/bar.rb | 18 + .../lib/open_flash_chart/bar_3d.rb | 17 + .../lib/open_flash_chart/bar_base.rb | 7 + .../lib/open_flash_chart/bar_filled.rb | 18 + .../lib/open_flash_chart/bar_glass.rb | 67 ++ .../lib/open_flash_chart/bar_sketch.rb | 13 + .../lib/open_flash_chart/bar_stack.rb | 29 + .../lib/open_flash_chart/base.rb | 123 +++ .../lib/open_flash_chart/candle.rb | 22 + .../lib/open_flash_chart/chart.rb | 13 + .../lib/open_flash_chart/dot_base.rb | 55 ++ .../lib/open_flash_chart/h_bar.rb | 26 + .../lib/open_flash_chart/legend.rb | 7 + .../lib/open_flash_chart/line.rb | 23 + .../lib/open_flash_chart/line_base.rb | 17 + .../lib/open_flash_chart/line_dot.rb | 17 + .../lib/open_flash_chart/line_hollow.rb | 10 + .../lib/open_flash_chart/line_style.rb | 12 + .../lib/open_flash_chart/linear_regression.rb | 39 + .../lib/open_flash_chart/menu.rb | 26 + .../lib/open_flash_chart/ofc_ajax.rb | 116 +++ .../open_flash_chart_object.rb | 53 + .../lib/open_flash_chart/pie.rb | 75 ++ .../lib/open_flash_chart/radar_axis.rb | 10 + .../lib/open_flash_chart/radar_axis_labels.rb | 10 + .../open_flash_chart/radar_spoke_labels.rb | 10 + .../lib/open_flash_chart/scatter.rb | 22 + .../lib/open_flash_chart/scatter_line.rb | 20 + .../lib/open_flash_chart/shape.rb | 20 + .../lib/open_flash_chart/sugar.rb | 27 + .../lib/open_flash_chart/tags.rb | 62 ++ .../lib/open_flash_chart/title.rb | 10 + .../lib/open_flash_chart/tooltip.rb | 25 + .../lib/open_flash_chart/upload_image.rb | 1 + .../lib/open_flash_chart/x_axis.rb | 18 + .../lib/open_flash_chart/x_axis_label.rb | 21 + .../lib/open_flash_chart/x_axis_labels.rb | 9 + .../lib/open_flash_chart/x_legend.rb | 10 + .../lib/open_flash_chart/y_axis.rb | 3 + .../lib/open_flash_chart/y_axis_base.rb | 7 + .../lib/open_flash_chart/y_axis_label.rb | 12 + .../lib/open_flash_chart/y_axis_labels.rb | 7 + .../lib/open_flash_chart/y_axis_right.rb | 4 + .../lib/open_flash_chart/y_legend.rb | 10 + .../lib/open_flash_chart/y_legend_right.rb | 6 + .../tasks/open_flash_chart_tasks.rake | 2 +- 65 files changed, 1348 insertions(+), 1138 deletions(-) create mode 100644 public/open-flash-chart-bar-clicking.swf create mode 100644 vendor/plugins/open_flash_chart/assets/javascripts/swfobject.js create mode 100644 vendor/plugins/open_flash_chart/assets/open-flash-chart-bar-clicking.swf create mode 100644 vendor/plugins/open_flash_chart/assets/open-flash-chart.swf create mode 100644 vendor/plugins/open_flash_chart/lib/open_flash_chart/area_base.rb create mode 100644 vendor/plugins/open_flash_chart/lib/open_flash_chart/area_hollow.rb create mode 100644 vendor/plugins/open_flash_chart/lib/open_flash_chart/area_line.rb create mode 100644 vendor/plugins/open_flash_chart/lib/open_flash_chart/arrow.rb create mode 100644 vendor/plugins/open_flash_chart/lib/open_flash_chart/bar.rb create mode 100644 vendor/plugins/open_flash_chart/lib/open_flash_chart/bar_3d.rb create mode 100644 vendor/plugins/open_flash_chart/lib/open_flash_chart/bar_base.rb create mode 100644 vendor/plugins/open_flash_chart/lib/open_flash_chart/bar_filled.rb create mode 100644 vendor/plugins/open_flash_chart/lib/open_flash_chart/bar_glass.rb create mode 100644 vendor/plugins/open_flash_chart/lib/open_flash_chart/bar_sketch.rb create mode 100644 vendor/plugins/open_flash_chart/lib/open_flash_chart/bar_stack.rb create mode 100644 vendor/plugins/open_flash_chart/lib/open_flash_chart/base.rb create mode 100644 vendor/plugins/open_flash_chart/lib/open_flash_chart/candle.rb create mode 100644 vendor/plugins/open_flash_chart/lib/open_flash_chart/chart.rb create mode 100644 vendor/plugins/open_flash_chart/lib/open_flash_chart/dot_base.rb create mode 100644 vendor/plugins/open_flash_chart/lib/open_flash_chart/h_bar.rb create mode 100644 vendor/plugins/open_flash_chart/lib/open_flash_chart/legend.rb create mode 100644 vendor/plugins/open_flash_chart/lib/open_flash_chart/line.rb create mode 100644 vendor/plugins/open_flash_chart/lib/open_flash_chart/line_base.rb create mode 100644 vendor/plugins/open_flash_chart/lib/open_flash_chart/line_dot.rb create mode 100644 vendor/plugins/open_flash_chart/lib/open_flash_chart/line_hollow.rb create mode 100644 vendor/plugins/open_flash_chart/lib/open_flash_chart/line_style.rb create mode 100644 vendor/plugins/open_flash_chart/lib/open_flash_chart/linear_regression.rb create mode 100644 vendor/plugins/open_flash_chart/lib/open_flash_chart/menu.rb create mode 100644 vendor/plugins/open_flash_chart/lib/open_flash_chart/ofc_ajax.rb create mode 100644 vendor/plugins/open_flash_chart/lib/open_flash_chart/open_flash_chart_object.rb create mode 100644 vendor/plugins/open_flash_chart/lib/open_flash_chart/pie.rb create mode 100644 vendor/plugins/open_flash_chart/lib/open_flash_chart/radar_axis.rb create mode 100644 vendor/plugins/open_flash_chart/lib/open_flash_chart/radar_axis_labels.rb create mode 100644 vendor/plugins/open_flash_chart/lib/open_flash_chart/radar_spoke_labels.rb create mode 100644 vendor/plugins/open_flash_chart/lib/open_flash_chart/scatter.rb create mode 100644 vendor/plugins/open_flash_chart/lib/open_flash_chart/scatter_line.rb create mode 100644 vendor/plugins/open_flash_chart/lib/open_flash_chart/shape.rb create mode 100644 vendor/plugins/open_flash_chart/lib/open_flash_chart/sugar.rb create mode 100644 vendor/plugins/open_flash_chart/lib/open_flash_chart/tags.rb create mode 100644 vendor/plugins/open_flash_chart/lib/open_flash_chart/title.rb create mode 100644 vendor/plugins/open_flash_chart/lib/open_flash_chart/tooltip.rb create mode 100644 vendor/plugins/open_flash_chart/lib/open_flash_chart/upload_image.rb create mode 100644 vendor/plugins/open_flash_chart/lib/open_flash_chart/x_axis.rb create mode 100644 vendor/plugins/open_flash_chart/lib/open_flash_chart/x_axis_label.rb create mode 100644 vendor/plugins/open_flash_chart/lib/open_flash_chart/x_axis_labels.rb create mode 100644 vendor/plugins/open_flash_chart/lib/open_flash_chart/x_legend.rb create mode 100644 vendor/plugins/open_flash_chart/lib/open_flash_chart/y_axis.rb create mode 100644 vendor/plugins/open_flash_chart/lib/open_flash_chart/y_axis_base.rb create mode 100644 vendor/plugins/open_flash_chart/lib/open_flash_chart/y_axis_label.rb create mode 100644 vendor/plugins/open_flash_chart/lib/open_flash_chart/y_axis_labels.rb create mode 100644 vendor/plugins/open_flash_chart/lib/open_flash_chart/y_axis_right.rb create mode 100644 vendor/plugins/open_flash_chart/lib/open_flash_chart/y_legend.rb create mode 100644 vendor/plugins/open_flash_chart/lib/open_flash_chart/y_legend_right.rb diff --git a/README.markdown b/README.markdown index 59d243f4..5773986e 100644 --- a/README.markdown +++ b/README.markdown @@ -34,6 +34,10 @@ The current version of OpenMind is 3.0. 3.0 adds many improvements, including: * Added a compatibility matrix of product release versions * Re-implemented the searching using Thinking Sphinx for improved search capability and reliability +Contributors +============ +Bob Sturim +Rich Sturim License ======= diff --git a/app/controllers/polls_controller.rb b/app/controllers/polls_controller.rb index 0b619063..8a17b133 100644 --- a/app/controllers/polls_controller.rb +++ b/app/controllers/polls_controller.rb @@ -19,36 +19,37 @@ def index def show session[:polls_show_toggle_detail] ||= "HIDE" - @poll = Poll.find(params[:id]) - # @chart_data = [] - # for option in @poll.poll_options - # data_point = [ option.description, option.user_responses.size] - # @chart_data << data_point unless option.user_responses.size == 0 - # end - @graph = open_flash_chart_object(450,450, pie_polls_path(:id => @poll.id), true, '/') + @poll = Poll.find(params[:id]) + puts "============ #{pie_poll_url(@poll)}" + @graph = open_flash_chart_object(450,450, pie_poll_url(@poll)) end def pie poll = Poll.find(params[:id]) - data = [] - labels = [] - g = Graph.new + # total_responses = poll.poll_options.collect(&:user_responses).size + pie_values = [] for option in poll.poll_options if option.user_responses.size > 0 - data << option.user_responses.size - labels << "#{StringUtils.truncate option.description, 16}" + pie_values << PieValue.new(option.user_responses.size, "#{StringUtils.truncate option.description, 16}") end end - g.pie(70, '#505050', '{background-color:#FFFFFF; font-size: 12px; color: #404040;}') - g.pie_values(data, labels) - g.set_bg_color('#FFFFFF') - g.pie_slice_colors(%w(#CF2626 #5767AF #D01FC3 #356AA0 #CF5ACD #CF750C #FF7200 #8F1A1A #ADD700 #57AF9D #C3CF5A #456F4F #C79810)) - # g.set_tool_tip("#val#") - # g.title("Pie Chart", '{font-size:18px; color: #d01f3c}' ) - render :text => g.render + pie_chart = Pie.new + pie_chart.start_angle = 35 + pie_chart.animate = true + pie_chart.tooltip = '#val# of #total#
#percent#' + pie_chart.values = pie_values + pie_chart.colours = %w(#CF2626 #5767AF #D01FC3 #356AA0 #CF5ACD #CF750C #FF7200 #8F1A1A #ADD700 #57AF9D #C3CF5A #456F4F #C79810) + + chart = OpenFlashChart.new + + chart.bg_colour = '#ffffcc' + chart.title = Title.new("Survey Responses") + chart.add_element(pie_chart) + chart.x_axis = nil + render :text => chart.to_s end diff --git a/app/views/polls/show.rhtml b/app/views/polls/show.rhtml index 4878b04e..c283748b 100644 --- a/app/views/polls/show.rhtml +++ b/app/views/polls/show.rhtml @@ -1,5 +1,4 @@ <%content_for :head do -%> - <%= javascript_include_tag "swfobject" %> <%end%> <%= javascript_include_tag "wz_tooltip.js", :cache => "cache/tooltip" %> @@ -124,7 +123,7 @@ <% if @poll.total_responses > 0 %> -
+
<%= @graph %>
<% end %> \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index b905985d..9cddacb4 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -28,9 +28,9 @@ map.resources :lookup_codes map.resources :merge_ideas map.resources :periodic_jobs, :member => { :rerun => :post } - map.resources :polls, :member => { :publish => :post, :unpublish => :post, + map.resources :polls, :member => { :publish => :post, :unpublish => :post, :pie => :get, :present_survey => :get, :take_survey => :post}, - :collection => {:toggle_details => :get, :pie => :get, :display_comments => :get } + :collection => {:toggle_details => :get, :display_comments => :get } map.resources :portal, :only => :index, :collection => {:auto_complete_for_user_email => :get } map.resources :products diff --git a/public/javascripts/swfobject.js b/public/javascripts/swfobject.js index caa256a2..08fb2700 100644 --- a/public/javascripts/swfobject.js +++ b/public/javascripts/swfobject.js @@ -1,233 +1,5 @@ -/** - * SWFObject v1.5: Flash Player detection and embed - http://blog.deconcept.com/swfobject/ - * - * SWFObject is (c) 2007 Geoff Stearns and is released under the MIT License: - * http://www.opensource.org/licenses/mit-license.php - * - */ -if(typeof deconcept == "undefined") var deconcept = new Object(); -if(typeof deconcept.util == "undefined") deconcept.util = new Object(); -if(typeof deconcept.SWFObjectUtil == "undefined") deconcept.SWFObjectUtil = new Object(); -deconcept.SWFObject = function(swf, id, w, h, ver, c, quality, xiRedirectUrl, redirectUrl, detectKey) { - if (!document.getElementById) { return; } - this.DETECT_KEY = detectKey ? detectKey : 'detectflash'; - this.skipDetect = deconcept.util.getRequestParameter(this.DETECT_KEY); - this.params = new Object(); - this.variables = new Object(); - this.attributes = new Array(); - if(swf) { this.setAttribute('swf', swf); } - if(id) { this.setAttribute('id', id); } - if(w) { this.setAttribute('width', w); } - if(h) { this.setAttribute('height', h); } - if(ver) { this.setAttribute('version', new deconcept.PlayerVersion(ver.toString().split("."))); } - this.installedVer = deconcept.SWFObjectUtil.getPlayerVersion(); - if (!window.opera && document.all && this.installedVer.major > 7) { - // only add the onunload cleanup if the Flash Player version supports External Interface and we are in IE - deconcept.SWFObject.doPrepUnload = true; - } - if(c) { this.addParam('bgcolor', c); } - var q = quality ? quality : 'high'; - this.addParam('quality', q); - this.setAttribute('useExpressInstall', false); - this.setAttribute('doExpressInstall', false); - var xir = (xiRedirectUrl) ? xiRedirectUrl : window.location; - this.setAttribute('xiRedirectUrl', xir); - this.setAttribute('redirectUrl', ''); - if(redirectUrl) { this.setAttribute('redirectUrl', redirectUrl); } -} -deconcept.SWFObject.prototype = { - useExpressInstall: function(path) { - this.xiSWFPath = !path ? "expressinstall.swf" : path; - this.setAttribute('useExpressInstall', true); - }, - setAttribute: function(name, value){ - this.attributes[name] = value; - }, - getAttribute: function(name){ - return this.attributes[name]; - }, - addParam: function(name, value){ - this.params[name] = value; - }, - getParams: function(){ - return this.params; - }, - addVariable: function(name, value){ - this.variables[name] = value; - }, - getVariable: function(name){ - return this.variables[name]; - }, - getVariables: function(){ - return this.variables; - }, - getVariablePairs: function(){ - var variablePairs = new Array(); - var key; - var variables = this.getVariables(); - for(key in variables){ - variablePairs[variablePairs.length] = key +"="+ variables[key]; - } - return variablePairs; - }, - getSWFHTML: function() { - var swfNode = ""; - if (navigator.plugins && navigator.mimeTypes && navigator.mimeTypes.length) { // netscape plugin architecture - if (this.getAttribute("doExpressInstall")) { - this.addVariable("MMplayerType", "PlugIn"); - this.setAttribute('swf', this.xiSWFPath); - } - swfNode = ' 0){ swfNode += 'flashvars="'+ pairs +'"'; } - swfNode += '/>'; - } else { // PC IE - if (this.getAttribute("doExpressInstall")) { - this.addVariable("MMplayerType", "ActiveX"); - this.setAttribute('swf', this.xiSWFPath); - } - swfNode = ''; - swfNode += ''; - var params = this.getParams(); - for(var key in params) { - swfNode += ''; - } - var pairs = this.getVariablePairs().join("&"); - if(pairs.length > 0) {swfNode += '';} - swfNode += ""; - } - return swfNode; - }, - write: function(elementId){ - if(this.getAttribute('useExpressInstall')) { - // check to see if we need to do an express install - var expressInstallReqVer = new deconcept.PlayerVersion([6,0,65]); - if (this.installedVer.versionIsValid(expressInstallReqVer) && !this.installedVer.versionIsValid(this.getAttribute('version'))) { - this.setAttribute('doExpressInstall', true); - this.addVariable("MMredirectURL", escape(this.getAttribute('xiRedirectUrl'))); - document.title = document.title.slice(0, 47) + " - Flash Player Installation"; - this.addVariable("MMdoctitle", document.title); - } - } - if(this.skipDetect || this.getAttribute('doExpressInstall') || this.installedVer.versionIsValid(this.getAttribute('version'))){ - var n = (typeof elementId == 'string') ? document.getElementById(elementId) : elementId; - n.innerHTML = this.getSWFHTML(); - return true; - }else{ - if(this.getAttribute('redirectUrl') != "") { - document.location.replace(this.getAttribute('redirectUrl')); - } - } - return false; - } -} - -/* ---- detection functions ---- */ -deconcept.SWFObjectUtil.getPlayerVersion = function(){ - var PlayerVersion = new deconcept.PlayerVersion([0,0,0]); - if(navigator.plugins && navigator.mimeTypes.length){ - var x = navigator.plugins["Shockwave Flash"]; - if(x && x.description) { - PlayerVersion = new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/, "").replace(/(\s+r|\s+b[0-9]+)/, ".").split(".")); - } - }else if (navigator.userAgent && navigator.userAgent.indexOf("Windows CE") >= 0){ // if Windows CE - var axo = 1; - var counter = 3; - while(axo) { - try { - counter++; - axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+ counter); -// document.write("player v: "+ counter); - PlayerVersion = new deconcept.PlayerVersion([counter,0,0]); - } catch (e) { - axo = null; - } - } - } else { // Win IE (non mobile) - // do minor version lookup in IE, but avoid fp6 crashing issues - // see http://blog.deconcept.com/2006/01/11/getvariable-setvariable-crash-internet-explorer-flash-6/ - try{ - var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7"); - }catch(e){ - try { - var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6"); - PlayerVersion = new deconcept.PlayerVersion([6,0,21]); - axo.AllowScriptAccess = "always"; // error if player version < 6.0.47 (thanks to Michael Williams @ Adobe for this code) - } catch(e) { - if (PlayerVersion.major == 6) { - return PlayerVersion; - } - } - try { - axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash"); - } catch(e) {} - } - if (axo != null) { - PlayerVersion = new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(",")); - } - } - return PlayerVersion; -} -deconcept.PlayerVersion = function(arrVersion){ - this.major = arrVersion[0] != null ? parseInt(arrVersion[0]) : 0; - this.minor = arrVersion[1] != null ? parseInt(arrVersion[1]) : 0; - this.rev = arrVersion[2] != null ? parseInt(arrVersion[2]) : 0; -} -deconcept.PlayerVersion.prototype.versionIsValid = function(fv){ - if(this.major < fv.major) return false; - if(this.major > fv.major) return true; - if(this.minor < fv.minor) return false; - if(this.minor > fv.minor) return true; - if(this.rev < fv.rev) return false; - return true; -} -/* ---- get value of query string param ---- */ -deconcept.util = { - getRequestParameter: function(param) { - var q = document.location.search || document.location.hash; - if (param == null) { return q; } - if(q) { - var pairs = q.substring(1).split("&"); - for (var i=0; i < pairs.length; i++) { - if (pairs[i].substring(0, pairs[i].indexOf("=")) == param) { - return pairs[i].substring((pairs[i].indexOf("=")+1)); - } - } - } - return ""; - } -} -/* fix for video streaming bug */ -deconcept.SWFObjectUtil.cleanupSWFs = function() { - var objects = document.getElementsByTagName("OBJECT"); - for (var i = objects.length - 1; i >= 0; i--) { - objects[i].style.display = 'none'; - for (var x in objects[i]) { - if (typeof objects[i][x] == 'function') { - objects[i][x] = function(){}; - } - } - } -} -// fixes bug in some fp9 versions see http://blog.deconcept.com/2006/07/28/swfobject-143-released/ -if (deconcept.SWFObject.doPrepUnload) { - if (!deconcept.unloadSet) { - deconcept.SWFObjectUtil.prepUnload = function() { - __flash_unloadHandler = function(){}; - __flash_savedUnloadHandler = function(){}; - window.attachEvent("onunload", deconcept.SWFObjectUtil.cleanupSWFs); - } - window.attachEvent("onbeforeunload", deconcept.SWFObjectUtil.prepUnload); - deconcept.unloadSet = true; - } -} -/* add document.getElementById if needed (mobile IE < 5) */ -if (!document.getElementById && document.all) { document.getElementById = function(id) { return document.all[id]; }} - -/* add some aliases for ease of use/backwards compatibility */ -var getQueryParamValue = deconcept.util.getRequestParameter; -var FlashObject = deconcept.SWFObject; // for legacy support -var SWFObject = deconcept.SWFObject; +/* SWFObject v2.1 + Copyright (c) 2007-2008 Geoff Stearns, Michael Williams, and Bobby van der Sluis + This software is released under the MIT License +*/ +var swfobject=function(){var b="undefined",Q="object",n="Shockwave Flash",p="ShockwaveFlash.ShockwaveFlash",P="application/x-shockwave-flash",m="SWFObjectExprInst",j=window,K=document,T=navigator,o=[],N=[],i=[],d=[],J,Z=null,M=null,l=null,e=false,A=false;var h=function(){var v=typeof K.getElementById!=b&&typeof K.getElementsByTagName!=b&&typeof K.createElement!=b,AC=[0,0,0],x=null;if(typeof T.plugins!=b&&typeof T.plugins[n]==Q){x=T.plugins[n].description;if(x&&!(typeof T.mimeTypes!=b&&T.mimeTypes[P]&&!T.mimeTypes[P].enabledPlugin)){x=x.replace(/^.*\s+(\S+\s+\S+$)/,"$1");AC[0]=parseInt(x.replace(/^(.*)\..*$/,"$1"),10);AC[1]=parseInt(x.replace(/^.*\.(.*)\s.*$/,"$1"),10);AC[2]=/r/.test(x)?parseInt(x.replace(/^.*r(.*)$/,"$1"),10):0}}else{if(typeof j.ActiveXObject!=b){var y=null,AB=false;try{y=new ActiveXObject(p+".7")}catch(t){try{y=new ActiveXObject(p+".6");AC=[6,0,21];y.AllowScriptAccess="always"}catch(t){if(AC[0]==6){AB=true}}if(!AB){try{y=new ActiveXObject(p)}catch(t){}}}if(!AB&&y){try{x=y.GetVariable("$version");if(x){x=x.split(" ")[1].split(",");AC=[parseInt(x[0],10),parseInt(x[1],10),parseInt(x[2],10)]}}catch(t){}}}}var AD=T.userAgent.toLowerCase(),r=T.platform.toLowerCase(),AA=/webkit/.test(AD)?parseFloat(AD.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,q=false,z=r?/win/.test(r):/win/.test(AD),w=r?/mac/.test(r):/mac/.test(AD);/*@cc_on q=true;@if(@_win32)z=true;@elif(@_mac)w=true;@end@*/return{w3cdom:v,pv:AC,webkit:AA,ie:q,win:z,mac:w}}();var L=function(){if(!h.w3cdom){return }f(H);if(h.ie&&h.win){try{K.write(" + + +<%= @graph %> + + + +7) script/server +8) Let me know how it goes, thanks. + + +Example +======= + +Example above and more to follow here - http://www.pullmonkey.com/projects/open_flash_chart + +Notes +====== +The plugin breaks if the json gem is included, because of the way that the gem generates json vs the rails native json generator. + +Not tested, but klochner claims to have implemented a fix for it here - http://github.com/klochner/open_flash_chart/commit/00cf531387880af8c49ed5118737f0492b437f75 + +Copyright (c) 2008 PullMonkey, released under the MIT license diff --git a/vendor/plugins/open_flash_chart/assets/javascripts/swfobject.js b/vendor/plugins/open_flash_chart/assets/javascripts/swfobject.js new file mode 100644 index 00000000..08fb2700 --- /dev/null +++ b/vendor/plugins/open_flash_chart/assets/javascripts/swfobject.js @@ -0,0 +1,5 @@ +/* SWFObject v2.1 + Copyright (c) 2007-2008 Geoff Stearns, Michael Williams, and Bobby van der Sluis + This software is released under the MIT License +*/ +var swfobject=function(){var b="undefined",Q="object",n="Shockwave Flash",p="ShockwaveFlash.ShockwaveFlash",P="application/x-shockwave-flash",m="SWFObjectExprInst",j=window,K=document,T=navigator,o=[],N=[],i=[],d=[],J,Z=null,M=null,l=null,e=false,A=false;var h=function(){var v=typeof K.getElementById!=b&&typeof K.getElementsByTagName!=b&&typeof K.createElement!=b,AC=[0,0,0],x=null;if(typeof T.plugins!=b&&typeof T.plugins[n]==Q){x=T.plugins[n].description;if(x&&!(typeof T.mimeTypes!=b&&T.mimeTypes[P]&&!T.mimeTypes[P].enabledPlugin)){x=x.replace(/^.*\s+(\S+\s+\S+$)/,"$1");AC[0]=parseInt(x.replace(/^(.*)\..*$/,"$1"),10);AC[1]=parseInt(x.replace(/^.*\.(.*)\s.*$/,"$1"),10);AC[2]=/r/.test(x)?parseInt(x.replace(/^.*r(.*)$/,"$1"),10):0}}else{if(typeof j.ActiveXObject!=b){var y=null,AB=false;try{y=new ActiveXObject(p+".7")}catch(t){try{y=new ActiveXObject(p+".6");AC=[6,0,21];y.AllowScriptAccess="always"}catch(t){if(AC[0]==6){AB=true}}if(!AB){try{y=new ActiveXObject(p)}catch(t){}}}if(!AB&&y){try{x=y.GetVariable("$version");if(x){x=x.split(" ")[1].split(",");AC=[parseInt(x[0],10),parseInt(x[1],10),parseInt(x[2],10)]}}catch(t){}}}}var AD=T.userAgent.toLowerCase(),r=T.platform.toLowerCase(),AA=/webkit/.test(AD)?parseFloat(AD.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,q=false,z=r?/win/.test(r):/win/.test(AD),w=r?/mac/.test(r):/mac/.test(AD);/*@cc_on q=true;@if(@_win32)z=true;@elif(@_mac)w=true;@end@*/return{w3cdom:v,pv:AC,webkit:AA,ie:q,win:z,mac:w}}();var L=function(){if(!h.w3cdom){return }f(H);if(h.ie&&h.win){try{K.write("' - temp << '' - end - - return temp.join("\r\n") - end -end - -class Line - attr_accessor :line_width, :color, :_key, :key, :key_size, :data, :tips, :var - def initialize(line_width, color) - @var = 'line' - @line_width = line_width - @color = color - @data = [] - @links = [] - @tips = [] - @_key = false - end - - def key(key, size) - @_key = true - @key = Graph.esc(key) - @key_size = size - end - - def add(data) - @data << (data.nil? ? 'null' : data) - end - - def add_link(data, link) - add(data) - @links << Graph.esc(link) - end - - def add_data_tip(data, tip) - add(data) - @tips << Graph.esc(tip) - end - - def add_data_link_tip(data, link, tip) - add_link(data, link) - @tips << Graph.esc(tip) - end - - def _get_variable_list - values = [] - values << @line_width - values << @color - if @_key - values << @key - values << @key_size - end - return values - end - - def toString(output_type, set_num) - values = _get_variable_list.join(",") - tmp = [] - - if output_type == 'js' - tmp << 'so.addVariable("' + @var + set_num.to_s + '","' + values + '");' - tmp << 'so.addVariable("values' + set_num.to_s + '","' + @data.join(",") + '");' - if !@links.empty? - tmp << 'so.addVariable("links' + set_num.to_s + '","' + @links.join(",") + '");' - end - if !@tips.empty? - tmp << 'so.addVariable("tool_tips_set' + set_num.to_s + '","' + @tips.join(",") + '");' - end - else - tmp << '&' + @var + set_num.to_s + '=' + values + '&' - tmp << '&values' + set_num.to_s + '=' + @data.join(",") + '&' - if !@links.empty? - tmp << '&links' + set_num.to_s + '=' + @links.join(",") + '&' - end - if !@tips.empty? - tmp << '&tool_tips_set' + set_num.to_s + '=' + @tips.join(",") + '&' - end - end - return tmp.join("\r\n") - end -end - -class LineHollow < Line - attr_accessor :dot_size, :var - def initialize(line_width, dot_size, color) - super(line_width, color) - @var = 'line_hollow' - @dot_size = dot_size - end - - def _get_variable_list - values = [] - values << @line_width - values << @color - if @_key - values << @key - values << @key_size - else - values << '' - values << '' - end - values << @dot_size - return values - end -end - -class LineDot < LineHollow - def initialize(line_width, dot_size, color) - super(line_width, dot_size, color) - @var = 'line_dot' - end -end - -class Bar - attr_accessor :color, :alpha, :data, :links, :_key, :key, :key_size, :tips, :var - - def initialize(alpha, color) - @var = 'bar' - @alpha = alpha - @color = color - @data = [] - @links = [] - @tips = [] - @_key = false - end - - def key(key, size) - @_key = true - @key = Graph.esc(key) - @key_size = size - end - - def add(data) - @data << (data.nil? ? 'null' : data) - end - - def add_link(data, link) - add(data) - @links << Graph.esc(link) - end - - def add_data_tip(data, tip) - add(data) - @tips << Graph.esc(tip) - end - - def _get_variable_list - values = [] - values << @alpha - values << @color - - if @_key - values << @key - values << @key_size - end - - return values - end - - def toString(output_type, set_num) - values = _get_variable_list.join(",") - - temp = [] - - if output_type == 'js' - temp << 'so.addVariable("' + @var + set_num.to_s + '","' + values + '");' - temp << 'so.addVariable("values' + set_num.to_s + '","' + @data.join(",") + '");' - if @links.size > 0 - temp << 'so.addVariable("links' + set_num.to_s + '","' + @links.join(",") + '");' - end - if @tips.size > 0 - temp << 'so.addVariable("tool_tips_set' + set_num.to_s + '","' + @tips.join(",") + '");' - end - else - temp << '&' + @var + set_num.to_s + '=' + values + '&' - temp << '&values' + set_num.to_s + '=' + @data.join(",") + '&' - if @links.size > 0 - temp << '&links' + set_num.to_s + '=' + @links.join(",") + '&' - end - if @tips.size > 0 - temp << '&tool_tips_set' + set_num.to_s + '=' + @tips.join(",") + '&' - end - end - - return temp.join("\r\n") - end -end - -class Bar3d < Bar - def initialize(alpha, color) - super(alpha,color) - @var = 'bar_3d' - end -end - -class BarFade < Bar - def initialize(alpha, color) - super(alpha, color) - @var = 'bar_fade' - end -end - -class BarOutline < Bar - def initialize(alpha, color, outline_color) - super(alpha, color) - @var = 'filled_bar' - @outline_color = outline_color - end - - def _get_variable_list - values = [] - values << @alpha - values << @color - values << @outline_color - - if @_key - values << @key - values << @key_size - end - - return values - end -end - -class BarGlass < BarOutline - def initialize(alpha, color, outline_color) - super(alpha, color, outline_color) - @var = 'bar_glass' - end -end - -class BarSketch < BarOutline - def initialize(alpha, offset, color, outline_color) - super(alpha, color, outline_color) - @var = 'bar_sketch' - @offset = offset - end - - def _get_variable_list - values = [] - values << @alpha - values << @offset - values << @color - values << @outline_color - - if @_key - values << @key - values << @key_size - end - - return values - end -end - -class Candle - def initialize(high, open, close, low) - @out = [] - @out << high - @out << open - @out << close - @out << low - end - - def toString - return '[' + @out.join(",") + ']' - end -end - -class Hlc - def initialize(high, low, close) - @out = [high, low, close] - end - - def toString - return '[' + @out.join(",") + ']' - end -end - -class Point - def initialize(x,y,size_px) - @out = [x,y,size_px] - end - - def toString - return '[' + @out.join(',') + ']' - end -end - -$open_flash_chart_seqno = nil - -def _ofc(width, height, url, use_swfobject, base="/", set_wmode_transparent=false) - url = CGI::escape(url) - out = [] - - protocol = 'http' - if request.env["HTTPS"] == 'on' - protocol = 'https' - end - - obj_id = 'chart' - div_name = 'flashcontent' - - if !$open_flash_chart_seqno - $open_flash_chart_seqno = 1 - out << '' - else - $open_flash_chart_seqno += 1 - obj_id += "_#{$open_flash_chart_seqno}" - div_name += "_#{$open_flash_chart_seqno}" - end - - if use_swfobject - out << '
' - out << '' - out << '' - end - - return out.join("\n") -end - -def open_flash_chart_object_str(width, height, url, use_swfobject=true, base='/', set_wmode_transparent=false) - return _ofc(width, height, url, use_swfobject, base, set_wmode_transparent) -end - -def open_flash_chart_object(width, height, url, use_swfobject=true, base='/', set_wmode_transparent=false) - return _ofc(width, height, url, use_swfobject, base, set_wmode_transparent) -end +require 'open_flash_chart/base' +require 'open_flash_chart/bar_base' +require 'open_flash_chart/bar' +require 'open_flash_chart/bar_3d' +require 'open_flash_chart/bar_glass' +require 'open_flash_chart/bar_sketch' +require 'open_flash_chart/bar_filled' +require 'open_flash_chart/bar_stack' +require 'open_flash_chart/candle' +require 'open_flash_chart/chart' +require 'open_flash_chart/h_bar' +require 'open_flash_chart/dot_base' +require 'open_flash_chart/line_base' +require 'open_flash_chart/line' +require 'open_flash_chart/line_dot' +require 'open_flash_chart/line_hollow' +require 'open_flash_chart/line_style' +require 'open_flash_chart/pie' +require 'open_flash_chart/scatter' +require 'open_flash_chart/scatter_line' +require 'open_flash_chart/radar_axis_labels' +require 'open_flash_chart/radar_axis' +require 'open_flash_chart/radar_spoke_labels' +require 'open_flash_chart/title' +require 'open_flash_chart/x_axis_label' +require 'open_flash_chart/x_axis_labels' +require 'open_flash_chart/x_axis' +require 'open_flash_chart/x_legend' +require 'open_flash_chart/y_axis_base' +require 'open_flash_chart/y_axis' +require 'open_flash_chart/y_axis_labels' +require 'open_flash_chart/y_axis_label' +require 'open_flash_chart/y_axis_right' +require 'open_flash_chart/y_legend' +require 'open_flash_chart/y_legend_right' +require 'open_flash_chart/legend' +require 'open_flash_chart/tooltip' +require 'open_flash_chart/area_base' +require 'open_flash_chart/area_hollow' +require 'open_flash_chart/area_line' +require 'open_flash_chart/shape' +require 'open_flash_chart/upload_image' +require 'open_flash_chart/radar_axis_labels' +require 'open_flash_chart/radar_axis' +require 'open_flash_chart/radar_spoke_labels' +require 'open_flash_chart/linear_regression' +require 'open_flash_chart/arrow' +require 'open_flash_chart/menu' +require 'open_flash_chart/sugar' +require 'open_flash_chart/tags' + +require 'open_flash_chart/ofc_ajax' +require 'open_flash_chart/open_flash_chart_object' diff --git a/vendor/plugins/open_flash_chart/lib/open_flash_chart/area_base.rb b/vendor/plugins/open_flash_chart/lib/open_flash_chart/area_base.rb new file mode 100644 index 00000000..8775f541 --- /dev/null +++ b/vendor/plugins/open_flash_chart/lib/open_flash_chart/area_base.rb @@ -0,0 +1,18 @@ +module OpenFlashChart + class AreaBase < Base + def initialize args={} + super + @type = "area" + @fill_alpha = 0.35 + @values = [] + end + + def set_fill_colour(color) + @fill = color + end + + def set_loop + @loop = true + end + end +end diff --git a/vendor/plugins/open_flash_chart/lib/open_flash_chart/area_hollow.rb b/vendor/plugins/open_flash_chart/lib/open_flash_chart/area_hollow.rb new file mode 100644 index 00000000..64edf353 --- /dev/null +++ b/vendor/plugins/open_flash_chart/lib/open_flash_chart/area_hollow.rb @@ -0,0 +1,10 @@ +module OpenFlashChart + + class AreaHollow < AreaBase + def initialize args={} + super + @type = "area_hollow" + end + end + +end \ No newline at end of file diff --git a/vendor/plugins/open_flash_chart/lib/open_flash_chart/area_line.rb b/vendor/plugins/open_flash_chart/lib/open_flash_chart/area_line.rb new file mode 100644 index 00000000..63044e2d --- /dev/null +++ b/vendor/plugins/open_flash_chart/lib/open_flash_chart/area_line.rb @@ -0,0 +1,10 @@ +module OpenFlashChart + + class AreaLine < AreaBase + def initialize args={} + super + @type = "area_line" + end + end + +end \ No newline at end of file diff --git a/vendor/plugins/open_flash_chart/lib/open_flash_chart/arrow.rb b/vendor/plugins/open_flash_chart/lib/open_flash_chart/arrow.rb new file mode 100644 index 00000000..a194b2f6 --- /dev/null +++ b/vendor/plugins/open_flash_chart/lib/open_flash_chart/arrow.rb @@ -0,0 +1,13 @@ +module OpenFlashChart + + class AreaLine + def initialize(x, y, a, b, colour, barb_length=10) + @type = "arrow" + @start = {:x => x, :y => y} + @end = {:x => a, :y => b} + @colour = colour + @barb_length = barb_length + end + end + +end diff --git a/vendor/plugins/open_flash_chart/lib/open_flash_chart/bar.rb b/vendor/plugins/open_flash_chart/lib/open_flash_chart/bar.rb new file mode 100644 index 00000000..bac6f900 --- /dev/null +++ b/vendor/plugins/open_flash_chart/lib/open_flash_chart/bar.rb @@ -0,0 +1,18 @@ +module OpenFlashChart + + class Bar < BarBase + def initialize args={} + super + @type = "bar" + end + end + + class BarValue < Base + def initialize( top, bottom=nil, args={} ) + @top = top + @bottom = bottom + super args + end + end + +end \ No newline at end of file diff --git a/vendor/plugins/open_flash_chart/lib/open_flash_chart/bar_3d.rb b/vendor/plugins/open_flash_chart/lib/open_flash_chart/bar_3d.rb new file mode 100644 index 00000000..13966671 --- /dev/null +++ b/vendor/plugins/open_flash_chart/lib/open_flash_chart/bar_3d.rb @@ -0,0 +1,17 @@ +module OpenFlashChart + + class Bar3d < BarBase + def initialize args={} + super + @type = "bar_3d" + end + end + + class Bar3dValue < Base + def initialize(top, args={}) + @top = top + super args + end + end + +end \ No newline at end of file diff --git a/vendor/plugins/open_flash_chart/lib/open_flash_chart/bar_base.rb b/vendor/plugins/open_flash_chart/lib/open_flash_chart/bar_base.rb new file mode 100644 index 00000000..089ff256 --- /dev/null +++ b/vendor/plugins/open_flash_chart/lib/open_flash_chart/bar_base.rb @@ -0,0 +1,7 @@ +module OpenFlashChart + class BarBase < Base + def attach_to_right_y_axis + @axis = 'right' + end + end +end diff --git a/vendor/plugins/open_flash_chart/lib/open_flash_chart/bar_filled.rb b/vendor/plugins/open_flash_chart/lib/open_flash_chart/bar_filled.rb new file mode 100644 index 00000000..8be1de50 --- /dev/null +++ b/vendor/plugins/open_flash_chart/lib/open_flash_chart/bar_filled.rb @@ -0,0 +1,18 @@ +module OpenFlashChart + + class BarFilled < BarBase + def initialize(colour=nil, outline_colour=nil, args={}) + super args + @type = "bar_filled" + @colour = colour + @outline_colour = outline_colour + end + end + + class BarFilledValue < BarValue + def initialize(top, bottom=nil, args={}) + super + end + end + +end \ No newline at end of file diff --git a/vendor/plugins/open_flash_chart/lib/open_flash_chart/bar_glass.rb b/vendor/plugins/open_flash_chart/lib/open_flash_chart/bar_glass.rb new file mode 100644 index 00000000..5e0d5c92 --- /dev/null +++ b/vendor/plugins/open_flash_chart/lib/open_flash_chart/bar_glass.rb @@ -0,0 +1,67 @@ +module OpenFlashChart + + class BarOnShow < Base + def initialize(type, cascade, delay) + @type = type + @cascade = cascade.to_f + @delay = delay.to_f + end + end + + class BarGlass < BarBase + def initialize args={} + super + @type = "bar_glass" + end + end + + class BarCylinder < BarBase + def initialize args={} + super + @type = "bar_cylinder" + end + end + + class BarCylinderOutline < BarBase + def initialize args={} + super + @type = "bar_cylinder_outline" + end + end + + class BarRoundedGlass < BarBase + def initialize args={} + super + @type = "bar_rounded_glass" + end + end + + class BarRound < BarBase + def initialize args={} + super + @type = "bar_round" + end + end + + class BarDome < BarBase + def initialize args={} + super + @type = "bar_dome" + end + end + + class BarRound3d < BarBase + def initialize args={} + super + @type = "bar_round3d" + end + end + + class BarGlassValue < Base + def initialize(top, args={}) + @top = top + super args + end + end + +end diff --git a/vendor/plugins/open_flash_chart/lib/open_flash_chart/bar_sketch.rb b/vendor/plugins/open_flash_chart/lib/open_flash_chart/bar_sketch.rb new file mode 100644 index 00000000..76d5a682 --- /dev/null +++ b/vendor/plugins/open_flash_chart/lib/open_flash_chart/bar_sketch.rb @@ -0,0 +1,13 @@ +module OpenFlashChart + + class BarSketch < BarBase + def initialize(colour, outline_colour, fun_factor, args = {} ) + super args + @type = "bar_sketch" + @colour = colour + @outline_colour = outline_colour + @offset = fun_factor + end + end + +end \ No newline at end of file diff --git a/vendor/plugins/open_flash_chart/lib/open_flash_chart/bar_stack.rb b/vendor/plugins/open_flash_chart/lib/open_flash_chart/bar_stack.rb new file mode 100644 index 00000000..4282675d --- /dev/null +++ b/vendor/plugins/open_flash_chart/lib/open_flash_chart/bar_stack.rb @@ -0,0 +1,29 @@ +module OpenFlashChart + + class BarStack < BarBase + def initialize args={} + super + @type = "bar_stack" + end + + alias_method :append_stack, :append_value + end + + class BarStackValue < Base + def initialize(val,colour, args={}) + @val = val + @colour = colour + super(args) + end + end + + class BarStackKey < Base + def initialize(colour, text, font_size, args={}) + @colour = colour + @text = text + @font_size = font_size + super(args) + end + end + +end diff --git a/vendor/plugins/open_flash_chart/lib/open_flash_chart/base.rb b/vendor/plugins/open_flash_chart/lib/open_flash_chart/base.rb new file mode 100644 index 00000000..835db5aa --- /dev/null +++ b/vendor/plugins/open_flash_chart/lib/open_flash_chart/base.rb @@ -0,0 +1,123 @@ +module OpenFlashChart + class Base + + def initialize(args={}) + # set all the instance variables we want + # assuming something like this OpenFlashChart.new(:x_axis => 5, :y_axis => 10, :elements => ["one", "two"], ...) + args.each do |k,v| + self.instance_variable_set("@#{k}", v) + end + yield self if block_given? # magic pen pattern + end + + # same as to_s but won't stack overflow ... use this instead of to_s + def render + # need to return the following like this + # 1) font_size as font-size + # 2) dot_size as dot-size + # 3) outline_colour as outline-colour + # 4) halo_size as halo-size + # 5) start_angle as start-angle + # 6) tick_height as tick-height + # 7) grid_colour as grid-colour + # 8) threed as 3d + # 9) tick_length as tick-length + # 10) visible_steps as visible-steps + # 11) key_on_click as key-on-click + # 12) barb_length as barb-length + # 13) on_show as on-show + # 14) negative_colour as negative-colour + # 15) line_style as line-style + # 16) on_click as on-click + # 17) javascript_function_name as javascript-function-name + # 18) pad_x to pad-x + # 19) pad_y to pad-y + # 20) align_x to align-x + # 21) align_y to align-y + # 22) dot_style to dot-style + # 23) hollow_dot to hollow-dot + # 24) default_dot_style to dot-style + self.to_json2.tap do |output| + output.gsub!("threed","3d") + output.gsub!("default_dot_style","dot-style") + %w(font_size dot_size outline_colour halo_size start_angle tick_height grid_colour tick_length no_labels label_colour gradient_fill fill_alpha on_click spoke_labels visible_steps key_on_click barb_length on_show negative_colour line_style javascript_function_name pad_x pad_y align_x align_y dot_style hollow_dot).each do |replace| + output.gsub!(replace, replace.gsub("_", "-")) + end + end + end + + def to_json2 + self.instance_values.to_json + end + + alias_method :to_s, :render + + def add_element(element) + @elements ||= [] + @elements << element + end + + def <<(e) + add_element e + end + + def set_key(text, size) + @text = text + @font_size = size + end + + def append_value(v) + @values ||= [] + @values << v + end + + def set_range(min,max,steps=1) + @min = min + @max = max + @steps = steps + end + + def set_offset(v) + @offset = v ? true : false + end + + def set_colours(colours, grid_colour) + @colours = colours + @grid_colour = grid_colour + end + + def set_tooltip(tip) + if tip.is_a?(Tooltip) + #we have a style for our chart's tooltips + @tooltip = tip + else + # the user could just use set_tip(tip) or tip=(tip) to just set the text of the tooltip + @tip = tip + end + end + alias_method "tooltip=", :set_tooltip + + def attach_to_right_y_axis + @axis = 'right' + end + + + + + def method_missing(method_name, *args, &blk) + case method_name.to_s + when /(.*)=/ # i.e., if it is something x_legend= + # if the user wants to set an instance variable then let them + # the other args (args[0]) are ignored since it is a set method + self.instance_variable_set("@#{$1}", args[0]) + when /^set_(.*)/ + # backwards compatible ... the user can still use the same set_y_legend methods if they want + self.instance_variable_set("@#{$1}", args[0]) + else + # if the method/attribute is missing and it is not a set method then hmmmm better let the user know + super + end + end + + end +end diff --git a/vendor/plugins/open_flash_chart/lib/open_flash_chart/candle.rb b/vendor/plugins/open_flash_chart/lib/open_flash_chart/candle.rb new file mode 100644 index 00000000..ebcada0f --- /dev/null +++ b/vendor/plugins/open_flash_chart/lib/open_flash_chart/candle.rb @@ -0,0 +1,22 @@ +module OpenFlashChart + + class Candle < Base + def initialize(colour, negative_colour, args={}) + @colour = colour + @negative_colour = negative_colour + super args + @type = "candle" + end + end + + class CandleValue < Base + def initialize( high, open, close, low, args={} ) + @top = open + @bottom = close + @low = low + @high = high + super args + end + end + +end diff --git a/vendor/plugins/open_flash_chart/lib/open_flash_chart/chart.rb b/vendor/plugins/open_flash_chart/lib/open_flash_chart/chart.rb new file mode 100644 index 00000000..a7e1a131 --- /dev/null +++ b/vendor/plugins/open_flash_chart/lib/open_flash_chart/chart.rb @@ -0,0 +1,13 @@ +module OpenFlashChart + + class Chart < Base + def initialize( title=nil, args={}) + super args + @title = Title.new( title ) if title + end + end + + class OpenFlashChart < Chart + end + +end diff --git a/vendor/plugins/open_flash_chart/lib/open_flash_chart/dot_base.rb b/vendor/plugins/open_flash_chart/lib/open_flash_chart/dot_base.rb new file mode 100644 index 00000000..5e279da6 --- /dev/null +++ b/vendor/plugins/open_flash_chart/lib/open_flash_chart/dot_base.rb @@ -0,0 +1,55 @@ +module OpenFlashChart + + class DotBase < Base + def initialize type, value=nil, args={} + super args + @type = type + @value = value if value + end + + def position=(x, y) + @x = x + @y = y + end + + def size=(size) + @dot_size = size + end + end + + class HollowDot < DotBase + def initialize(value=nil, args={}) + super 'hollow_dot', value, args + end + end + + class Star < DotBase + def initialize(value=nil, args={}) + super 'star', value, args + end + end + + class Bow < DotBase + def initialize(value=nil, args={}) + super 'bow', value, args + end + end + + class Anchor < DotBase + def initialize(value=nil, args={}) + super 'anchor', value, args + end + end + + class Dot < DotBase + def initialize(value=nil, args={}) + super 'dot', value, args + end + end + + class SolidDot < DotBase + def initialize(value=nil, args={}) + super 'solid-dot', value, args + end + end +end diff --git a/vendor/plugins/open_flash_chart/lib/open_flash_chart/h_bar.rb b/vendor/plugins/open_flash_chart/lib/open_flash_chart/h_bar.rb new file mode 100644 index 00000000..c3a7c200 --- /dev/null +++ b/vendor/plugins/open_flash_chart/lib/open_flash_chart/h_bar.rb @@ -0,0 +1,26 @@ +module OpenFlashChart + + class HBarValue < Base + def initialize(left,right=nil, args={}) + super args + @left = left if right + @right = right || left + end + end + + class HBar < Base + def initialize(colour="#9933CC", args={}) + super args + @type = "hbar" + @colour = colour + @values = [] + end + + def set_values(v) + v.each do |val| + append_value(HBarValue.new(val)) + end + end + end + +end diff --git a/vendor/plugins/open_flash_chart/lib/open_flash_chart/legend.rb b/vendor/plugins/open_flash_chart/lib/open_flash_chart/legend.rb new file mode 100644 index 00000000..89acf30b --- /dev/null +++ b/vendor/plugins/open_flash_chart/lib/open_flash_chart/legend.rb @@ -0,0 +1,7 @@ +module OpenFlashChart + + class Legend < Base + end + +end + diff --git a/vendor/plugins/open_flash_chart/lib/open_flash_chart/line.rb b/vendor/plugins/open_flash_chart/lib/open_flash_chart/line.rb new file mode 100644 index 00000000..fbe41551 --- /dev/null +++ b/vendor/plugins/open_flash_chart/lib/open_flash_chart/line.rb @@ -0,0 +1,23 @@ +module OpenFlashChart + + class LineOnShow < Base + def initialize(type, cascade, delay) + @type = type + @cascade = cascade.to_F + @delay = delay.to_f + end + end + + class Line < LineBase + def initialize args={} + super + @type = "line" + @values = [] + end + + def set_default_dot_style(style) + @dot_style = style + end + end + +end diff --git a/vendor/plugins/open_flash_chart/lib/open_flash_chart/line_base.rb b/vendor/plugins/open_flash_chart/lib/open_flash_chart/line_base.rb new file mode 100644 index 00000000..199a6093 --- /dev/null +++ b/vendor/plugins/open_flash_chart/lib/open_flash_chart/line_base.rb @@ -0,0 +1,17 @@ +module OpenFlashChart + + class LineBase < Base + def initialize args={} + super + @type = "line" + @text = "Page Views" + @font_size = 10 + @values = [] + end + + def loop + @loop = true + end + end + +end diff --git a/vendor/plugins/open_flash_chart/lib/open_flash_chart/line_dot.rb b/vendor/plugins/open_flash_chart/lib/open_flash_chart/line_dot.rb new file mode 100644 index 00000000..e6570880 --- /dev/null +++ b/vendor/plugins/open_flash_chart/lib/open_flash_chart/line_dot.rb @@ -0,0 +1,17 @@ +module OpenFlashChart + + class LineDot < LineBase + def initialize args={} + super + @type = "line_dot" + end + end + + class DotValue < Base + def initialize(value, colour, args={}) + @value = value + @colour = colour + super(args) + end + end +end diff --git a/vendor/plugins/open_flash_chart/lib/open_flash_chart/line_hollow.rb b/vendor/plugins/open_flash_chart/lib/open_flash_chart/line_hollow.rb new file mode 100644 index 00000000..ec2bf7cd --- /dev/null +++ b/vendor/plugins/open_flash_chart/lib/open_flash_chart/line_hollow.rb @@ -0,0 +1,10 @@ +module OpenFlashChart + + class LineHollow < LineBase + def initialize args={} + super + @type = "line_hollow" + end + end + +end \ No newline at end of file diff --git a/vendor/plugins/open_flash_chart/lib/open_flash_chart/line_style.rb b/vendor/plugins/open_flash_chart/lib/open_flash_chart/line_style.rb new file mode 100644 index 00000000..0daa8b73 --- /dev/null +++ b/vendor/plugins/open_flash_chart/lib/open_flash_chart/line_style.rb @@ -0,0 +1,12 @@ +module OpenFlashChart + + class LineStyle < LineBase + def initialize on, off, args={} + super args + @on = on + @off = off + @style = "dash" + end + end + +end diff --git a/vendor/plugins/open_flash_chart/lib/open_flash_chart/linear_regression.rb b/vendor/plugins/open_flash_chart/lib/open_flash_chart/linear_regression.rb new file mode 100644 index 00000000..bff8e99f --- /dev/null +++ b/vendor/plugins/open_flash_chart/lib/open_flash_chart/linear_regression.rb @@ -0,0 +1,39 @@ +# by David Lowenfels @ InternautDesign.com +# example usage: fitted_data = LinearRegression.new(data).fit + +class LinearRegression + attr_accessor :slope, :offset + + def initialize dx, dy=nil + @size = dx.size + if @size == 1 + @slope, @offset = 1,0 + return + end + dy,dx = dx,axis() unless dy # make 2D if given 1D + raise "arguments not same length!" unless @size == dy.size + sxx = sxy = sx = sy = 0 + dx.zip(dy).each do |x,y| + sxy += x*y + sxx += x*x + sx += x + sy += y + end + @slope = ( @size * sxy - sx*sy ) / ( @size * sxx - sx * sx ) + @offset = (sy - @slope*sx) / @size + end + + def fit + return axis.map{|data| predict(data) } + end + + private + + def predict( x ) + y = @slope * x + @offset + end + + def axis + (0...@size).to_a + end +end diff --git a/vendor/plugins/open_flash_chart/lib/open_flash_chart/menu.rb b/vendor/plugins/open_flash_chart/lib/open_flash_chart/menu.rb new file mode 100644 index 00000000..c7752b76 --- /dev/null +++ b/vendor/plugins/open_flash_chart/lib/open_flash_chart/menu.rb @@ -0,0 +1,26 @@ +module OpenFlashChart + + class MenuItem < Base + def initialize(text, javascript_function_name, args={}) + @type = "text" + @text = text + @javascript_function_name = javascript_function_name + end + end + + class MenuItemCamera < Base + def initialize text, javascript_function_name + @type = "camera-icon" + @text = text + @javascript_function_name = javascript_function_name + end + end + + class Menu < Base + def initialize colour, outline_colour + @values = [] + @colour = colour + @outline_colour = outline_colour + end + end +end diff --git a/vendor/plugins/open_flash_chart/lib/open_flash_chart/ofc_ajax.rb b/vendor/plugins/open_flash_chart/lib/open_flash_chart/ofc_ajax.rb new file mode 100644 index 00000000..19b9c021 --- /dev/null +++ b/vendor/plugins/open_flash_chart/lib/open_flash_chart/ofc_ajax.rb @@ -0,0 +1,116 @@ +module OpenFlashChart + module View + def periodically_call_function(function, options = {}) + frequency = options[:frequency] || 10 # every ten seconds by default + code = "new PeriodicalExecuter(function() {#{function}}, #{frequency})" + ActionView::Base.new.javascript_tag(code) + end + + def js_open_flash_chart_object(div_name, width, height, base="/", options={}) + <<-OUTPUT + + #{self.to_open_flash_chart_data(div_name)} +
+ OUTPUT + end + + def link_to_ofc_load(link_text, div_name) + data_name = "#{link_text.gsub(" ","_")}_#{div_name.gsub(" ","_")}" + <<-OUTPUT + + #{ActionView::Base.new.link_to_function link_text, "load_#{data_name}()"} + OUTPUT + end + + def link_to_remote_ofc_load(link_text, div_name, url) + fx_name = "#{link_text.gsub(" ","_")}_#{div_name.gsub(" ","_")}" + <<-OUTPUT + + #{ActionView::Base.new.link_to_function link_text, "reload_#{fx_name}()"} + OUTPUT + end + + def periodically_call_to_remote_ofc_load(div_name, url, options={}) + fx_name = "#{div_name.gsub(" ","_")}" + # fix a bug in rails with url_for + url = url.gsub("&","&") + <<-OUTPUT + + #{periodically_call_function("reload_#{fx_name}()", options)} + OUTPUT + end + + def findSWF_method + <<-OUTPUT + function findSWF(movieName) { + if (navigator.appName.indexOf("Microsoft")!= -1) { + return window[movieName]; + } else { + return document[movieName]; + } + } + OUTPUT + end + + def to_open_flash_chart_data(id="in", options={}) + # this builds the open_flash_chart_data js function + <<-OUTPUT + + OUTPUT + end + + def save_as_image(post_url, options={}) + id = options[:id] || "in" + + <<-OUTPUT + + OUTPUT + end + end +end diff --git a/vendor/plugins/open_flash_chart/lib/open_flash_chart/open_flash_chart_object.rb b/vendor/plugins/open_flash_chart/lib/open_flash_chart/open_flash_chart_object.rb new file mode 100644 index 00000000..71249a4b --- /dev/null +++ b/vendor/plugins/open_flash_chart/lib/open_flash_chart/open_flash_chart_object.rb @@ -0,0 +1,53 @@ +require 'digest/sha1' + +module OpenFlashChart + module Controller + def open_flash_chart_object(width, height, url, use_swfobject=true, base="/", swf_file_name="open-flash-chart.swf") + get_object_values(url) + get_html(@ofc_url, @div_name, base, swf_file_name, width, height, @protocol, @obj_id) + end + + # if you want the div name back for working with js, this is the ticket + def open_flash_chart_object_and_div_name(width, height, url, use_swfobject=true, base="/", swf_file_name="open-flash-chart.swf") + get_object_values(url) + html = get_html(@ofc_url, @div_name, base, swf_file_name, width, height, @protocol, @obj_id) + return [html, @div_name] + end + + def open_flash_chart_object_from_hash(url, options={}) + get_object_values(url) + get_html(@ofc_url, + options[:div_name] || @div_name, + options[:base] || "/", + options[:swf_file_name] || "open-flash-chart.swf", + options[:width] || 550, + options[:height] || 300, + options[:protocol] || @protocol, + options[:obj_id] || @obj_id) + end + + def get_object_values(url) + @ofc_url = CGI::escape(url) + # need something that will not be repeated on the same request + @special_hash = Base64.encode64(Digest::SHA1.digest("#{rand(1<<64)}/#{Time.now.to_f}/#{Process.pid}/#{@ofc_url}"))[0..7] + # only good characters for our div + @special_hash = @special_hash.gsub(/[^a-zA-Z0-9]/,rand(10).to_s) + @obj_id = "chart_#{@special_hash}" # some sequencing without all the work of tracking it + @div_name = "flash_content_#{@special_hash}" + @protocol = "http" # !request.nil? ? request.env["HTTPS"] || "http" : "http" + end + + def get_html(url, div_name, base, swf_file_name, width, height, protocol, obj_id) + # NOTE: users should put this in the section themselves: + ## + + <<-HTML +
+ + HTML + end + end + +end diff --git a/vendor/plugins/open_flash_chart/lib/open_flash_chart/pie.rb b/vendor/plugins/open_flash_chart/lib/open_flash_chart/pie.rb new file mode 100644 index 00000000..1ef5596f --- /dev/null +++ b/vendor/plugins/open_flash_chart/lib/open_flash_chart/pie.rb @@ -0,0 +1,75 @@ +module OpenFlashChart + + class PieValue < Base + def initialize(value, label, args={}) + super args + @value = value + @label = label + @animate = [] + end + + def set_label(label, label_color, font_size) + self.label = label + self.label_colour = label_color + self.font_size = font_size + end + + def on_click(event) + @on_click = event + end + + def add_animation animation + @animate ||= [] + @animate << animation + return self + end + end + + class BasePieAnimation < Base; end + + class PieFade < BasePieAnimation + def initialize args={} + @type = "fade" + super + end + end + + class PieBounce < BasePieAnimation + def initialize distance, args={} + @type = "bounce" + @distance = distance + super + end + end + + class Pie < Base + def initialize args={} + @type = "pie" + @colours = [] + super + end + + def set_animate bool + self.add_animation PieFade.new if bool + end + + def add_animation animation + @animate ||= [] + @animate << animation + return self + end + + def set_gradient_fill + @gradient_fill = true + end + + def set_no_labels + @no_labels = true + end + + def on_click(event) + @on_click = event + end + end + +end diff --git a/vendor/plugins/open_flash_chart/lib/open_flash_chart/radar_axis.rb b/vendor/plugins/open_flash_chart/lib/open_flash_chart/radar_axis.rb new file mode 100644 index 00000000..77a5886e --- /dev/null +++ b/vendor/plugins/open_flash_chart/lib/open_flash_chart/radar_axis.rb @@ -0,0 +1,10 @@ +module OpenFlashChart + + class RadarAxis < Base + def initialize(max, args={}) + super args + @max = max + end + end + +end \ No newline at end of file diff --git a/vendor/plugins/open_flash_chart/lib/open_flash_chart/radar_axis_labels.rb b/vendor/plugins/open_flash_chart/lib/open_flash_chart/radar_axis_labels.rb new file mode 100644 index 00000000..80990c19 --- /dev/null +++ b/vendor/plugins/open_flash_chart/lib/open_flash_chart/radar_axis_labels.rb @@ -0,0 +1,10 @@ +module OpenFlashChart + + class RadarAxisLabels < Base + def initialize(labels, args={}) + super args + @labels = labels + end + end + +end \ No newline at end of file diff --git a/vendor/plugins/open_flash_chart/lib/open_flash_chart/radar_spoke_labels.rb b/vendor/plugins/open_flash_chart/lib/open_flash_chart/radar_spoke_labels.rb new file mode 100644 index 00000000..b7d795dd --- /dev/null +++ b/vendor/plugins/open_flash_chart/lib/open_flash_chart/radar_spoke_labels.rb @@ -0,0 +1,10 @@ +module OpenFlashChart + + class RadarSpokeLabels < Base + def initialize(labels, args={}) + super args + @labels = labels + end + end + +end \ No newline at end of file diff --git a/vendor/plugins/open_flash_chart/lib/open_flash_chart/scatter.rb b/vendor/plugins/open_flash_chart/lib/open_flash_chart/scatter.rb new file mode 100644 index 00000000..abebaa45 --- /dev/null +++ b/vendor/plugins/open_flash_chart/lib/open_flash_chart/scatter.rb @@ -0,0 +1,22 @@ +module OpenFlashChart + + class ScatterValue < Base + def initialize(x,y,dot_size=-1, args={}) + super args + @x = x + @y = y + @dot_size = dot_size if dot_size.to_i > 0 + end + end + + class Scatter < Base + def initialize(colour, dot_style=nil, args={}) + @type = "scatter" + @colour = colour + @dot_style = dot_style + @values = [] + super args + end + end + +end diff --git a/vendor/plugins/open_flash_chart/lib/open_flash_chart/scatter_line.rb b/vendor/plugins/open_flash_chart/lib/open_flash_chart/scatter_line.rb new file mode 100644 index 00000000..3b2e8ace --- /dev/null +++ b/vendor/plugins/open_flash_chart/lib/open_flash_chart/scatter_line.rb @@ -0,0 +1,20 @@ +module OpenFlashChart + + class ScatterLine < Base + def initialize(colour, width, args={}) + super args + @type = 'scatter_line' + @colour = colour + @width = width + end + + def set_step_horizonal + @stepgraph = 'horizontal' + end + + def set_step_vertical + @stepgraph = 'vertical' + end + end + +end diff --git a/vendor/plugins/open_flash_chart/lib/open_flash_chart/shape.rb b/vendor/plugins/open_flash_chart/lib/open_flash_chart/shape.rb new file mode 100644 index 00000000..27981cfb --- /dev/null +++ b/vendor/plugins/open_flash_chart/lib/open_flash_chart/shape.rb @@ -0,0 +1,20 @@ +module OpenFlashChart + + class ShapePoint < Base + def initialize(x, y, args={}) + super args + @x = x + @y = y + end + end + + class Shape < Base + def initialize(colour, args={}) + @type = "shape" + @colour = colour + @values = [] + super args + end + end + +end \ No newline at end of file diff --git a/vendor/plugins/open_flash_chart/lib/open_flash_chart/sugar.rb b/vendor/plugins/open_flash_chart/lib/open_flash_chart/sugar.rb new file mode 100644 index 00000000..0ff74a83 --- /dev/null +++ b/vendor/plugins/open_flash_chart/lib/open_flash_chart/sugar.rb @@ -0,0 +1,27 @@ +module OpenFlashChart + class SStar < Star + def initialize(colour, size, args={}) + super args + @colour = colour + @size = size + end + end + + class SBox < Anchor + def initialize(colour, size, args={}) + super args + @colour = colour + @size = size + @sides = 4 + @rotation = 45 + end + end + + class SHollowDot < HollowDot + def initialize(colour, size, args={}) + super args + @colour = colour + @size = size + end + end +end diff --git a/vendor/plugins/open_flash_chart/lib/open_flash_chart/tags.rb b/vendor/plugins/open_flash_chart/lib/open_flash_chart/tags.rb new file mode 100644 index 00000000..deda8381 --- /dev/null +++ b/vendor/plugins/open_flash_chart/lib/open_flash_chart/tags.rb @@ -0,0 +1,62 @@ +module OpenFlashChart + class OFCTags < Base + def initialize args={} + super args + @type = 'tags' + @values = [] + end + + def font(font, size) + @font = font + @font_size = size + end + + def padding(x,y) + @pad_x = x + @pad_y = y + end + + def align_x_center + @align_x = "center" + end + + def align_x_left + @align_x = "left" + end + + def align_x_right + @align_x = "right" + end + + def align_y_above + @align_y = "above" + end + + def align_y_below + @align_y = "below" + end + + def align_y_center + @align_y = "center" + end + + def style(bold, underline, border, alpha) + @bold = bold + @border = border + @underline = underline + @alpha = alpha + end + + def append_tag(tag) + @values << tag + end + end + + class OFCTag < Base + def initialize(x,y, args={}) + super args + @x = x + @y = y + end + end +end diff --git a/vendor/plugins/open_flash_chart/lib/open_flash_chart/title.rb b/vendor/plugins/open_flash_chart/lib/open_flash_chart/title.rb new file mode 100644 index 00000000..41346d8b --- /dev/null +++ b/vendor/plugins/open_flash_chart/lib/open_flash_chart/title.rb @@ -0,0 +1,10 @@ +module OpenFlashChart + + class Title < Base + def initialize(text='', args = {}) + super args + @text = text + end + end + +end \ No newline at end of file diff --git a/vendor/plugins/open_flash_chart/lib/open_flash_chart/tooltip.rb b/vendor/plugins/open_flash_chart/lib/open_flash_chart/tooltip.rb new file mode 100644 index 00000000..0d7239ca --- /dev/null +++ b/vendor/plugins/open_flash_chart/lib/open_flash_chart/tooltip.rb @@ -0,0 +1,25 @@ +module OpenFlashChart + + class Tooltip < Base + def set_body_style(style) + @body = style + end + + def set_title_style(style) + @title = style + end + + def set_background_colour(bg) + @background = bg + end + + def set_proximity + @mouse = 1 + end + + def set_hover + @mouse = 2 + end + end + +end \ No newline at end of file diff --git a/vendor/plugins/open_flash_chart/lib/open_flash_chart/upload_image.rb b/vendor/plugins/open_flash_chart/lib/open_flash_chart/upload_image.rb new file mode 100644 index 00000000..46409041 --- /dev/null +++ b/vendor/plugins/open_flash_chart/lib/open_flash_chart/upload_image.rb @@ -0,0 +1 @@ +# TODO diff --git a/vendor/plugins/open_flash_chart/lib/open_flash_chart/x_axis.rb b/vendor/plugins/open_flash_chart/lib/open_flash_chart/x_axis.rb new file mode 100644 index 00000000..7c289316 --- /dev/null +++ b/vendor/plugins/open_flash_chart/lib/open_flash_chart/x_axis.rb @@ -0,0 +1,18 @@ +module OpenFlashChart + + class XAxis < Base + def set_3d(v) + @threed = v + end + # for some reason the json that needs to be produced is like this: + # "x_axis": { "offset": false, "labels": { "labels": [ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" ] } } + # note the "labels":{"labels": ....} + def set_labels(labels) + @labels = labels + @labels = {:labels => labels} unless labels.is_a?(XAxisLabels) + end + + alias_method :labels=, :set_labels + end + +end \ No newline at end of file diff --git a/vendor/plugins/open_flash_chart/lib/open_flash_chart/x_axis_label.rb b/vendor/plugins/open_flash_chart/lib/open_flash_chart/x_axis_label.rb new file mode 100644 index 00000000..c4837b95 --- /dev/null +++ b/vendor/plugins/open_flash_chart/lib/open_flash_chart/x_axis_label.rb @@ -0,0 +1,21 @@ +module OpenFlashChart + + class XAxisLabel < Base + def initialize(text, colour, size, rotate, args={}) + super args + @text = text + @colour = colour + @size = size + @rotate = rotate + end + + def set_vertical + @rotate = "vertical" + end + + def set_visible + @visible = true + end + end + +end \ No newline at end of file diff --git a/vendor/plugins/open_flash_chart/lib/open_flash_chart/x_axis_labels.rb b/vendor/plugins/open_flash_chart/lib/open_flash_chart/x_axis_labels.rb new file mode 100644 index 00000000..ef180af5 --- /dev/null +++ b/vendor/plugins/open_flash_chart/lib/open_flash_chart/x_axis_labels.rb @@ -0,0 +1,9 @@ +module OpenFlashChart + + class XAxisLabels < Base + def set_vertical + @rotate = 270 + end + end + +end diff --git a/vendor/plugins/open_flash_chart/lib/open_flash_chart/x_legend.rb b/vendor/plugins/open_flash_chart/lib/open_flash_chart/x_legend.rb new file mode 100644 index 00000000..596b7b58 --- /dev/null +++ b/vendor/plugins/open_flash_chart/lib/open_flash_chart/x_legend.rb @@ -0,0 +1,10 @@ +module OpenFlashChart + + class XLegend < Base + def initialize(text, args={}) + super args + @text = text + end + end + +end \ No newline at end of file diff --git a/vendor/plugins/open_flash_chart/lib/open_flash_chart/y_axis.rb b/vendor/plugins/open_flash_chart/lib/open_flash_chart/y_axis.rb new file mode 100644 index 00000000..865d7e91 --- /dev/null +++ b/vendor/plugins/open_flash_chart/lib/open_flash_chart/y_axis.rb @@ -0,0 +1,3 @@ +module OpenFlashChart + class YAxis < YAxisBase ; end +end \ No newline at end of file diff --git a/vendor/plugins/open_flash_chart/lib/open_flash_chart/y_axis_base.rb b/vendor/plugins/open_flash_chart/lib/open_flash_chart/y_axis_base.rb new file mode 100644 index 00000000..f1097acd --- /dev/null +++ b/vendor/plugins/open_flash_chart/lib/open_flash_chart/y_axis_base.rb @@ -0,0 +1,7 @@ +module OpenFlashChart + class YAxisBase < Base + def set_vertical + @rotate = "vertical" + end + end +end diff --git a/vendor/plugins/open_flash_chart/lib/open_flash_chart/y_axis_label.rb b/vendor/plugins/open_flash_chart/lib/open_flash_chart/y_axis_label.rb new file mode 100644 index 00000000..6ea2a080 --- /dev/null +++ b/vendor/plugins/open_flash_chart/lib/open_flash_chart/y_axis_label.rb @@ -0,0 +1,12 @@ +module OpenFlashChart + class YAxisLabel < Base + def initialize(y, text) + @y = y + @text = text + end + + def set_vertical + @rotate = "vertical" + end + end +end diff --git a/vendor/plugins/open_flash_chart/lib/open_flash_chart/y_axis_labels.rb b/vendor/plugins/open_flash_chart/lib/open_flash_chart/y_axis_labels.rb new file mode 100644 index 00000000..ecf6713d --- /dev/null +++ b/vendor/plugins/open_flash_chart/lib/open_flash_chart/y_axis_labels.rb @@ -0,0 +1,7 @@ +module OpenFlashChart + class YAxisLabels < Base + def set_vertical + @rotate = 270 + end + end +end diff --git a/vendor/plugins/open_flash_chart/lib/open_flash_chart/y_axis_right.rb b/vendor/plugins/open_flash_chart/lib/open_flash_chart/y_axis_right.rb new file mode 100644 index 00000000..66a431e0 --- /dev/null +++ b/vendor/plugins/open_flash_chart/lib/open_flash_chart/y_axis_right.rb @@ -0,0 +1,4 @@ +module OpenFlashChart + class YAxisRight < YAxisBase + end +end diff --git a/vendor/plugins/open_flash_chart/lib/open_flash_chart/y_legend.rb b/vendor/plugins/open_flash_chart/lib/open_flash_chart/y_legend.rb new file mode 100644 index 00000000..c7053210 --- /dev/null +++ b/vendor/plugins/open_flash_chart/lib/open_flash_chart/y_legend.rb @@ -0,0 +1,10 @@ +module OpenFlashChart + + class YLegend < Base + def initialize(text = '', args={}) + super args + @text = text + end + end + +end \ No newline at end of file diff --git a/vendor/plugins/open_flash_chart/lib/open_flash_chart/y_legend_right.rb b/vendor/plugins/open_flash_chart/lib/open_flash_chart/y_legend_right.rb new file mode 100644 index 00000000..ce25801d --- /dev/null +++ b/vendor/plugins/open_flash_chart/lib/open_flash_chart/y_legend_right.rb @@ -0,0 +1,6 @@ +module OpenFlashChart + + class YLegendRight < YLegend + end + +end diff --git a/vendor/plugins/open_flash_chart/tasks/open_flash_chart_tasks.rake b/vendor/plugins/open_flash_chart/tasks/open_flash_chart_tasks.rake index 0838d4f1..7308f8cd 100644 --- a/vendor/plugins/open_flash_chart/tasks/open_flash_chart_tasks.rake +++ b/vendor/plugins/open_flash_chart/tasks/open_flash_chart_tasks.rake @@ -1,4 +1,4 @@ # desc "Explaining what the task does" # task :open_flash_chart do # # Task goes here -# end \ No newline at end of file +# end