2012-02-14 11 views
6

githubに表示されているパンチカードスタイルのグラフをハイチャートで複製したいと思います。私は本当にこの1に苦しんだHighcharts.jsを使ってパンチカードスタイルのグラフを作成する

GitHub Punch Card Graph

、ここではそこに私を取得するために開始しjsfiddleをです。私はむしろ、xとyの日を持つだろうが、私はこれをどうやってやるべきかについて迷っている。

助けてください。

TIA!

+0

jsfiddleをmangobugの提案を変更して更新しました。残されているのは、y軸上の時間を得ることだけです。 –

+1

y軸とx軸のラベルを取得するための別のアップデートがあります:http://jsfiddle.net/CA2cT/8/ – Mark

+0

完璧な仕上がり!それをドラッグしてくれてありがとう。 –

答えて

8

私は軸を反転することができませんでしたが、あなたのために多くのものを整理しました。

HTML:

<div id="container" style="height: 400px"></div> 

JS:

var chart = new Highcharts.Chart({ 
chart: { 
    renderTo: 'container', 
    defaultSeriesType: 'scatter' 
}, 

xAxis: { 
    categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] 
}, 
yAxis: { 

}, 
plotOptions: { 
    scatter: { 
     marker: { 
      radius: 4, 
      states: { 
       hover: { 
        enabled: true, 
        lineColor: 'rgb(100,100,100)' 
       } 
      } 
     }, 
     states: { 
      hover: { 
       marker: { 
        enabled: false 
       } 
      } 
     } 
    } 
}, 
series: [{ 
    data: [{y: 161}, {y: 167}, {y: 165}, {y: 140}, {y: 172}, {y: 163}, {y: 187}, {y: 107}, {y: 147}, {y: 145}, {y: 112}, {y: 199}] 
}] 
}); 
+0

スーパークローズ - 非常に高く評価されています。 y軸に00:00から24:00の時間を表示する方法を理解できれば、これが勝者になるでしょう。 Sun-Satをx軸に表示するようにフィディルドを更新しました。私を近づけてくれてありがとう。 –

+3

私は助けてくれてうれしいですが、投票が本当に励みになりました:P **冗談**。さらなる改善を検討しようとします。 –

2

私はupdated the jsFiddle @mangobugから何をしたい

+0

'Uncaught ReferenceError:Highchartsが定義されていません。 ' –

4

を行うための近い道にあなたを導くために、私はそれがだと思いますこのソリューションは同じ状況の他の人に役立つでしょう。

は、ここに私のソリューションです:

