flot-rails-0.0.6/ 0000755 0001750 0001750 00000000000 12734234073 012174 5 ustar alee alee flot-rails-0.0.6/Rakefile 0000755 0001750 0001750 00000000113 12734234073 013637 0 ustar alee alee require 'bundler' Bundler::GemHelper.install_tasks task :default => :spec flot-rails-0.0.6/lib/ 0000755 0001750 0001750 00000000000 12734234073 012742 5 ustar alee alee flot-rails-0.0.6/lib/flot/ 0000755 0001750 0001750 00000000000 12734234073 013706 5 ustar alee alee flot-rails-0.0.6/lib/flot/rails/ 0000755 0001750 0001750 00000000000 12734234073 015020 5 ustar alee alee flot-rails-0.0.6/lib/flot/rails/version.rb 0000755 0001750 0001750 00000000126 12734234073 017034 0 ustar alee alee module Flot module Rails VERSION = "0.0.6" FLOT_VERSION = "0.8.3" end end flot-rails-0.0.6/lib/flot/rails/engine.rb 0000755 0001750 0001750 00000000121 12734234073 016607 0 ustar alee alee module Flot module Rails class Engine < ::Rails::Engine end end end flot-rails-0.0.6/lib/flot/rails.rb 0000755 0001750 0001750 00000000146 12734234073 015351 0 ustar alee alee module Flot module Rails require 'flot/rails/engine' require 'flot/rails/version' end end flot-rails-0.0.6/lib/flot-rails.rb 0000755 0001750 0001750 00000000024 12734234073 015342 0 ustar alee alee require 'flot/rails' flot-rails-0.0.6/.gitignore 0000644 0001750 0001750 00000000003 12734234073 014155 0 ustar alee alee pkg flot-rails-0.0.6/README.md 0000755 0001750 0001750 00000003012 12734234073 013452 0 ustar alee alee # Flot-rails Vendor jQuery Flot library for Rails 3.1+ asset pipeline. ### Usage In your Gemfile, add this line: ```ruby gem "flot-rails" ``` `bundle install` and then in your javascripts ```javascript //= require jquery.flot //= require jquery.flot.resize ``` be sure to restart your web server to pick up the gem assets ### Rails helpers Coming some day soon ### License The MIT License flot-rails gem: Copyright (c) 2012 Vasily Fedoseyev jQuery Flot: Copyright (c) 2007-2009 IOLA and Ole Laursen Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. flot-rails-0.0.6/Gemfile 0000755 0001750 0001750 00000000033 12734234073 013466 0 ustar alee alee source :gemcutter gemspec flot-rails-0.0.6/metadata.yml 0000644 0001750 0001750 00000007132 12734234073 014502 0 ustar alee alee --- !ruby/object:Gem::Specification name: flot-rails version: !ruby/object:Gem::Version version: 0.0.6 platform: ruby authors: - Vasily Fedoseyev autorequire: bindir: bin cert_chain: [] date: 2014-04-24 00:00:00.000000000 Z dependencies: - !ruby/object:Gem::Dependency name: jquery-rails requirement: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: '0' type: :runtime prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: '0' - !ruby/object:Gem::Dependency name: rails requirement: !ruby/object:Gem::Requirement requirements: - - "~>" - !ruby/object:Gem::Version version: '3.1' type: :development prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - "~>" - !ruby/object:Gem::Version version: '3.1' description: Provides easy installation and usage of jQuery-flot javascript library for your Rails 3.1+ application. email: - vasilyfedoseyev@gmail.com executables: [] extensions: [] extra_rdoc_files: [] files: - ".gitignore" - Gemfile - README.md - Rakefile - flot-rails.gemspec - lib/flot-rails.rb - lib/flot/rails.rb - lib/flot/rails/engine.rb - lib/flot/rails/version.rb - vendor/assets/javascripts/excanvas.js - vendor/assets/javascripts/excanvas.min.js - vendor/assets/javascripts/jquery.colorhelpers.js - vendor/assets/javascripts/jquery.colorhelpers.min.js - vendor/assets/javascripts/jquery.flot.canvas.js - vendor/assets/javascripts/jquery.flot.canvas.min.js - vendor/assets/javascripts/jquery.flot.categories.js - vendor/assets/javascripts/jquery.flot.categories.min.js - vendor/assets/javascripts/jquery.flot.crosshair.js - vendor/assets/javascripts/jquery.flot.crosshair.min.js - vendor/assets/javascripts/jquery.flot.errorbars.js - vendor/assets/javascripts/jquery.flot.errorbars.min.js - vendor/assets/javascripts/jquery.flot.fillbetween.js - vendor/assets/javascripts/jquery.flot.fillbetween.min.js - vendor/assets/javascripts/jquery.flot.image.js - vendor/assets/javascripts/jquery.flot.image.min.js - vendor/assets/javascripts/jquery.flot.js - vendor/assets/javascripts/jquery.flot.min.js - vendor/assets/javascripts/jquery.flot.navigate.js - vendor/assets/javascripts/jquery.flot.navigate.min.js - vendor/assets/javascripts/jquery.flot.pie.js - vendor/assets/javascripts/jquery.flot.pie.min.js - vendor/assets/javascripts/jquery.flot.resize.js - vendor/assets/javascripts/jquery.flot.resize.min.js - vendor/assets/javascripts/jquery.flot.selection.js - vendor/assets/javascripts/jquery.flot.selection.min.js - vendor/assets/javascripts/jquery.flot.stack.js - vendor/assets/javascripts/jquery.flot.stack.min.js - vendor/assets/javascripts/jquery.flot.symbol.js - vendor/assets/javascripts/jquery.flot.symbol.min.js - vendor/assets/javascripts/jquery.flot.threshold.js - vendor/assets/javascripts/jquery.flot.threshold.min.js - vendor/assets/javascripts/jquery.flot.time.js - vendor/assets/javascripts/jquery.flot.time.min.js homepage: http://rubygems.org/gems/flot-rails licenses: [] metadata: {} post_install_message: rdoc_options: [] require_paths: - lib required_ruby_version: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: '0' required_rubygems_version: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: 1.3.6 requirements: [] rubyforge_project: rubygems_version: 2.2.0.rc.1 signing_key: specification_version: 4 summary: jQuery Flot for Rails Asset pipeline test_files: [] flot-rails-0.0.6/flot-rails.gemspec 0000755 0001750 0001750 00000001474 12734234073 015626 0 ustar alee alee # -*- encoding: utf-8 -*- require File.expand_path('../lib/flot/rails/version', __FILE__) Gem::Specification.new do |s| s.name = "flot-rails" s.version = Flot::Rails::VERSION s.platform = Gem::Platform::RUBY s.authors = ["Vasily Fedoseyev"] s.email = ["vasilyfedoseyev@gmail.com"] s.homepage = "http://rubygems.org/gems/flot-rails" s.summary = "jQuery Flot for Rails Asset pipeline" s.description = "Provides easy installation and usage of jQuery-flot javascript library for your Rails 3.1+ application." s.required_rubygems_version = ">= 1.3.6" s.add_dependency "jquery-rails" s.add_development_dependency "rails", "~> 3.1" s.files = `git ls-files`.split("\n") s.executables = `git ls-files`.split("\n").select{|f| f =~ /^bin/} s.require_path = 'lib' end flot-rails-0.0.6/vendor/ 0000755 0001750 0001750 00000000000 12734234073 013471 5 ustar alee alee flot-rails-0.0.6/vendor/assets/ 0000755 0001750 0001750 00000000000 12734234073 014773 5 ustar alee alee flot-rails-0.0.6/vendor/assets/javascripts/ 0000755 0001750 0001750 00000000000 12734234073 017324 5 ustar alee alee flot-rails-0.0.6/vendor/assets/javascripts/jquery.flot.categories.js 0000644 0001750 0001750 00000013621 12734234073 024273 0 ustar alee alee /* Flot plugin for plotting textual data or categories. Copyright (c) 2007-2014 IOLA and Ole Laursen. Licensed under the MIT license. Consider a dataset like [["February", 34], ["March", 20], ...]. This plugin allows you to plot such a dataset directly. To enable it, you must specify mode: "categories" on the axis with the textual labels, e.g. $.plot("#placeholder", data, { xaxis: { mode: "categories" } }); By default, the labels are ordered as they are met in the data series. If you need a different ordering, you can specify "categories" on the axis options and list the categories there: xaxis: { mode: "categories", categories: ["February", "March", "April"] } If you need to customize the distances between the categories, you can specify "categories" as an object mapping labels to values xaxis: { mode: "categories", categories: { "February": 1, "March": 3, "April": 4 } } If you don't specify all categories, the remaining categories will be numbered from the max value plus 1 (with a spacing of 1 between each). Internally, the plugin works by transforming the input data through an auto- generated mapping where the first category becomes 0, the second 1, etc. Hence, a point like ["February", 34] becomes [0, 34] internally in Flot (this is visible in hover and click events that return numbers rather than the category labels). The plugin also overrides the tick generator to spit out the categories as ticks instead of the values. If you need to map a value back to its label, the mapping is always accessible as "categories" on the axis object, e.g. plot.getAxes().xaxis.categories. */ (function ($) { var options = { xaxis: { categories: null }, yaxis: { categories: null } }; function processRawData(plot, series, data, datapoints) { // if categories are enabled, we need to disable // auto-transformation to numbers so the strings are intact // for later processing var xCategories = series.xaxis.options.mode == "categories", yCategories = series.yaxis.options.mode == "categories"; if (!(xCategories || yCategories)) return; var format = datapoints.format; if (!format) { // FIXME: auto-detection should really not be defined here var s = series; format = []; format.push({ x: true, number: true, required: true }); format.push({ y: true, number: true, required: true }); if (s.bars.show || (s.lines.show && s.lines.fill)) { var autoscale = !!((s.bars.show && s.bars.zero) || (s.lines.show && s.lines.zero)); format.push({ y: true, number: true, required: false, defaultValue: 0, autoscale: autoscale }); if (s.bars.horizontal) { delete format[format.length - 1].y; format[format.length - 1].x = true; } } datapoints.format = format; } for (var m = 0; m < format.length; ++m) { if (format[m].x && xCategories) format[m].number = false; if (format[m].y && yCategories) format[m].number = false; } } function getNextIndex(categories) { var index = -1; for (var v in categories) if (categories[v] > index) index = categories[v]; return index + 1; } function categoriesTickGenerator(axis) { var res = []; for (var label in axis.categories) { var v = axis.categories[label]; if (v >= axis.min && v <= axis.max) res.push([v, label]); } res.sort(function (a, b) { return a[0] - b[0]; }); return res; } function setupCategoriesForAxis(series, axis, datapoints) { if (series[axis].options.mode != "categories") return; if (!series[axis].categories) { // parse options var c = {}, o = series[axis].options.categories || {}; if ($.isArray(o)) { for (var i = 0; i < o.length; ++i) c[o[i]] = i; } else { for (var v in o) c[v] = o[v]; } series[axis].categories = c; } // fix ticks if (!series[axis].options.ticks) series[axis].options.ticks = categoriesTickGenerator; transformPointsOnAxis(datapoints, axis, series[axis].categories); } function transformPointsOnAxis(datapoints, axis, categories) { // go through the points, transforming them var points = datapoints.points, ps = datapoints.pointsize, format = datapoints.format, formatColumn = axis.charAt(0), index = getNextIndex(categories); for (var i = 0; i < points.length; i += ps) { if (points[i] == null) continue; for (var m = 0; m < ps; ++m) { var val = points[i + m]; if (val == null || !format[m][formatColumn]) continue; if (!(val in categories)) { categories[val] = index; ++index; } points[i + m] = categories[val]; } } } function processDatapoints(plot, series, datapoints) { setupCategoriesForAxis(series, "xaxis", datapoints); setupCategoriesForAxis(series, "yaxis", datapoints); } function init(plot) { plot.hooks.processRawData.push(processRawData); plot.hooks.processDatapoints.push(processDatapoints); } $.plot.plugins.push({ init: init, options: options, name: 'categories', version: '1.0' }); })(jQuery); flot-rails-0.0.6/vendor/assets/javascripts/jquery.flot.crosshair.min.js 0000644 0001750 0001750 00000004162 12734234073 024725 0 ustar alee alee /* Javascript plotting library for jQuery, version 0.8.3. Copyright (c) 2007-2014 IOLA and Ole Laursen. Licensed under the MIT license. */ (function($){var options={crosshair:{mode:null,color:"rgba(170, 0, 0, 0.80)",lineWidth:1}};function init(plot){var crosshair={x:-1,y:-1,locked:false};plot.setCrosshair=function setCrosshair(pos){if(!pos)crosshair.x=-1;else{var o=plot.p2c(pos);crosshair.x=Math.max(0,Math.min(o.left,plot.width()));crosshair.y=Math.max(0,Math.min(o.top,plot.height()))}plot.triggerRedrawOverlay()};plot.clearCrosshair=plot.setCrosshair;plot.lockCrosshair=function lockCrosshair(pos){if(pos)plot.setCrosshair(pos);crosshair.locked=true};plot.unlockCrosshair=function unlockCrosshair(){crosshair.locked=false};function onMouseOut(e){if(crosshair.locked)return;if(crosshair.x!=-1){crosshair.x=-1;plot.triggerRedrawOverlay()}}function onMouseMove(e){if(crosshair.locked)return;if(plot.getSelection&&plot.getSelection()){crosshair.x=-1;return}var offset=plot.offset();crosshair.x=Math.max(0,Math.min(e.pageX-offset.left,plot.width()));crosshair.y=Math.max(0,Math.min(e.pageY-offset.top,plot.height()));plot.triggerRedrawOverlay()}plot.hooks.bindEvents.push(function(plot,eventHolder){if(!plot.getOptions().crosshair.mode)return;eventHolder.mouseout(onMouseOut);eventHolder.mousemove(onMouseMove)});plot.hooks.drawOverlay.push(function(plot,ctx){var c=plot.getOptions().crosshair;if(!c.mode)return;var plotOffset=plot.getPlotOffset();ctx.save();ctx.translate(plotOffset.left,plotOffset.top);if(crosshair.x!=-1){var adj=plot.getOptions().crosshair.lineWidth%2?.5:0;ctx.strokeStyle=c.color;ctx.lineWidth=c.lineWidth;ctx.lineJoin="round";ctx.beginPath();if(c.mode.indexOf("x")!=-1){var drawX=Math.floor(crosshair.x)+adj;ctx.moveTo(drawX,0);ctx.lineTo(drawX,plot.height())}if(c.mode.indexOf("y")!=-1){var drawY=Math.floor(crosshair.y)+adj;ctx.moveTo(0,drawY);ctx.lineTo(plot.width(),drawY)}ctx.stroke()}ctx.restore()});plot.hooks.shutdown.push(function(plot,eventHolder){eventHolder.unbind("mouseout",onMouseOut);eventHolder.unbind("mousemove",onMouseMove)})}$.plot.plugins.push({init:init,options:options,name:"crosshair",version:"1.0"})})(jQuery); flot-rails-0.0.6/vendor/assets/javascripts/jquery.flot.symbol.min.js 0000644 0001750 0001750 00000002243 12734234073 024233 0 ustar alee alee /* Javascript plotting library for jQuery, version 0.8.3. Copyright (c) 2007-2014 IOLA and Ole Laursen. Licensed under the MIT license. */ (function($){function processRawData(plot,series,datapoints){var handlers={square:function(ctx,x,y,radius,shadow){var size=radius*Math.sqrt(Math.PI)/2;ctx.rect(x-size,y-size,size+size,size+size)},diamond:function(ctx,x,y,radius,shadow){var size=radius*Math.sqrt(Math.PI/2);ctx.moveTo(x-size,y);ctx.lineTo(x,y-size);ctx.lineTo(x+size,y);ctx.lineTo(x,y+size);ctx.lineTo(x-size,y)},triangle:function(ctx,x,y,radius,shadow){var size=radius*Math.sqrt(2*Math.PI/Math.sin(Math.PI/3));var height=size*Math.sin(Math.PI/3);ctx.moveTo(x-size/2,y+height/2);ctx.lineTo(x+size/2,y+height/2);if(!shadow){ctx.lineTo(x,y-height/2);ctx.lineTo(x-size/2,y+height/2)}},cross:function(ctx,x,y,radius,shadow){var size=radius*Math.sqrt(Math.PI)/2;ctx.moveTo(x-size,y-size);ctx.lineTo(x+size,y+size);ctx.moveTo(x-size,y+size);ctx.lineTo(x+size,y-size)}};var s=series.points.symbol;if(handlers[s])series.points.symbol=handlers[s]}function init(plot){plot.hooks.processDatapoints.push(processRawData)}$.plot.plugins.push({init:init,name:"symbols",version:"1.0"})})(jQuery); flot-rails-0.0.6/vendor/assets/javascripts/jquery.flot.canvas.js 0000644 0001750 0001750 00000022577 12734234073 023433 0 ustar alee alee /* Flot plugin for drawing all elements of a plot on the canvas. Copyright (c) 2007-2014 IOLA and Ole Laursen. Licensed under the MIT license. Flot normally produces certain elements, like axis labels and the legend, using HTML elements. This permits greater interactivity and customization, and often looks better, due to cross-browser canvas text inconsistencies and limitations. It can also be desirable to render the plot entirely in canvas, particularly if the goal is to save it as an image, or if Flot is being used in a context where the HTML DOM does not exist, as is the case within Node.js. This plugin switches out Flot's standard drawing operations for canvas-only replacements. Currently the plugin supports only axis labels, but it will eventually allow every element of the plot to be rendered directly to canvas. The plugin supports these options: { canvas: boolean } The "canvas" option controls whether full canvas drawing is enabled, making it possible to toggle on and off. This is useful when a plot uses HTML text in the browser, but needs to redraw with canvas text when exporting as an image. */ (function($) { var options = { canvas: true }; var render, getTextInfo, addText; // Cache the prototype hasOwnProperty for faster access var hasOwnProperty = Object.prototype.hasOwnProperty; function init(plot, classes) { var Canvas = classes.Canvas; // We only want to replace the functions once; the second time around // we would just get our new function back. This whole replacing of // prototype functions is a disaster, and needs to be changed ASAP. if (render == null) { getTextInfo = Canvas.prototype.getTextInfo, addText = Canvas.prototype.addText, render = Canvas.prototype.render; } // Finishes rendering the canvas, including overlaid text Canvas.prototype.render = function() { if (!plot.getOptions().canvas) { return render.call(this); } var context = this.context, cache = this._textCache; // For each text layer, render elements marked as active context.save(); context.textBaseline = "middle"; for (var layerKey in cache) { if (hasOwnProperty.call(cache, layerKey)) { var layerCache = cache[layerKey]; for (var styleKey in layerCache) { if (hasOwnProperty.call(layerCache, styleKey)) { var styleCache = layerCache[styleKey], updateStyles = true; for (var key in styleCache) { if (hasOwnProperty.call(styleCache, key)) { var info = styleCache[key], positions = info.positions, lines = info.lines; // Since every element at this level of the cache have the // same font and fill styles, we can just change them once // using the values from the first element. if (updateStyles) { context.fillStyle = info.font.color; context.font = info.font.definition; updateStyles = false; } for (var i = 0, position; position = positions[i]; i++) { if (position.active) { for (var j = 0, line; line = position.lines[j]; j++) { context.fillText(lines[j].text, line[0], line[1]); } } else { positions.splice(i--, 1); } } if (positions.length == 0) { delete styleCache[key]; } } } } } } } context.restore(); }; // Creates (if necessary) and returns a text info object. // // When the canvas option is set, the object looks like this: // // { // width: Width of the text's bounding box. // height: Height of the text's bounding box. // positions: Array of positions at which this text is drawn. // lines: [{ // height: Height of this line. // widths: Width of this line. // text: Text on this line. // }], // font: { // definition: Canvas font property string. // color: Color of the text. // }, // } // // The positions array contains objects that look like this: // // { // active: Flag indicating whether the text should be visible. // lines: Array of [x, y] coordinates at which to draw the line. // x: X coordinate at which to draw the text. // y: Y coordinate at which to draw the text. // } Canvas.prototype.getTextInfo = function(layer, text, font, angle, width) { if (!plot.getOptions().canvas) { return getTextInfo.call(this, layer, text, font, angle, width); } var textStyle, layerCache, styleCache, info; // Cast the value to a string, in case we were given a number text = "" + text; // If the font is a font-spec object, generate a CSS definition if (typeof font === "object") { textStyle = font.style + " " + font.variant + " " + font.weight + " " + font.size + "px " + font.family; } else { textStyle = font; } // Retrieve (or create) the cache for the text's layer and styles layerCache = this._textCache[layer]; if (layerCache == null) { layerCache = this._textCache[layer] = {}; } styleCache = layerCache[textStyle]; if (styleCache == null) { styleCache = layerCache[textStyle] = {}; } info = styleCache[text]; if (info == null) { var context = this.context; // If the font was provided as CSS, create a div with those // classes and examine it to generate a canvas font spec. if (typeof font !== "object") { var element = $("