- 浏览: 2078712 次
- 性别:
- 来自: NYC
文章分类
- 全部博客 (628)
- Linux (53)
- RubyOnRails (294)
- HTML (8)
- 手册指南 (5)
- Mysql (14)
- PHP (3)
- Rails 汇总 (13)
- 读书 (22)
- plugin 插件介绍与应用 (12)
- Flex (2)
- Ruby技巧 (7)
- Gem包介绍 (1)
- javascript Jquery ext prototype (21)
- IT生活 (6)
- 小工具 (4)
- PHP 部署 drupal (1)
- javascript Jquery sort plugin 插件 (2)
- iphone siri ios (1)
- Ruby On Rails (106)
- 编程概念 (1)
- Unit Test (4)
- Ruby 1.9 (24)
- rake (1)
- Postgresql (6)
- ruby (5)
- respond_to? (1)
- method_missing (1)
- git (8)
- Rspec (1)
- ios (1)
- jquery (1)
- Sinatra (1)
最新评论
-
dadadada2x:
user模型里加上 protected def email ...
流行的权限管理 gem devise的定制 -
Sev7en_jun:
shrekting 写道var pattern = /^(0| ...
强悍的ip格式 正则表达式验证 -
jiasanshou:
好文章!!!
RPM包rpmbuild SPEC文件深度说明 -
寻得乐中乐:
link_to其实就是个a标签,使用css控制,添加一个参数: ...
Rails在link_to中加参数 -
aiafei0001:
完全看不懂,不知所然.能表达清楚一点?
"$ is not defined" 的问题怎么办
Flot 是基于Jquery的图表显示插件。github上有flot的wrapper支持调用和现实图表。
这里是一些flot使用的例子,
Jonathan Leto added logarithmic axis support and released it to the world here with some examples here. You can read Jonathan’s post on the flot mailing list here. I greatly appreciate Jonathan’s contributions as log support is key to my latest project.
Flot was still missing trend lines and dragability, though. I’ve added these features and along the way I fixed a couple of issues with the logarithmic code. I’ve posted a diff of my changes and the source code to the flot issue list and mailing list.
Examples showing dragable points and trend lines in Flot graphs follow. Flot draws plots through the html <canvas> tag. This tag is supported in Firefox 1.5+, Opera 9+, and Safari. Support for Internet Explorer is handled through the excanvas.js library. Therefore drag support in IE is slower but does function. So, in IE, drag slowly and you may have to click to release the point. I am working on fixes and improvements for this. Also, I still have an issue with a previously dragged point remaining highlighted which I need to fix. This has something to do with redrawing of the plot overlay (now fixed, nothing to do with the overlay).
Note that if selection support is enabled (to select an area on the graph, e.g. for zooming), dragging will be automatically disabled. The UI interaction of both at the same time is not desirable.
An example of a plot on a log y axis (log axes thanks to Jonathan!). The points in Series 2 are dragable. When dragged, the table below will update with the new data values.
Dragable support is off by default and must be turned on in the options object passed into the plot:
Dragable support for individual lines can then be overridden by the line options:
When dragging, the plot fires a “plotSeriesChange” event on the placeholder div with the series index, data index, updated x and updated y values as parameters. You can bind the plot target div to this event to do something while the user is dragging the point. Note that on log graphs, the data values are no longer returned as logarithmic values, they rescaled to normal (I also updated the plotclick/hover events to rescale the values).
A plot with a trend line and dragable bar graph. Trend lines can be added to line or bar graphs. The trend line will dynamically recalculate for a dragable graph.
Trend lines are off by default and must be turned on in the options object passed into the plot:
Trend line options are similar to flot line options except clickability, hoverability and dragability are forced off. You can override showing a trend line for an individual line or alter other trend line options in the individual line options:
Many Thanks to Ole for an exceptional piece of open source software and for Jonathan’s extremely useful additions!
http://www.hacknack.com/2009/02/adding-trendlines-and-dragable-to-flot/
这里是一些flot使用的例子,
Jonathan Leto added logarithmic axis support and released it to the world here with some examples here. You can read Jonathan’s post on the flot mailing list here. I greatly appreciate Jonathan’s contributions as log support is key to my latest project.
Flot was still missing trend lines and dragability, though. I’ve added these features and along the way I fixed a couple of issues with the logarithmic code. I’ve posted a diff of my changes and the source code to the flot issue list and mailing list.
Examples showing dragable points and trend lines in Flot graphs follow. Flot draws plots through the html <canvas> tag. This tag is supported in Firefox 1.5+, Opera 9+, and Safari. Support for Internet Explorer is handled through the excanvas.js library. Therefore drag support in IE is slower but does function. So, in IE, drag slowly and you may have to click to release the point. I am working on fixes and improvements for this. Also, I still have an issue with a previously dragged point remaining highlighted which I need to fix. This has something to do with redrawing of the plot overlay (now fixed, nothing to do with the overlay).
Note that if selection support is enabled (to select an area on the graph, e.g. for zooming), dragging will be automatically disabled. The UI interaction of both at the same time is not desirable.
An example of a plot on a log y axis (log axes thanks to Jonathan!). The points in Series 2 are dragable. When dragged, the table below will update with the new data values.
Dragable support is off by default and must be turned on in the options object passed into the plot:
var options = { lines: { show: true }, points: {show: true, fill: true, fillcolor:'#999999' }, selection: {mode: null}, dragable: true, yaxis: { autoscaleMargin: 0.2, base: 10, tickDecimals: 1, tickSize: 1 }, grid: { hoverable: true, clickable: true , color: "#999999"}, legend: {show: true, position: 'nw', backgroundColor: '#ffffff', margin: 10, labelBoxBorderColor: '#999999'} };
Dragable support for individual lines can then be overridden by the line options:
var chart = $.plot($("#plotdiv"), [ {label: "Series 1", dragable: false, clickable: false, hoverable: false, data: data1}, { label: "Series 2", data: data2} ], options );
When dragging, the plot fires a “plotSeriesChange” event on the placeholder div with the series index, data index, updated x and updated y values as parameters. You can bind the plot target div to this event to do something while the user is dragging the point. Note that on log graphs, the data values are no longer returned as logarithmic values, they rescaled to normal (I also updated the plotclick/hover events to rescale the values).
$("#plotdiv").bind("plotSeriesChange", function (event, seriesIndex, dataIndex, newx, newy) { tabledata[dataIndex] = [newx, newy]; $.each(tabledata, initTable); });
A plot with a trend line and dragable bar graph. Trend lines can be added to line or bar graphs. The trend line will dynamically recalculate for a dragable graph.
Trend lines are off by default and must be turned on in the options object passed into the plot:
var options2 = { trendLines: { show: true, label: "trendline" }, lines: { show: false }, points: {show: false }, dragable: true, bars: {show: true, barWidth: 0.5, align: "center" }, selection: {mode: null}, yaxis: { autoscaleMargin: 0.2, tickDecimals: 1, tickSize: 1 }, grid: { hoverable: true, clickable: true , color: "#999999"}, legend: {show: true, position: 'nw', backgroundColor: '#ffffff', margin: 15, labelBoxBorderColor: '#999999'} };
Trend line options are similar to flot line options except clickability, hoverability and dragability are forced off. You can override showing a trend line for an individual line or alter other trend line options in the individual line options:
var chart2 = $.plot($("#plotdiv2"), [{label: "Data", trendLines:{lineWidth: 4}, data: data3}], options2 );
Many Thanks to Ole for an exceptional piece of open source software and for Jonathan’s extremely useful additions!
http://www.hacknack.com/2009/02/adding-trendlines-and-dragable-to-flot/
评论
1 楼
cheyongzi
2012-10-19
想问一下 你这个点拖动的方法在Flot里面有吗?还是你使用的是jqPlot?不知道你还有没有这个拖动例子的代码,希望你能发给我一下 389936133@qq.com 或者我们交流一下。
发表评论
-
Destroying a Postgres DB on Heroku
2013-04-24 10:58 939heroku pg:reset DATABASE -
VIM ctags setup ack
2012-04-17 22:13 3261reference ctags --extra=+f --e ... -
alias_method_chain方法在3.1以后的替代使用方式
2012-02-04 02:14 3302alias_method_chain() 是rails里的一个 ... -
一些快速解决的问题
2012-01-19 12:35 1476问题如下: 引用Could not open library ... -
API service 安全问题
2011-12-04 08:47 1388这是一个长期关注的课题 rest api Service的 ... -
Module方法调用好不好
2011-11-20 01:58 1354以前说,用module给class加singleton方法,和 ... -
一个ajax和rails交互的例子
2011-11-19 01:53 1911首先,这里用了一个,query信息解析的包,如下 https: ... -
Rails 返回hash给javascript
2011-11-19 01:43 2280这是一个特别的,不太正统的需求, 因为,大部分时候,ajax的 ... -
关于Rubymine
2011-11-18 23:21 2270开个帖子收集有关使用上的问题 前一段时间,看到半价就买了。想 ... -
ruby中和javascript中,动态方法的创建
2011-11-18 21:01 1246class Klass def hello(*args) ... -
textmate快捷键 汇总
2011-11-16 07:20 8153TextMate 列编辑模式 按住 Alt 键,用鼠标选择要 ... -
Ruby面试系列六,面试继续面试
2011-11-15 05:55 2031刚才受到打击了,充分报漏了自己基础不扎实,不肯向虎炮等兄弟学习 ... -
说说sharding
2011-11-13 00:53 1502这个东西一面试就有人 ... -
rails面试碎碎念
2011-11-12 23:51 1950面试继续面试 又有问ru ... -
最通常的git push reject 和non-fast forward是因为
2011-11-12 23:29 17228git push To git@github.com:use ... -
Rails 自身的many to many关系 self has_many
2011-11-12 01:43 2741简单点的 #注意外键在person上people: id ... -
Rails 3下的 in place editor edit in place
2011-11-12 01:20 950第一个版本 http://code.google.com/p ... -
Heroku 的诡异问题集合
2011-11-11 07:22 1700开个Post记录,在用heroku过程中的一些诡异问题和要注意 ... -
SCSS 和 SASS 和 HAML 和CoffeeScript
2011-11-07 07:52 12965Asset Pipeline 提供了内建 ... -
Invalid gemspec because of the date format in specification
2011-11-07 02:14 2128又是这个date format的错误。 上次出错忘了,记录下 ...
相关推荐
由于我之前的项目涉及制作多个图表,因此我了解仅针对不同的图表在javascript和ruby中具有重复的数据结构和功能的痛苦。 图表是我的解决方案,用于将Javascript / HTML图表快速添加到导轨中。 您可以编写...
### Rails 101 入门电子书知识点详解 #### 一、简介 《Rails 101 入门电子书》是一本非常适合初学者直接入门的书籍,它由xdite编写并出版于2014年6月10日。本书主要针对的是希望学习Ruby on Rails框架的读者,特别...
这个“Rails项目源代码”是一个使用Rails构建的图片分享网站的完整源代码,它揭示了如何利用Rails的强大功能来创建一个允许用户上传、分享和浏览图片的应用。 1. **Rails框架基础**: Rails的核心理念是DRY(Don't...
《Rails101_by_rails4.0》是一本专注于Rails 4.0.0版本和Ruby 2.0.0版本的自学教程书籍,它定位于中文读者,旨在成为学习Rails框架的参考教材。Rails(Ruby on Rails)是一个采用Ruby语言编写的开源Web应用框架,它...
Rails 3.1 和 Cucumber-Rails 1.2.0 是两个在Web开发领域非常重要的工具,尤其对于Ruby on Rails框架的测试和自动化流程。本文将深入探讨这两个组件,以及它们如何协同工作来增强软件开发的效率和质量。 首先,...
Rails 3.2.6是本文的基础框架,它是一个强大的Ruby Web应用程序框架,以其MVC(模型-视图-控制器)架构和“约定优于配置”的原则而闻名。 首先,让我们了解Rails的MVC架构。模型(Model)负责处理业务逻辑和数据...
英文版的Rails API文档全面且实时更新,包含了最新的特性和技术趋势。 为了开始使用Rails API,首先你需要安装Rails框架,然后创建一个特定于API的项目,使用`rails new your_api --api`命令。接着,你可以按照文档...
插件是 Rails 社区共享代码的一种方式,可以快速添加特定功能。 5. 测试框架:Rails 内置了测试支持,包括 Unit 测试、Functional 测试和Integration 测试,使用 RSpec 和 Test::Unit 等工具,确保代码的质量和可...
### Ruby on Rails Guides v2 - Ruby on Rails 4.2.5 #### 一、重要概念及基础假设 - **重要概念**:本指南旨在帮助读者深入理解Ruby on Rails(以下简称Rails)4.2.5版本的核心功能与最佳实践。 - **基础假设**:...
在这一部分,作者将引导读者如何安装和配置Ruby on Rails环境,包括Ruby语言本身、Rails框架以及相关的工具和库。这里还会涉及如何创建第一个Rails项目,以及如何运行服务器以查看项目。对于新手来说,这一步骤是至...
在开发Web应用时,Ruby on Rails(简称Rails)框架因其高效、简洁的代码风格和强大的社区支持而备受青睐。Aptana是一款强大的集成开发环境(IDE),尤其适用于Rails项目的开发,它提供了丰富的特性来提升开发效率。...
Rails由David Heinemeier Hansson在2004年创建,其设计理念是强调代码的简洁性、DRY(Don't Repeat Yourself)原则和开发效率。 Rails的核心特性包括: 1. **约定优于配置**(Convention Over Configuration):...
本文将深入探讨"Ruby-Annotate"工具,这是一个用于Rails项目的实用程序,能够自动为你的模型添加注释,显示有关数据库模式、关联和路由的信息。 **Ruby-Annotate** 是一个Ruby gem,它的主要功能是分析你的Rails...
Rails是Ruby语言的一个著名Web应用框架,以敏捷开发和“约定优于配置”为设计理念,深受开发者喜爱。在“Rails进行敏捷Web开发(所有版本的源码rails3.0-4.0)”中,包含了Rails从3.0到4.0各个主要版本的源代码,这些...
Ruby on Rails(简称Rails)是一个基于Ruby语言的开源Web应用框架,它遵循MVC(Model-View-Controller)架构模式,强调“约定优于配置”(Conventions over Configuration)和“Don't Repeat Yourself”(DRY,不要...
本书深入浅出地介绍了Rails 4的各种组件和功能,适合已经熟悉Ruby编程并希望深入了解Rails框架的开发人员。 #### 描述:学习ruby! 这句简短的描述暗示了本书的一个重要目标:帮助读者通过学习Rails来提高他们的...
7. **jQuery和JavaScript**:Inspinia Admin包含许多交互元素,因此熟悉JavaScript和jQuery对于实现动态效果至关重要。 8. **Asset Pipeline**:Rails的静态资源管理机制,包括CSS、JS和图片的编译、压缩和版本控制...
Rails以其“约定优于配置”(Convention over Configuration)和“Don't Repeat Yourself”(DRY,不要重复自己)的原则,极大地提高了开发效率和代码可读性,成为了Web2.0时代敏捷开发的首选工具。 在Ruby on ...
在这个全球互联的世界中,计算机编程和 Web 应用程序开发都在迅猛发展,我很期待能为中国的开发者提供 Ruby on Rails 培训。学习英语这门世界语言是很重要的,但先通过母语学习往往会更有效果。正因为这样,当看到 ...