如何填充文本框?(How do I populate my textboxes?)
我正在为我的实习制作一个网站,我遇到了一个问题。 将数据从我的数据库检索到我的文本框中。 如果可能,每个人都有自己的信息。 例如; 我有一个John的文本框,他有一个名字和电子邮件。 杰克也有一个名字和电子邮件。 两者都需要从数据库中选择并放入表单中。 这是一个可以更改人员信息的表单。 你可以在这里看到网站。 点击“Wijzig”按钮查看我的意思。
<html lang="en"> <head> <title>Bootstrap Example</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script> <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script> </head> <tr> <td width="100"> <div id="flip"> <img src="images/ik.jpg" class="circular" width="100px" height="100px"> <td width="350px"> <label for="luca" style="width: 280px;">Luca Fraser</label> <div id="panel" style="display: none;">Geboortedatum: 30-12-1997 <br>Email: lucaf1997@gmail.com <br>Woonplaats: Winterswijk </div> </td> </div> </td> <td> <label for="luca">Voorzitter</label> </td> <td style="border-color: transparent;"> <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#myModalNorm" style="background-color: #42a5f5; border-color: #42a5f5; margin-left: 20px;">Wijzig </button> <div class="modal fade" id="myModalNorm" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <!-- Modal Header --> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal"> <span aria-hidden="true">×</span> <span class="sr-only">Close</span> </button> <h4 class="modal-title" id="myModalLabel"> Wijzigen </h4> </div> <!-- Modal Body --> <div class="modal-body"> <form role="form"> <div class="form-group"> <label for="exampleInputEmail1">Voornaam</label> <input type="email" class="form-control" id="exampleInputEmail1" value="Here needs to get a input value, look at line 247 to see where it needs to be." /> </div> <div class="form-group"> <label for="exampleInputEmail1">Achternaam</label> <input type="email" class="form-control" id="exampleInputEmail1" placeholder="Janssen" /> </div> <div class="form-group"> <label for="exampleInputEmail1">Email</label> <input type="email" class="form-control" id="exampleInputEmail1" placeholder="jan@janssen.nl" /> </div> <div class="form-group"> <label for="exampleInputPassword1">Telefoonnummer</label> <input type="text" class="form-control" id="exampleInputPassword1" placeholder="0612345678" /> </div> <div class="form-group"> <label for="exampleInputEmail1">Functie</label> <input type="email" class="form-control" id="exampleInputEmail1" placeholder="Voorzitter" /> </div> </form> </div> <!-- Modal Footer --> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal"> Close </button> <button type="button" class="btn btn-primary"> Save changes </button> </div> </div> </div> </div> </td> <td style="border-color: transparent;"> <button type="button" class="btn btn-danger" onclick="myFunction()">Verwijder</button> </td> </tr>
I am making a website for my internship and I came across a problem. Retrieving data from my database into my textboxes. If possible, each person their own information. For example; I have a textbox for John, he has a name and email. Jack also has a name and email. Both need to be selected from the database and put in the form. It's a form where you can make changes to the persons information. You can see the website yourself here. Click on the button "Wijzig" to view the form I mean.
<html lang="en"> <head> <title>Bootstrap Example</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script> <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script> </head> <tr> <td width="100"> <div id="flip"> <img src="images/ik.jpg" class="circular" width="100px" height="100px"> <td width="350px"> <label for="luca" style="width: 280px;">Luca Fraser</label> <div id="panel" style="display: none;">Geboortedatum: 30-12-1997 <br>Email: lucaf1997@gmail.com <br>Woonplaats: Winterswijk </div> </td> </div> </td> <td> <label for="luca">Voorzitter</label> </td> <td style="border-color: transparent;"> <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#myModalNorm" style="background-color: #42a5f5; border-color: #42a5f5; margin-left: 20px;">Wijzig </button> <div class="modal fade" id="myModalNorm" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <!-- Modal Header --> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal"> <span aria-hidden="true">×</span> <span class="sr-only">Close</span> </button> <h4 class="modal-title" id="myModalLabel"> Wijzigen </h4> </div> <!-- Modal Body --> <div class="modal-body"> <form role="form"> <div class="form-group"> <label for="exampleInputEmail1">Voornaam</label> <input type="email" class="form-control" id="exampleInputEmail1" value="Here needs to get a input value, look at line 247 to see where it needs to be." /> </div> <div class="form-group"> <label for="exampleInputEmail1">Achternaam</label> <input type="email" class="form-control" id="exampleInputEmail1" placeholder="Janssen" /> </div> <div class="form-group"> <label for="exampleInputEmail1">Email</label> <input type="email" class="form-control" id="exampleInputEmail1" placeholder="jan@janssen.nl" /> </div> <div class="form-group"> <label for="exampleInputPassword1">Telefoonnummer</label> <input type="text" class="form-control" id="exampleInputPassword1" placeholder="0612345678" /> </div> <div class="form-group"> <label for="exampleInputEmail1">Functie</label> <input type="email" class="form-control" id="exampleInputEmail1" placeholder="Voorzitter" /> </div> </form> </div> <!-- Modal Footer --> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal"> Close </button> <button type="button" class="btn btn-primary"> Save changes </button> </div> </div> </div> </div> </td> <td style="border-color: transparent;"> <button type="button" class="btn btn-danger" onclick="myFunction()">Verwijder</button> </td> </tr>
原文:https://stackoverflow.com/questions/35455497
最满意答案
您必须添加
scale_color_identity
才能按“原样”采用颜色:ggplot(data=image.rgb, aes(x=x, y=y, col=rgb(r,g,b))) + geom_point() + scale_color_identity()
您提供的样本数据提供非常相似的颜色,因此所有点都显示为黑色。 使用
geom_tile
,不同的颜色更加明显:ggplot(data=image.rgb, aes(x=x, y=y, fill=rgb(r,g,b))) + geom_tile() + scale_fill_identity()
You must add
scale_color_identity
in order for colors to be taken "as is" :ggplot(data=image.rgb, aes(x=x, y=y, col=rgb(r,g,b))) + geom_point() + scale_color_identity()
The sample data you provided give very similar colors, so all the points seem to be black. With
geom_tile
the different colors are a bit more visible :ggplot(data=image.rgb, aes(x=x, y=y, fill=rgb(r,g,b))) + geom_tile() + scale_fill_identity()
相关问答
更多-
我不知道有任何特殊方法可以自动执行此操作,但您可以使用一些三角法来计算正确的坐标。 请参阅下面的解决方案 set.seed(123) Data <- data.frame(Pro=rnorm(20), Cla=rnorm(20), Neu=rnorm(20)) library(tidyverse) #> Loading tidyverse: ggplot2 #> Loading tidyverse: tibble #> Loading tidyverse: tidyr #> Loading tidyver ...
-
如何使用ggplot2绘制带有(x,y,r,g,b)坐标的图像?(How can I plot a image with (x,y,r,g,b) coordinates using ggplot2?)[2023-07-02]
您必须添加scale_color_identity才能按“原样”采用颜色: ggplot(data=image.rgb, aes(x=x, y=y, col=rgb(r,g,b))) + geom_point() + scale_color_identity() 您提供的样本数据提供非常相似的颜色,因此所有点都显示为黑色。 使用geom_tile ,不同的颜色更加明显: ggplot(data=image.rgb, aes(x=x, y=y, fill=rgb(r,g,b))) + ... -
如何使用R中的ggplot2在投影地图上绘制插值数据(How to plot interpolating data on a projected map using ggplot2 in R)[2023-02-26]
挖了一点之后,我想你可能想要这个: Krig = autoKrige(APPT~1,sp_mydata)$krige_output Krig = Krig[!is.na(over(Krig,as(g,"SpatialPolygons"))),] # take only the points falling in poolygons Krig_df = as.data.frame(Krig) names(Krig_df) = c("APPT_pred","APPT_var","APPT_stdev","lo ... -
您可以在rasterGrob设置宽度和高度参数, rasterGrob都等于1“npc”,这将强制图像填充绘图区域。 然后在保存图像时指定图像的高度和宽度,以获得所需的高宽比。 主题和scale_y_reverse选项可用于控制轴的外观,如下所示。 请注意,我们也可以使用expand参数来确保轴不会比图像或数据更远。 g <- rasterGrob(img, width=unit(1,"npc"), height=unit(1,"npc"), interpolate = FALSE) g_ct <- gg ...
-
如何直接使用stat_density ggplot(movies, aes(x = rating)) + stat_density(geom="line") How about using stat_density directly ggplot(movies, aes(x = rating)) + stat_density(geom="line")
-
ggplot2:完整的打印尺寸图像(ggplot2: Full plot size image)[2022-05-20]
library("ggimage") set.seed(12345) df1 <- data.frame(x = rnorm(1), y = rnorm(1), image = "https://www.r-project.org/logo/Rlogo.png") ggplot(df1, aes(x, y)) + geom_image(aes(image=image), size=1) library("ggimage") ... -
基于一些试验和错误,它看起来像你想要的 + xlim(c(10300,11000)) 而不是 + coord_cartesian(xlim = c(10300, 11000)) coord_cartesian扩展了图的极限,但并没有改变它们内部绘制的内容...... Based on some trial and error, it looks like you want + xlim(c(10300,11000)) rather than + coord_cartesian(xlim = ...
-
如何在ggplot2中绘制xts?(How to plot xts in ggplot2?)[2022-07-13]
感谢@ jlhoward的回答 ,我使用fortify()函数使用ggplot2创建上面的图 library(ggplot2) nats1 <- fortify(nats) M1.1 <- fortify(M1) M2.2 <- fortify(M2) M3.3 <- fortify(M3) cols <- c("a"="black", "Actual value" = "black","M1"="red","M2"="blue", "M3" = "green") ggplot(data=nats1, ... -
与ggplot中的大多数内容一样,绘图实际上非常简单,大部分工作都是使您的数据处于正确的形状,这样才有意义。 完全不需要for循环, geom_polygon()只需要一个带有x和y坐标的数据geom_polygon() ,以及一个定义它们属于哪个组的变量。 使用您的数据: library(ggplot2) library(reshape2) #Get your coordinates in long format with an id hexdat.x <- melt(cbind(id = 1:leng ...
-
也许这样: ggplot(data = diamonds) + geom_histogram(aes(x = x,y = ..count..)) + geom_histogram(aes(x = x,y = -..count..)) 仅供参考 - 我不记得过去我是怎么做到的,所以我用Google搜索了“ggplot2倒排直方图”并点击了第一个点击 ,一个StackOverflow问题。 我不确定stat_bin返回的proto对象究竟是如何构造的,但新变量就在那里。 这种方式的工作方式 ...