我正在尝试使用csv文件中的数据绘制平行坐标图。 csv文件包含四列。数据的一个例子是:
<script type="text/javascript">
$(function () {
$.get("/mail/getmails", function (data) {
$("#MailReceivers").selectize({
persist: false,
plugins: ['remove_button'],
maxItems: null,
valueField: 'id',
labelField: 'name',
searchField: ['name', 'id'],
options: JSON.stringify(data),
create: function (input) {
return {name: input};
}
});
});
});
</script>
我收到$dbhost = '*********';
$dbuser = '*********';
$dbpass = '*********';
$dbname = 'applicationinfo';
// Create connection
$conn = new mysqli($dbhost, $dbuser, $dbpass, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
// prepare and bind
$stmt = $conn->prepare("INSERT INTO applicationinfo (Name, Email, Email_confirmation, Activity, Quote, Username, Password, Password_Confirmation, `13+`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)");
// first argument can be one of 4 types (i - integer, d - double, s - string, b - BLOB) You must have one of these for each parameter/field.
$stmt->bind_param("sssssssss", $name, $email, $email_conf, $activity, $quote, $username, $password, $password_conf, $one_three);
// set parameters and execute
$name = "Joe Snuffy";
$email = "joe.snuffy@example.com";
$email_conf = "joe.snuffy@example.com";
$activity = "Test";
$quote = "quote";
$username = "username";
$password = "password";
$password_conf = "pass conf";
$one_three = "yes";
$stmt->execute();
echo "New records created successfully";
$stmt->close();
$conn->close();
的错误。我不知道我做错了什么。这是我到目前为止的代码。
A, B, C, D
1, 2, 4, 8
5, 6, 1, 5
6, 5, 5, 10
答案 0 :(得分:0)
一种方法是为每一列创建列表,然后将其转换为数组并绘制:
例如:
A = ['1','2','3','4'] #list
A = [int(i) for i in A]
O/p A = [1,2,3,4] #array
然后您可以绘制平行坐标。