This block demonstrates a minimal example for collaborative interaction on a visualization using VisConnect.
The block is based on https://observablehq.com/@d3/circle-dragging-i. This block simply adds VisConnect and replaces Math.random()
with vc.random
, and d3.drag
with vc.drag
.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var DataDrivenInteraction = /** @class */ (function () { | |
function DataDrivenInteraction() { | |
} | |
DataDrivenInteraction.prototype.define = function (interactionName) { | |
return new DdiInteraction(interactionName); | |
}; | |
return DataDrivenInteraction; | |
}()); | |
var DdiInteraction = /** @class */ (function () { | |
function DdiInteraction(name) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<meta charset="utf-8"> | |
<style> | |
.links line { | |
stroke: #999; | |
stroke-opacity: 0.6; | |
} | |
.nodes circle { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getParsedData(response) { | |
const data = {}; | |
// [0] is temperature. [1] is U component of wind, [2] is V component of wind. | |
for (let i = 1; i < response.length; i++) { | |
const dataPart = response[i]; | |
const startLatitude = Math.min(dataPart.header.la1, dataPart.header.la2); | |
const endLatitude = Math.max(dataPart.header.la1, dataPart.header.la2); | |
const latitudePoints = endLatitude - startLatitude + 1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getParsedData(response) { | |
const data = {}; | |
// [0] is temperature. [1] is U component of wind, [2] is V component of wind. | |
for (let i = 1; i < response.length; i++) { | |
const dataPart = response[i]; | |
const startLatitude = Math.min(dataPart.header.la1, dataPart.header.la2); | |
const endLatitude = Math.max(dataPart.header.la1, dataPart.header.la2); | |
const latitudePoints = endLatitude - startLatitude + 1; |
This is an example of how VisConnect's event sharing can be used to easily create a chat application.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<meta charset="utf-8"> | |
<body collaboration="live" custom-events="brush-message, label-message" ignore-events="all"> | |
<script src="https://unpkg.com/peerjs@1.0.4/dist/peerjs.min.js"></script> | |
<script src="https://michaschwab.github.io/VisConnect/visconnect-bundle.js"></script> | |
<script src="//d3js.org/d3.v4.min.js"></script> | |
<h1>VisConnect Brushing</h1> | |
<p> | |
This VisConnect example is a copy of |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<meta charset="utf-8"> | |
<body collaboration="live" custom-events="brush-message, label-message" ignore-events="all"> | |
<script src="https://unpkg.com/peerjs@1.0.4/dist/peerjs.min.js"></script> | |
<script src="https://michaschwab.github.io/VisConnect/visconnect-bundle.js"></script> | |
<script src="//d3js.org/d3.v4.min.js"></script> | |
<h2>VisConnect Brushing</h2> | |
<p> | |
This VisConnect example is a copy of |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en-US"> | |
<head> | |
<title>VisConnect Demo</title> | |
<script src="https://unpkg.com/peerjs@1.0.4/dist/peerjs.min.js"></script> | |
<script src="https://d3js.org/d3.v4.min.js"></script> | |
<script src="https://unpkg.com/visconnect@1.0.0/visconnect-bundle.js"></script> | |
</head> | |
<body> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<svg width="300" height="300" id="original" style="border: 1px solid #000"><text y="15">Original</text></svg> | |
<svg width="300" height="300" id="clustered" style="border: 1px solid #000"><text y="15">Clustered</text></svg><br /> | |
Neighbor points considered: | |
<input id="neighborCount" type="number" value="30" min="1" max="100" onchange="updateClusters()" /> | |
More is more accurate but slower.<br /> | |
Gaussian sigma for scoring distances: | |
<input id="sigma" type="number" value="50" min="1" max="100" onchange="updateClusters()" /> | |
At this distance, items get a score of 0.68.<br /> |