[ Launch: wish curve maker ] 8738554 by lewis500
[ Launch: chartmaker ] 7376611 by lewis500
-
-
Save lewis500/8738554 to your computer and use it in GitHub Desktop.
new utility
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
{"description":"new utility","endpoint":"","display":"svg","public":true,"require":[],"fileconfigs":{"inlet.js":{"default":true,"vim":false,"emacs":false,"fontSize":12},"style.css":{"default":true,"vim":false,"emacs":false,"fontSize":12},"_.md":{"default":true,"vim":false,"emacs":false,"fontSize":12},"config.json":{"default":true,"vim":false,"emacs":false,"fontSize":12},"draw.js":{"default":true,"vim":false,"emacs":false,"fontSize":12},"dataMaker.js":{"default":true,"vim":false,"emacs":false,"fontSize":12}},"fullscreen":false,"play":false,"loop":false,"restart":false,"autoinit":true,"pause":true,"loop_type":"pingpong","bv":false,"nclones":15,"clone_opacity":0.4,"duration":3000,"ease":"linear","dt":0.01,"thumbnail":"http://i.imgur.com/hsPV2XY.gif","ajax-caching":true} |
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 data = []; | |
data.push({ | |
name: "Wish", | |
values: [ | |
{x: 33, y: 0}, | |
{x: 60, y: 77} | |
] | |
}) |
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 data = []; | |
var tc = 60; | |
var gamma = 2; | |
var beta = 0.5; | |
var maxX = 100; | |
var b0 = 0.419328; | |
var g = 90; | |
var b1= 0.0672 | |
var sigData = linspace(2,maxX, 1).map(function(s){ | |
return { | |
y: 200/s*(1-30/Math.pow(s,1.612)) , | |
x: s}; | |
}); | |
data.push({ | |
name: "E", | |
values: sigData | |
}) | |
var margin = {top: 68, right: 27, bottom: 12, left: 102}, | |
width = 638 - margin.left - margin.right, | |
height = 367 - margin.top - margin.bottom; | |
var yLabel ="load", | |
xLabel = "time"; | |
var svg = d3.select("svg"); | |
var group = svg.append("g") | |
.attr("transform", "translate(" + margin.left + "," + margin.top + ")"); | |
var x = d3.scale.linear() | |
.range([0, width]); | |
var y = d3.scale.linear() | |
.range([height, 0]); | |
var color = d3.scale.category10(); | |
x.domain([0,d3.max(sigData.map(function(d){return d.x;}))]) | |
y.domain([0,d3.max(sigData.map(function(d){return d.y;}))]) | |
var xAxis = d3.svg.axis() | |
.scale(x) | |
.orient("bottom"); | |
var yAxis = d3.svg.axis() | |
.scale(y) | |
.orient("left"); | |
var line = d3.svg.line() | |
.x(function(d) { return x(d.x); }) | |
.y(function(d) { return y(d.y); }) | |
//.interpolate("basis"); | |
var plot = group.selectAll(".plot") | |
.data(data) | |
.enter().append("g") | |
.attr("class", "plot"); | |
plot.append("path") | |
.attr("class", "line") | |
.attr("d", function(d) { return line(d.values); }) | |
.style("stroke", function(d) { return color(d.name); }); | |
group.append("g") | |
.attr("class", "x axis") | |
.attr("transform", "translate(0," + height + ")") | |
.call(xAxis) | |
group.append("g") | |
.attr("class", "y axis") | |
.call(yAxis) | |
function linspace(a, b, precision) { | |
var c = 1.0 / precision; | |
a = a * c; | |
b = b * c; | |
return d3.range(a, b).map(function(d) { | |
return d * precision; | |
}); | |
} | |
function P(n, m) { | |
return Math.pow(n, m) | |
} | |
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
.axis path, | |
.axis line { | |
fill: none; | |
stroke: #000; | |
shape-rendering: crispEdges; | |
} | |
.tick text{ | |
// fill: none | |
} | |
.line { | |
fill: none; | |
stroke: steelblue; | |
stroke-width: 1.5px; | |
} | |
body { | |
background-color: white; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment