Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitbce5fc2

Browse files
committed
Experiment with timeline on the page.
1 parent0ed7815 commitbce5fc2

File tree

5 files changed

+89
-0
lines changed

5 files changed

+89
-0
lines changed

‎_posts/2009-02-02-timeline.md‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
bg:'white'
3+
fa-icon:calendar
4+
---
5+
6+
#Projects Timeline
7+
8+
<divid="visualization"></div>
9+

‎_posts/2010-01-04-sign.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
---
22
title:sign
33
fa-icon:pencil
4+
bg:lightgray
45
---
56

67
#Sign the pledge

‎combo.css‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,17 @@
33
{% include css/base.css %}
44
{% include css/skeleton.css %}
55
{% include css/main.css %}
6+
7+
.vis-item.py2 {
8+
background-color: greenyellow;
9+
border-color: green;
10+
}
11+
12+
/* create a custom sized dot at the bottom of the red item */
13+
.vis-item.red {
14+
background-color: red;
15+
border-color: darkred;
16+
color: white;
17+
font-family: monospace;
18+
box-shadow:0010px gray;
19+
}

‎index.html‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
<linkrel="stylesheet"href="combo.css">
1212
<linkhref='http://fonts.googleapis.com/css?family=Raleway:400,300,700'rel='stylesheet'type='text/css'>
1313
<linkrel="stylesheet"href="//netdna.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">
14+
<linkrel="stylesheet"href="//cdnjs.cloudflare.com/ajax/libs/vis/4.16.1/vis.min.css">
15+
<scriptsrc="//cdnjs.cloudflare.com/ajax/libs/vis/4.16.1/vis.min.js"></script>
1416
{% if site.favicon %}<linkrel="shortcut icon"href="{{ site.favicon }}"type="image/x-icon">{% endif %}
1517
{% if site.touch_icon %}<linkrel="apple-touch-icon"href="{{ site.touch_icon }}">{% endif %}
1618
</head>

‎site.js‎

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,5 +91,68 @@ $(document).ready(function (){
9191
}
9292
});
9393

94+
// DOM element where the Timeline will be attached
95+
varcontainer=document.getElementById('visualization');
96+
97+
vardata={
98+
'cpython':[
99+
{content:'Remaining Python 2.7 support',start:Date.now(),end:'2020-01-01'},
100+
],
101+
'ipython':[
102+
{content:'ipython 5.x LTS',start:'2016-06-01',end:'2019-06-01',py2:true},
103+
{content:'ipython 6.x',start:'2017-01-01',end:'2018-01-01'},
104+
{content:'ipython 7.x',start:'2018-01-01',end:'2019-06-12'},
105+
{content:'ipython 8.x',start:'2019-06-12',end:'2020-06-01'},
106+
],
107+
'matplotlib':[
108+
{content:'matplotlib 2.x',start:'2015-06-01',end:'2018-06-01',py2:true},
109+
{content:'matplotlib 3.x',start:'2018-6-12',end:'2019-12-01'},
110+
],
111+
'scikit-bio':[
112+
{content:'0.18',start:'2016-05-01',end:'2016-11-01',py2:true},
113+
{content:'0.19',start:'2016-11-02',end:'2017-12-01'},
114+
]
115+
116+
117+
}
118+
119+
// Create a DataSet (allows two way data-binding)
120+
varitems=newvis.DataSet([
121+
]);
122+
123+
124+
125+
vargroups=newvis.DataSet();
126+
g=0;
127+
i=0;
128+
for(vargnameindata){
129+
g++;
130+
groups.add({id:g,content:gname});
131+
gr=data[gname];
132+
for(varkingr){
133+
i++;
134+
gr[k].id=i;
135+
gr[k].group=g;
136+
if(gr[k].py2)gr[k].className='py2'
137+
items.add(gr[k])
138+
}
139+
}
140+
141+
// Configuration for the Timeline
142+
varoptions={};
143+
144+
varoptions={
145+
groupOrder:'group'// groupOrder can be a property name or a sorting function
146+
};
147+
148+
// Create a Timeline
149+
vartimeline=newvis.Timeline(container,items,options);
150+
timeline.setGroups(groups);
151+
timeline.setItems(items);
152+
timeline.addCustomTime(Date.parse('2020-01-01'))
153+
window.groups=groups;
154+
window.items=items;
155+
window.timeline=timeline;
156+
94157
});
95158

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp