Commit ·
a970d92
1
Parent(s): 77ddc6f
Update space
Browse files- README.md +31 -12
- index.html +37 -19
- style.css +60 -18
README.md
CHANGED
|
@@ -1,12 +1,31 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Confidence Intervals OJS/D3 Version
|
| 2 |
+
|
| 3 |
+
This is a reimplementation of the Confidence Intervals app using Observable JavaScript (OJS) and D3.js.
|
| 4 |
+
|
| 5 |
+
## Local Development
|
| 6 |
+
|
| 7 |
+
1. Install Node.js if you don't have it already
|
| 8 |
+
2. Clone this repository
|
| 9 |
+
3. Navigate to the ojs_version directory
|
| 10 |
+
4. Run a local server:
|
| 11 |
+
```
|
| 12 |
+
npx http-server
|
| 13 |
+
```
|
| 14 |
+
5. Open your browser to http://localhost:8080
|
| 15 |
+
|
| 16 |
+
## Hosting on Hugging Face Spaces
|
| 17 |
+
|
| 18 |
+
1. Create a new Space on Hugging Face (https://huggingface.co/spaces)
|
| 19 |
+
2. Choose "Static HTML" as the Space type
|
| 20 |
+
3. Upload these files to your Space repository:
|
| 21 |
+
- index.html
|
| 22 |
+
- style.css
|
| 23 |
+
- script.js
|
| 24 |
+
- any other assets
|
| 25 |
+
4. Your app will be hosted at https://huggingface.co/spaces/[your-username]/[your-space-name]
|
| 26 |
+
|
| 27 |
+
## Structure
|
| 28 |
+
|
| 29 |
+
- `index.html`: Main HTML file that loads the OJS runtime and D3
|
| 30 |
+
- `script.js`: Contains the OJS code for the interactive visualizations
|
| 31 |
+
- `style.css`: Styling for the application
|
index.html
CHANGED
|
@@ -1,19 +1,37 @@
|
|
| 1 |
-
<!
|
| 2 |
-
<html>
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
</
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>Confidence Intervals Interactive</title>
|
| 7 |
+
<link rel="stylesheet" href="style.css">
|
| 8 |
+
<script src="https://cdn.jsdelivr.net/npm/d3@7"></script>
|
| 9 |
+
<script type="module">
|
| 10 |
+
import {Runtime, Inspector} from "https://cdn.jsdelivr.net/npm/@observablehq/runtime@5/dist/runtime.js";
|
| 11 |
+
import define from "./script.js";
|
| 12 |
+
new Runtime().module(define, name => {
|
| 13 |
+
return new Inspector(document.querySelector(`#${name}`));
|
| 14 |
+
});
|
| 15 |
+
</script>
|
| 16 |
+
</head>
|
| 17 |
+
<body>
|
| 18 |
+
<header>
|
| 19 |
+
<h1>Learning about Confidence Intervals</h1>
|
| 20 |
+
<h5>Created by Keefe Reuther, OJS version</h5>
|
| 21 |
+
</header>
|
| 22 |
+
|
| 23 |
+
<div class="tabs">
|
| 24 |
+
<button class="tab-btn active" data-tab="single-sample">Single Sample</button>
|
| 25 |
+
<button class="tab-btn" data-tab="multiple-samples">Multiple Samples</button>
|
| 26 |
+
<button class="tab-btn" data-tab="bootstrapping">Bootstrapping</button>
|
| 27 |
+
</div>
|
| 28 |
+
|
| 29 |
+
<div id="content">
|
| 30 |
+
<div id="tab1" class="viewof-singleSampleSD"></div>
|
| 31 |
+
<div id="singleSamplePlot"></div>
|
| 32 |
+
<!-- More observable outputs will be placed here -->
|
| 33 |
+
</div>
|
| 34 |
+
|
| 35 |
+
<script src="ui.js"></script>
|
| 36 |
+
</body>
|
| 37 |
+
</html>
|
style.css
CHANGED
|
@@ -1,28 +1,70 @@
|
|
| 1 |
body {
|
| 2 |
-
|
| 3 |
-
|
|
|
|
|
|
|
| 4 |
}
|
| 5 |
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
}
|
| 10 |
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
margin-top: 5px;
|
| 16 |
}
|
| 17 |
|
| 18 |
-
.
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
}
|
| 25 |
|
| 26 |
-
.
|
| 27 |
-
|
|
|
|
| 28 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
body {
|
| 2 |
+
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
|
| 3 |
+
max-width: 1200px;
|
| 4 |
+
margin: 0 auto;
|
| 5 |
+
padding: 20px;
|
| 6 |
}
|
| 7 |
|
| 8 |
+
header {
|
| 9 |
+
text-align: center;
|
| 10 |
+
margin-bottom: 20px;
|
| 11 |
}
|
| 12 |
|
| 13 |
+
.tabs {
|
| 14 |
+
display: flex;
|
| 15 |
+
margin-bottom: 20px;
|
| 16 |
+
border-bottom: 1px solid #ddd;
|
|
|
|
| 17 |
}
|
| 18 |
|
| 19 |
+
.tab-btn {
|
| 20 |
+
background: none;
|
| 21 |
+
border: none;
|
| 22 |
+
padding: 10px 20px;
|
| 23 |
+
cursor: pointer;
|
| 24 |
+
font-size: 16px;
|
| 25 |
}
|
| 26 |
|
| 27 |
+
.tab-btn.active {
|
| 28 |
+
border-bottom: 3px solid #4e79a7;
|
| 29 |
+
font-weight: bold;
|
| 30 |
}
|
| 31 |
+
|
| 32 |
+
#content {
|
| 33 |
+
display: flex;
|
| 34 |
+
flex-wrap: wrap;
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
.control-panel {
|
| 38 |
+
width: 300px;
|
| 39 |
+
padding: 20px;
|
| 40 |
+
background-color: #f5f5f5;
|
| 41 |
+
border-radius: 5px;
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
.input-group {
|
| 45 |
+
margin-bottom: 15px;
|
| 46 |
+
}
|
| 47 |
+
|
| 48 |
+
label {
|
| 49 |
+
display: block;
|
| 50 |
+
margin-bottom: 5px;
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
button {
|
| 54 |
+
background-color: #4e79a7;
|
| 55 |
+
color: white;
|
| 56 |
+
border: none;
|
| 57 |
+
padding: 10px 15px;
|
| 58 |
+
border-radius: 4px;
|
| 59 |
+
cursor: pointer;
|
| 60 |
+
}
|
| 61 |
+
|
| 62 |
+
button:hover {
|
| 63 |
+
background-color: #3a5a80;
|
| 64 |
+
}
|
| 65 |
+
|
| 66 |
+
hr {
|
| 67 |
+
margin: 20px 0;
|
| 68 |
+
border: none;
|
| 69 |
+
border-top: 1px solid #ddd;
|
| 70 |
+
}
|