Git Product home page Git Product logo

data-driven-timelines's People

Contributors

hysysk avatar

Watchers

 avatar  avatar

Forkers

kitamotoasanobu

data-driven-timelines's Issues

文字の歪みを直す

ズームイン・アウトによって文字が歪む。アプローチとしては2つ。

  • ズームイベント終了後に変化量の逆数をかける
  • 変化させない

タイムラインの表示方法

タイムラインの表示方法

  • 期間が重複した場合に自動で位置を調整する 参考
  • カテゴリーによって別のラインを作る 参考
    上記の方法はd3のプラグインで作られているが、APIが古い。ソースコードのライセンスはPublic Domainなので参考にしつつ、今回のプロジェクトに取り込む。

リファクタリング

  • 各チャートをモジュール化
  • 読み込み時に必要なコンポーネントを生成するようにする
  • マジックナンバーを整理
  • テスト書く
    • jasmineを使う

グリッドを追加

ある時点で発生した事柄を比較するため、縦の線が重要。視認性を高めるためにグリッドを追加する。

逐次的にデータを取り込んで描画する

ズームイン/アウト、パンに応じて新たなデータを取得して描画する。メモリを考慮すると適当に間引いたり、破棄する必要もありそう。

処理の流れメモ

  • 表示されているX軸の区間のデータを問い合せる
  • データを描画

ズームアウトした場合、複数年分のデータを取ることは処理が重そう。描画アルゴリズムを変えるか、そもそも一気に取得できるデータの上限を決める。

zoomのscaleExtentで拡大縮小の制限はかけられる。

値の表示

マウスオーバーでチャートの値を表示。クリックで固定。

API仕様

エンドポイントに対しいつからいつまでのデータを取得するかのパラメータを付加してリクエストする。
日時の指定は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"}
  ]}
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.