$(function() { 
    $('#container').highcharts({ 

    chart: { 
     defaultSeriesType: 'scatter' 
    }, 

    title: { 
     text: 'Punchcard' 
    }, 

    xAxis: { 
     type: "datetime", 
     dateTimeLabelFormats: { 
     hour: '%I %P' 
     }, 
     tickInterval: 3600000 * 1 
    }, 

    yAxis: { 
     categories: ['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'], 
    }, 

    series: [{ 
     data: [ 

     {y: 0, x: 3600000 * 1, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 0, x: 3600000 * 2, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 0, x: 3600000 * 3, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 0, x: 3600000 * 4, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 0, x: 3600000 * 5, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 0, x: 3600000 * 6, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 0, x: 3600000 * 7, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 0, x: 3600000 * 8, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 0, x: 3600000 * 9, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 0, x: 3600000 * 10, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 0, x: 3600000 * 11, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 0, x: 3600000 * 12, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 0, x: 3600000 * 13, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 0, x: 3600000 * 14, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 0, x: 3600000 * 15, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 0, x: 3600000 * 16, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 0, x: 3600000 * 17, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 0, x: 3600000 * 18, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 0, x: 3600000 * 19, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 0, x: 3600000 * 20, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 0, x: 3600000 * 21, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 0, x: 3600000 * 22, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 0, x: 3600000 * 23, marker: { radius: Math.floor(Math.random()*11) }}, 

     {y: 1, x: 3600000 * 1, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 1, x: 3600000 * 2, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 1, x: 3600000 * 3, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 1, x: 3600000 * 4, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 1, x: 3600000 * 5, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 1, x: 3600000 * 6, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 1, x: 3600000 * 7, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 1, x: 3600000 * 8, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 1, x: 3600000 * 9, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 1, x: 3600000 * 10, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 1, x: 3600000 * 11, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 1, x: 3600000 * 12, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 1, x: 3600000 * 13, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 1, x: 3600000 * 14, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 1, x: 3600000 * 15, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 1, x: 3600000 * 16, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 1, x: 3600000 * 17, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 1, x: 3600000 * 18, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 1, x: 3600000 * 19, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 1, x: 3600000 * 20, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 1, x: 3600000 * 21, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 1, x: 3600000 * 22, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 1, x: 3600000 * 23, marker: { radius: Math.floor(Math.random()*11) }}, 

     {y: 2, x: 3600000 * 1, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 2, x: 3600000 * 2, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 2, x: 3600000 * 3, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 2, x: 3600000 * 4, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 2, x: 3600000 * 5, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 2, x: 3600000 * 6, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 2, x: 3600000 * 7, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 2, x: 3600000 * 8, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 2, x: 3600000 * 9, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 2, x: 3600000 * 10, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 2, x: 3600000 * 11, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 2, x: 3600000 * 12, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 2, x: 3600000 * 13, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 2, x: 3600000 * 14, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 2, x: 3600000 * 15, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 2, x: 3600000 * 16, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 2, x: 3600000 * 17, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 2, x: 3600000 * 18, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 2, x: 3600000 * 19, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 2, x: 3600000 * 20, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 2, x: 3600000 * 21, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 2, x: 3600000 * 22, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 2, x: 3600000 * 23, marker: { radius: Math.floor(Math.random()*11) }}, 

     {y: 3, x: 3600000 * 1, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 3, x: 3600000 * 2, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 3, x: 3600000 * 3, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 3, x: 3600000 * 4, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 3, x: 3600000 * 5, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 3, x: 3600000 * 6, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 3, x: 3600000 * 7, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 3, x: 3600000 * 8, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 3, x: 3600000 * 9, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 3, x: 3600000 * 10, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 3, x: 3600000 * 11, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 3, x: 3600000 * 12, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 3, x: 3600000 * 13, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 3, x: 3600000 * 14, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 3, x: 3600000 * 15, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 3, x: 3600000 * 16, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 3, x: 3600000 * 17, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 3, x: 3600000 * 18, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 3, x: 3600000 * 19, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 3, x: 3600000 * 20, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 3, x: 3600000 * 21, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 3, x: 3600000 * 22, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 3, x: 3600000 * 23, marker: { radius: Math.floor(Math.random()*11) }}, 

     {y: 4, x: 3600000 * 1, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 4, x: 3600000 * 2, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 4, x: 3600000 * 3, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 4, x: 3600000 * 4, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 4, x: 3600000 * 5, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 4, x: 3600000 * 6, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 4, x: 3600000 * 7, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 4, x: 3600000 * 8, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 4, x: 3600000 * 9, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 4, x: 3600000 * 10, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 4, x: 3600000 * 11, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 4, x: 3600000 * 12, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 4, x: 3600000 * 13, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 4, x: 3600000 * 14, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 4, x: 3600000 * 15, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 4, x: 3600000 * 16, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 4, x: 3600000 * 17, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 4, x: 3600000 * 18, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 4, x: 3600000 * 19, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 4, x: 3600000 * 20, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 4, x: 3600000 * 21, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 4, x: 3600000 * 22, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 4, x: 3600000 * 23, marker: { radius: Math.floor(Math.random()*11) }}, 

     {y: 5, x: 3600000 * 1, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 5, x: 3600000 * 2, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 5, x: 3600000 * 3, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 5, x: 3600000 * 4, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 5, x: 3600000 * 5, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 5, x: 3600000 * 6, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 5, x: 3600000 * 7, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 5, x: 3600000 * 8, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 5, x: 3600000 * 9, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 5, x: 3600000 * 10, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 5, x: 3600000 * 11, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 5, x: 3600000 * 12, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 5, x: 3600000 * 13, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 5, x: 3600000 * 14, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 5, x: 3600000 * 15, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 5, x: 3600000 * 16, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 5, x: 3600000 * 17, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 5, x: 3600000 * 18, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 5, x: 3600000 * 19, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 5, x: 3600000 * 20, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 5, x: 3600000 * 21, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 5, x: 3600000 * 22, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 5, x: 3600000 * 23, marker: { radius: Math.floor(Math.random()*11) }}, 

     {y: 6, x: 3600000 * 1, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 6, x: 3600000 * 2, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 6, x: 3600000 * 3, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 6, x: 3600000 * 4, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 6, x: 3600000 * 5, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 6, x: 3600000 * 6, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 6, x: 3600000 * 7, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 6, x: 3600000 * 8, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 6, x: 3600000 * 9, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 6, x: 3600000 * 10, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 6, x: 3600000 * 11, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 6, x: 3600000 * 12, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 6, x: 3600000 * 13, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 6, x: 3600000 * 14, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 6, x: 3600000 * 15, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 6, x: 3600000 * 16, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 6, x: 3600000 * 17, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 6, x: 3600000 * 18, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 6, x: 3600000 * 19, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 6, x: 3600000 * 20, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 6, x: 3600000 * 21, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 6, x: 3600000 * 22, marker: { radius: Math.floor(Math.random()*11) }}, 
     {y: 6, x: 3600000 * 23, marker: { radius: Math.floor(Math.random()*11) }}, 

     ] 
    }] 

    }); 

}); 

そして、ここでのデモです:http://jsfiddle.net/KmPJE/1/

は、それはあなたのために働くなら、私に教えてください。

+0

本当に素敵な仕事です。古い投稿をフォローアップしてください。 –

+0

問題ありません!私は現在、バラバラではなくバブルチャートを使用したより良いアプローチに取り組んでいます。 – kerberoS

関連する問題