Updated to a prototype

This commit is contained in:
2017-12-03 11:01:37 +01:00
parent aa87d13654
commit 45b2d6819d
6 changed files with 1990 additions and 345 deletions

View File

@@ -32,6 +32,7 @@
<div class="step" id="growth" data-scale="5" data-x="-500" data-y="0">
<svg id="intro"></svg>
</div>
<div id="test" class="step" data-x="-500" data-y="0" data-scale="5" data-rotate-y="-45"></div>
<div id="overview" class="step" data-x="3000" data-y="2000" data-scale="9" style="pointer-events: none;"></div>
</div>

131
index.js
View File

@@ -1,70 +1,97 @@
let margin = {
top: 20,
right: 20,
bottom: 30,
left: 50
};
let intro_svg;
let width = 960 - margin.left - margin.right;
let height = 500 - margin.top - margin.bottom;
function make_intro_svg() {
"use strict";
let maxValue;
let yAxis, yAxisG, dataArea, dataLine;
let margin = {
top: 20,
right: 20,
bottom: 30,
left: 50
};
let x = d3.scaleTime().range([0, width]);
let y = d3.scaleLinear().range([height, 0]);
let width = 960 - margin.left - margin.right;
let height = 500 - margin.top - margin.bottom;
let area = d3.area()
.x(function (d) { return x(d.date) })
.y0(height)
.y1(function (d) { return y(d.volume) });
let x = d3.scaleTime().range([0, width]);
let y = d3.scaleLinear().range([height, 0]);
let valueline = d3.line()
.x(function (d) { return x(d.date) })
.y(function (d) { return y(d.volume) });
let area = d3.area()
.x(function (d) { return x(d.date) })
.y0(height)
.y1(function (d) { return y(d.volume) });
let svg = d3.select('svg#intro')
.attr('width', width + margin.left + margin.bottom)
.attr('height', height + margin.top + margin.bottom)
.append('g')
.attr('transform', `translate(${margin.left},${margin.top})`);
let valueline = d3.line()
.x(function (d) { return x(d.date) })
.y(function (d) { return y(d.volume) });
console.log(x);
intro_svg = d3.select('svg#intro')
.attr('width', width + margin.left + margin.bottom)
.attr('height', height + margin.top + margin.bottom)
.append('g')
.attr('transform', `translate(${margin.left},${margin.top})`);
d3.csv('crypto-markets.csv', function (d) {
console.log(x);
d3.csv('volume.csv', function (d) {
return {
date: new Date(d.date),
open: +d.open,
high: +d.high,
low: +d.low,
close: +d.close,
volume: +d.volume,
market: +d.market,
symbol: d.symbol,
coin: d.coin,
variance: +d.variance,
volatility: +d.volatility
volume: +d.volume, // make sure volume is numeric
}
}, function (d) {
plotArea(d);
});
plotArea(d);
});
function plotArea(data) {
x.domain(d3.extent(data, d => d.date));
y.domain([0, d3.max(data, d => d.volume)]);
function plotArea(data) {
"use strict";
x.domain(d3.extent(data, d => d.date));
maxValue = d3.max(data, d=> d.volume);
y.domain([0, 1000000000]);
svg.append('path')
.data([data])
.attr('class', 'area')
.attr('d', area);
dataArea = intro_svg.append('path')
.data([data])
.attr('class', 'area')
.attr('d', area);
svg.append('path')
.data([data])
.attr('class', 'line')
.attr('d', valueline);
dataLine = intro_svg.append('path')
.data([data])
.attr('class', 'line')
.attr('d', valueline);
svg.append('g')
.attr("transform", `translate(0, ${height})`)
.call(d3.axisBottom(x));
intro_svg.append('g')
.attr("transform", `translate(0, ${height})`)
.call(d3.axisBottom(x));
svg.append('g')
.call(d3.axisLeft(y));
yAxis = d3.axisLeft(y);
yAxisG = intro_svg.append('g')
.attr('class', 'yaxis')
.call(yAxis);
}
d3.select("#growth1").on('impress:stepenter', function () {
y.domain([0, 1000000000]);
yAxisG
.call(yAxis);
dataArea
.attr('d', yAxis);
dataLine
.attr('d', yAxis);
});
d3.select("#growth").on('impress:stepenter', function () {
y.domain([0, maxValue]);
yAxisG
.call(yAxis);
dataArea
.attr('d', yAxis);
dataLine
.attr('d', yAxis);
});
}
make_intro_svg();

397
style.css
View File

@@ -1,310 +1,97 @@
/*
A common approach is to use googleapis.com to generate css for the webfonts you want to use.
The downside of this approach is that you have to be online. So below I have simply saved
the output of the googleapis url into a file. Then you of course also have to make sure
the webfonts are locally installed to make offline usage work. For Ubuntu (or Debian) I
successfully used the script from here to do that:
http://www.webupd8.org/2011/01/automatically-install-all-google-web.html
*/
@import url(http://fonts.googleapis.com/css?family=Open+Sans:regular,semibold,italic,italicsemibold|PT+Sans:400,700,400italic,700italic|PT+Serif:400,700,400italic,700italic|Cutive+Mono);
/*
We display a fallback message for users with browsers that don't support
all the features required by it. All of the content will be still fully
accessible for them, but some more advanced effects would be missing.
When impress.js detects that browser supports all necessary CSS3 features,
the fallback-message style is hidden.
*/
@import url("https://fonts.googleapis.com/css?family=Roboto");
.fallback-message {
font-family: sans-serif;
line-height: 1.3;
width: 780px;
padding: 10px 10px 0;
margin: 20px auto;
border: 1px solid #E4C652;
border-radius: 10px;
background: #EEDC94;
}
font-family: sans-serif;
line-height: 1.3;
width: 780px;
padding: 10px 10px 0;
margin: 20px 0;
border: 1px solid #E4C652;
border-radius: 10px;
background: #EEDC94; }
.fallback-message p {
margin-bottom: 10px;
}
margin-bottom: 10px; }
.impress-supported .fallback-message {
display: none;
}
/*
The body background is the bacgkround of "everything". Many
impress.js tools call it the "surface". It could also be a
picture or pattern, but we leave it as light gray.
*/
display: none; }
body {
font-family: 'PT Sans', sans-serif;
min-height: 740px;
background: #aaccbb;
color: #ff4466;
}
/*
Now let's style the presentation steps.
*/
font-family: Roboto, sans-serif;
min-height: 740px;
background: #aaccbb;
color: #ff4466; }
.step {
position: relative;
display: block;
position: relative;
display: block;
width: 900px;
height: 700px;
margin: 20px auto;
padding: 40px 60px;
text-shadow: 0 2px 2px rgba(0, 10, 0, 0.5);
font-size: 30px;
letter-spacing: -1px; }
width: 900px;
height: 700px;
margin: 20px auto;
padding: 40px 60px;
text-shadow: 0 2px 2px rgba(0, 10, 0, .5);
font-family: 'Open Sans', Arial, sans-serif;
font-size: 30px;
letter-spacing: -1px;
}
/*
Make inactive steps a little bit transparent.
*/
.impress-enabled .step {
margin: 0;
opacity: 0.3;
transition: opacity 1s;
}
.impress-enabled .step.active { opacity: 1 }
/*
Speaker notes allow you to write comments within the steps, that will not
be displayed as part of the presentation. However, they will be picked up
and displayed by impressConsole.js when integrated.
*/
margin: 0; }
.notes {
display: none;
}
display: none; }
h1,
h2,
h3 {
margin-bottom: 0.5em;
margin-top: 0.5em;
text-align: center;
}
h1, h2, h3 {
margin-bottom: 0.5em;
margin-top: 0.5em;
text-align: center; }
p {
text-align: center;
margin: 0.7em;
}
text-align: center;
margin: 0.7em; }
li {
margin: 0.2em;
}
/* Highlight.js used for coloring pre > code blocks. */
pre > code {
font-size: 14px;
text-shadow: 0 0 0 rgba(0, 0, 0, 0);
}
/* Inline code, no Highlight.js */
code {
font-family: "Cutive mono","Courier New", monospace;
}
margin: 0.2em; }
a {
color: inherit;
text-decoration: none;
padding: 0 0.1em;
background: rgba(200,200,200,0.3);
text-shadow: -1px 1px 2px rgba(100,100,100,0.9);
border-radius: 0.2em;
border-bottom: 1px solid rgba(100,100,100,0.4);
border-left: 1px solid rgba(100,100,100,0.4);
color: inherit;
text-decoration: none;
padding: 0 0.1em;
background: rgba(200, 200, 100, 0.9);
text-shadow: -1px 1px 2px rgba(100, 100, 100, 0.9);
border-radius: 0.2em;
border-bottom: 1px solid rgba(100, 100, 100, 0.4);
border-left: 1px solid rgba(100, 100, 100, 0.4);
-webkit-transition: 0.5s;
-moz-transition: 0.5s;
-ms-transition: 0.5s;
-o-transition: 0.5s;
transition: 0.5s; }
a:hover, a:focus {
background: #c8c8ff;
text-shadow: -1px px 2px rgba(100, 100, 100, 0.5); }
transition: 0.5s;
}
a:hover,
a:focus {
background: rgba(200,200,200,1);
text-shadow: -1px 1px 2px rgba(100,100,100,0.5);
}
blockquote, q {
font-style: italic;
font-weight: 400; }
blockquote {
font-family: 'PT Serif';
font-style: italic;
font-weight: 400;
}
em {
text-shadow: 0 2px 2px rgba(0, 0, 0, .3);
}
em, q {
text-shadow: 0 2px 2px rgba(0, 0, 0, 0.3); }
strong {
text-shadow: -1px 1px 2px rgba(100,100,100,0.5);
}
q {
font-family: 'PT Serif';
font-style: italic;
font-weight: 400;
text-shadow: 0 2px 2px rgba(0, 0, 0, .3);
}
text-shadow: -1px 1px 2px rgba(100, 100, 100, 0.5); }
strike {
opacity: 0.7;
}
opacity: 0.7; }
small {
font-size: 0.4em;
}
font-size: 0.4em; }
img {
width: 300px
}
width: 300px; }
/****************** Background images **********************************************/
img.bg {
position: fixed;
z-index: -100;
opacity: 0;
height: 50%;
width: auto;
transition: opacity 2s;
}
#applepie-image {
left: 0px;
bottom: 0px;
}
body.impress-on-applepie #applepie-image,
body.impress-on-applepie-pro #applepie-image,
body.impress-on-applepie-con #applepie-image,
body.impress-on-conclusion #applepie-image,
body.impress-on-overview #applepie-image {
opacity: 0.7;
transition: opacity 2s;
}
#icecream-image {
right: 0px;
top: 0px;
}
body.impress-on-icecream #icecream-image,
body.impress-on-icecream-pro #icecream-image,
body.impress-on-icecream-con #icecream-image,
body.impress-on-conclusion #icecream-image,
body.impress-on-overview #icecream-image {
opacity: 0.7;
transition: opacity 2s;
}
#crisps-image {
right: 0px;
bottom: 0px;
}
body.impress-on-crisps #crisps-image,
body.impress-on-crisps-pro #crisps-image,
body.impress-on-crisps-con #crisps-image,
body.impress-on-conclusion #crisps-image,
body.impress-on-overview #crisps-image {
opacity: 0.7;
transition: opacity 2s;
}
/*************** Slide specific things ****************************/
#image-credits {
color: #779988;
}
/******************* PLUGINS *************************************************************/
/*
This version of impress.js supports plugins, and in particular, a UI toolbar
plugin that allows easy navigation between steps and autoplay.
*/
.impress-enabled div#impress-toolbar {
position: fixed;
right: 1px;
bottom: 1px;
opacity: 0.6;
z-index: 10;
}
.impress-enabled div#impress-toolbar > span {
margin-right: 10px;
}
/*
With help from the mouse-timeout plugin, we can hide the toolbar and
have it show only when you move/click/touch the mouse.
*/
body.impress-mouse-timeout div#impress-toolbar {
display: none;
}
/*
In fact, we can hide the mouse cursor itself too, when mouse isn't used.
*/
body.impress-mouse-timeout {
cursor: none;
}
/* Progress bar */
.impress-progressbar {
position: absolute;
right: 118px;
bottom: 1px;
left: 118px;
border-radius: 7px;
border: 2px solid rgba(100, 100, 100, 0.2);
}
.impress-progressbar DIV {
width: 0;
height: 2px;
border-radius: 5px;
background: rgba(75, 75, 75, 0.4);
transition: width 1s linear;
}
.impress-progress {
position: absolute;
left: 59px;
bottom: 1px;
text-align: left;
font-size: 10pt;
opacity: 0.6;
}
/* Help popup plugin */
.impress-enabled #impress-help {
.impress-enabled {
pointer-events: none; }
.impress-enabled #impress, .impress-enabled #impress-toolbar {
pointer-events: auto; }
.impress-enabled #impress-help {
background: none repeat scroll 0 0 rgba(0, 0, 0, 0.5);
color: #EEEEEE;
font-size: 80%;
@@ -316,24 +103,48 @@ body.impress-mouse-timeout {
padding: 1em;
text-align: center;
z-index: 100;
font-family: Verdana, Arial, Sans;
}
.impress-enabled #impress-help td {
padding-left: 1em;
padding-right: 1em;
}
font-family: Roboto, serif; }
.impress-enabled #impress-help td {
padding-left: 1em;
padding-right: 1em; }
.impress-enabled div#impress-toolbar {
position: fixed;
right: 1px;
bottom: 1px;
opacity: 0.6;
z-index: 10; }
.impress-enabled div#impress-toolbar span {
margin-right: 10px; }
/* Substep plugin */
body.impress-mouse-timeout {
cursor: none; }
body.impress-mouse-timeout div#impress-toolbar {
display: none; }
#impress .step .substep {
opacity: 0;
}
.impress-progressbar {
position: absolute;
right: 118px;
bottom: 1px;
left: 118px;
border-radius: 7px;
border: 2px solid rgba(100, 100, 100, 0.2); }
.impress-progressbar DIV {
width: 0;
height: 2px;
border-radius: 5px;
background: rgba(75, 75, 75, 0.4);
-webkit-transition: width 1s linear;
-moz-transition: width 1s linear;
-ms-transition: width 1s linear;
-o-transition: width 1s linear;
transition: width 1s linear; }
#impress .step .substep.substep-visible {
opacity: 1;
transition: opacity 1s;
}
.impress-progress {
position: absolute;
left: 59px;
bottom: 1px;
text-align: left;
font-size: 10px;
opacity: 0.6; }
.impress-enabled { pointer-events: none }
.impress-enabled #impress { pointer-events: auto }
.impress-enabled #impress-toolbar { pointer-events: auto }
/*# sourceMappingURL=style.cssmap */

