为什么在骨干全局事件调度程序中使用名为“vent”的变量(Why use a variable named 'vent' in a backbone global event despatcher)
当人们创建应用程序范围的事件调度程序时,我已经在很多地方看到过这种情况。
var vent = {}; _.extend(vent, Backbone.Events);
为什么每个人都使用'vent'这个名字。 在我看来,这是事件减去e。 他们是否使用它是因为事件是保留的工作?
事件调度员这样一个愚蠢名字的原因是什么? 这个名字有什么特别的意义吗?
I have seen this in numerous places now when people are creating an application wide event despatcher.
var vent = {}; _.extend(vent, Backbone.Events);
Why is everyone using the name 'vent'. It seems to me that it is event minus the e. Are they using it because event is a reserved work?
Any reasons for such a stupid name for an event despatcher? Is there some special meaning to this name?
原文:https://stackoverflow.com/questions/18718432
最满意答案
以下结果运作良好。
reshape
库引入了melt
命令,该命令将数据识别为ggplot
可用的格式。library(ggplot2) library(reshape) data=read.csv("out20",comment.char = "#",sep = "") mdata=melt(data,id=c("Time")) ggplot(mdata, aes(x=Time,y=value,group=variable,fill=variable)) + geom_area(position="fill")
The following ended up working well enough.
The
reshape
library pulls in themelt
command which recognises the data into a format usable byggplot
.library(ggplot2) library(reshape) data=read.csv("out20",comment.char = "#",sep = "") mdata=melt(data,id=c("Time")) ggplot(mdata, aes(x=Time,y=value,group=variable,fill=variable)) + geom_area(position="fill")
相关问答
更多-
您可以尝试将此添加到图表声明中,它将提取数据系列的名称(除了x)并将它们转换为一个大组: onrendered: function () { var seriesNames = this.data.targets.map (function (d) { return d.id; }).filter (function (sname) { return sname !== "x"; }); this.api.groups ([seriesNames] ...
-
一个使用ggplot的例子: library(ggplot2) library(reshape2) dat <- data.frame( x = LETTERS[1:3], series1 = 1:3, series2 = 4:6) ggplot(melt(dat), aes(x=x, y=value, fill=variable, group=variable)) + geom_area() An example using ggplot: library(ggplot2) ...
-
将b作为一个因素。 您还需要添加与fill美学相同的group美学。 (这告诉ggplot如何在不同的因子级别之间“连接点”。) ggplot(df, aes(x = b, y = a, fill = c, group = c)) + geom_area(position = 'stack') + theme(axis.text.x = element_text(angle = 90, hjust = 1)) 至于顺序,x轴将按因子水平的顺序排列。 要更改轴的顺序,只需更改因子级别的顺序 ...
-
感谢您的评论, 代码veritas 。 通过进一步清理我的代码并处理我造成的数据过滤问题,我能够回答我自己的问题。 我已经更新了要点, 与上面相同的链接 ,以防它有任何类似问题的人。 萨拉 Thanks for your comment, in code veritas. I was able to answer my own question by further cleaning up my code and dealing with a data filtering issue that I had ...
-
以下结果运作良好。 reshape库引入了melt命令,该命令将数据识别为ggplot可用的格式。 library(ggplot2) library(reshape) data=read.csv("out20",comment.char = "#",sep = "") mdata=melt(data,id=c("Time")) ggplot(mdata, aes(x=Time,y=value,group=variable,fill=variable)) + geom_area(position="fill" ...
-
R中的灰度叠加区域图(Grayscale stacked area plot in R)[2023-04-25]
来自?stackpoly : col: Color to fill the polygons. If NULL, ‘rainbow’ will be called to generate the colors. If NA, the polygons will not be filled. 略微修改?stackpoly的示例: stackpoly(matrix(cumsum(testx),nrow=10),main="Test Stackpoly I", xaxlab=c( ... -
添加text和tooltip将为您提供所需内容: Plot <- ggplot(data=df2, aes(x=X, y=Value, fill=Label, text = paste("Value:", Value))) + geom_area(position='stack') ggplotly(Plot) ggplotly(tooltip = c("text", "x", "fill")) Adding text and tooltip will give you what you want: ...
-
我没有在这里得到任何答案后在ggplot2邮件列表上问了这个问题,Winston Chang提出了一个解决方案: ggplot2 google group中的线程 I asked this question on the ggplot2 mailing list after not getting any answers here, and Winston Chang came up with a solution: Thread within ggplot2 google group
-
我发现了很多: 绘制形状的人( http://www.dashingd3js.com/using-json-to-simplify-code ) 另一个绘制图形( http://bl.ocks.org/mbostock/4062045 ) 一篇有用的文章解释了与(out)AJAX的数据转换( http://empire5.com/development/d3-js-dynamic-bar-graphing-with-transitions-and-json/ ) 另外,看看这个问题, d3.js差异图表示例 ...
-
新手d3堆积区域图(Novice d3 stacked area graph)[2022-07-23]
问题是堆积面积图中数据中的每一行总和为100.然而,您的数据总和为每行中的不同值,并且每个日期的'Kermit'值>100 。 因此,当D3绘制数据集的所有路径时,它们不在图形的范围内。 要解决此问题,您需要初始化y轴的domain ,以便默认情况下不希望您的值在[1, 100]范围内。 初始化x轴域后,可以添加以下内容: // Find the value of the day with highest total value var maxDateVal = d3.max(data, function( ...