hysysk / data-driven-timelines Goto Github PK
View Code? Open in Web Editor NEW複数ストリームのタイムライン表示ソフトウェア
複数ストリームのタイムライン表示ソフトウェア
ズームイン・アウトはボタンで行い、段階的にする。
ズームインした際には時間単位、ズームアウトした際には日単位になるよう調整。ラベルがぶつからないようにticksも調整する。
ズームイン・アウトによって文字が歪む。アプローチとしては2つ。
やり方は2種類
ズームイベントなどが適用されない。ラベルとのずれもできる。
未来の終点と過去の始点がつながってしまい、表示がおかしくなる。
ある時点で発生した事柄を比較するため、縦の線が重要。視認性を高めるためにグリッドを追加する。
ズームイン/アウト、パンに応じて新たなデータを取得して描画する。メモリを考慮すると適当に間引いたり、破棄する必要もありそう。
処理の流れメモ
ズームアウトした場合、複数年分のデータを取ることは処理が重そう。描画アルゴリズムを変えるか、そもそも一気に取得できるデータの上限を決める。
zoomのscaleExtentで拡大縮小の制限はかけられる。
マウスオーバーでチャートの値を表示。クリックで固定。
TimelineJSは以下のような書式を定めている
https://docs.google.com/spreadsheets/d/12iX_j2B9u7_m2rbW5mSV8asKzmIPtfJgp2S8r52PLek/edit#gid=0
当初はあるプロパティの中にHTMLが直接流し込めるような形式を考えていましたが、セキュリティやデータの作りやすさを考慮するとこのように書式を定める方が良いかもと思います。
エンドポイントに対しいつからいつまでのデータを取得するかのパラメータを付加してリクエストする。
日時の指定はISO 8601に従う。UTC以外のタイムゾーンを使う場合はオフセットをつけてやり取りする。
Request
http://api.example.com/v1/timelines?since=2017-01-01&until=2017-01-31
Result
{
"start_at":"2017-01-01T00:00:00Z",
"end_at":"2017-01-03T23:59:59Z",
"label":"Holiday"
}
Request
http://api.example.com/v1/points?since=2017-01-01&until=2017-01-31
Result
{
"at":"2017-01-01T00:00:00Z",
"value":"13.0"
}
Request
http://api.example.com/v1/events?since=2017-01-01&until=2017-01-31
Result A
{
"at":"2017-01-01T00:00:00Z",
"label":"New Year",
"value": "<h1>Happy New Year</h1><p>2017</p>"
}
Result B
{
"at":"2017-01-01T00:00:00Z",
"label":"New Year",
"title": "Happy New Year",
"body": "2017",
"source_url": "http://example.com",
"media": {[
{"type": "image", "url": "http://example.com/image.jpg"},
{"type": "movie", "url": "htto://example.com/movie.mp4"}
]}
}
Result C
{
"at":"2017-01-01T11:40:23Z",
"label":"username",
"title": "",
"body": "めちゃくちゃ降ってきた!",
"thumbnail": "https://twitter.com/userimage.png",
"source_url": "https://twitter.com/statuses/123",
"media": {[
{"type": "image", "url": "http://example.com/image.jpg"},
{"type": "movie", "url": "htto://example.com/movie.mp4"}
]}
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.