7
style.css.map Normal file
View File

@@ -0,0 +1,7 @@
{
"version": 3,
"mappings": "AAEQ,6DAAqD;AAE7D,iBAAiB;EACf,WAAW,EAAE,UAAU;EACvB,WAAW,EAAE,GAAG;EAEhB,KAAK,EAAE,KAAK;E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AAe;IAChC,cAAc,EAAE,eAAe;IAC/B,aAAa,EAAE,eAAe;IAC9B,UAAU,EAAE,eAAe;;AAE/B,iBAAiB;EACf,QAAQ,EAAE,QAAQ;EAClB,IAAI,EAAE,IAAI;EACV,MAAM,EAAE,GAAG;EACX,UAAU,EAAE,IAAI;EAChB,SAAS,EAAE,IAAI;EACf,OAAO,EAAE,GAAG",
"sources": ["style2.sass"],
"names": [],
"file": "style2.css"
}

161
style.sass Normal file
View File

@@ -0,0 +1,161 @@
//@import url(https://fonts.googleapis.com/css?family=Open+Sans:regular,semibold,italic,italicsemibold|PT+Sans:400,700,400italic,700italic|PT+Serif:400,700,400italic,700italic|Cutive+Mono)
@import url('https://fonts.googleapis.com/css?family=Roboto')
.fallback-message
font-family: sans-serif
line-height: 1.3
width: 780px
padding: 10px 10px 0
margin: 20px 0
border: 1px solid #E4C652
border-radius: 10px
background: #EEDC94
.fallback-message p
margin-bottom: 10px
.impress-supported .fallback-message
display: none
body
font-family: Roboto, sans-serif
min-height: 740px
background: #aaccbb
color: #ff4466
.step
position: relative
display: block
width: 900px
height: 700px
margin: 20px auto
padding: 40px 60px
text-shadow: 0 2px 2px rgba(0, 10, 0, 0.5)
font-size: 30px
letter-spacing: -1px
.impress-enabled .step
margin: 0
.notes
display: none
h1, h2, h3
margin-bottom: 0.5em
margin-top: 0.5em
text-align: center
p
text-align: center
margin: 0.7em
li
margin: 0.2em
a
color: inherit
text-decoration: none
padding: 0 0.1em
background: rgba(200, 200, 100, 0.9)
text-shadow: -1px 1px 2px rgba(100, 100, 100, 0.9)
border-radius: 0.2em
border-bottom: 1px solid rgba(100, 100, 100, 0.4)
border-left: 1px solid rgba(100, 100, 100, 0.4)
-webkit-transition: 0.5s
-moz-transition: 0.5s
-ms-transition: 0.5s
-o-transition: 0.5s
transition: 0.5s
&:hover, &:focus
background: rgba(200, 200, 2000, 1)
text-shadow: -1px px 2px rgba(100, 100, 100, 0.5)
blockquote, q
font-style: italic
font-weight: 400
em, q
text-shadow: 0 2px 2px rgba(0, 0, 0, 0.3)
strong
text-shadow: -1px 1px 2px rgba(100, 100, 100, 0.5)
strike
opacity: 0.7
small
font-size: 0.4em
img
width: 300px
.impress-enabled
pointer-events: none
& #impress, #impress-toolbar
pointer-events: auto
& #impress-help
background: none repeat scroll 0 0 rgba(0, 0, 0, 0.5)
color: #EEEEEE
font-size: 80%
position: fixed
left: 2em
bottom: 2em
width: 24em
border-radius: 1em
padding: 1em
text-align: center
z-index: 100
font-family: Roboto, serif
& td
padding-left: 1em
padding-right: 1em
& div#impress-toolbar
position: fixed
right: 1px
bottom: 1px
opacity: 0.6
z-index: 10
& span
margin-right: 10px
body.impress-mouse-timeout
cursor: none
& div#impress-toolbar
display: none
.impress-progressbar
position: absolute
right: 118px
bottom: 1px
left: 118px
border-radius: 7px
border: 2px solid rgba(100, 100, 100, 0.2)
& DIV
width: 0
height: 2px
border-radius: 5px
background: rgba(75, 75, 75, 0.4)
-webkit-transition: width 1s linear
-moz-transition: width 1s linear
-ms-transition: width 1s linear
-o-transition: width 1s linear
transition: width 1s linear
.impress-progress
position: absolute
left: 59px
bottom: 1px
text-align: left
font-size: 10px
opacity: 0.6

1638
volume.csv Normal file

File diff suppressed because it is too large Load Diff