nvd3-rails 0.0.1 → 0.0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (107) hide show
  1. checksums.yaml +15 -0
  2. data/.gitignore +3 -0
  3. data/README.md +7 -71
  4. data/lib/nvd3/rails/version.rb +1 -1
  5. data/nvd3-rails.gemspec +3 -3
  6. metadata +8 -111
  7. data/vendor/assets/javascripts/nvd3/.git.sample/HEAD +0 -1
  8. data/vendor/assets/javascripts/nvd3/.git.sample/config +0 -13
  9. data/vendor/assets/javascripts/nvd3/.git.sample/description +0 -1
  10. data/vendor/assets/javascripts/nvd3/.git.sample/hooks/applypatch-msg.sample +0 -15
  11. data/vendor/assets/javascripts/nvd3/.git.sample/hooks/commit-msg.sample +0 -24
  12. data/vendor/assets/javascripts/nvd3/.git.sample/hooks/post-update.sample +0 -8
  13. data/vendor/assets/javascripts/nvd3/.git.sample/hooks/pre-applypatch.sample +0 -14
  14. data/vendor/assets/javascripts/nvd3/.git.sample/hooks/pre-commit.sample +0 -50
  15. data/vendor/assets/javascripts/nvd3/.git.sample/hooks/pre-push.sample +0 -53
  16. data/vendor/assets/javascripts/nvd3/.git.sample/hooks/pre-rebase.sample +0 -169
  17. data/vendor/assets/javascripts/nvd3/.git.sample/hooks/prepare-commit-msg.sample +0 -36
  18. data/vendor/assets/javascripts/nvd3/.git.sample/hooks/update.sample +0 -128
  19. data/vendor/assets/javascripts/nvd3/.git.sample/index +0 -0
  20. data/vendor/assets/javascripts/nvd3/.git.sample/info/exclude +0 -6
  21. data/vendor/assets/javascripts/nvd3/.git.sample/logs/HEAD +0 -1
  22. data/vendor/assets/javascripts/nvd3/.git.sample/logs/refs/heads/master +0 -1
  23. data/vendor/assets/javascripts/nvd3/.git.sample/logs/refs/remotes/origin/HEAD +0 -1
  24. data/vendor/assets/javascripts/nvd3/.git.sample/objects/pack/pack-babbb312d58dd7f03870b530a1b9a84c80918be3.idx +0 -0
  25. data/vendor/assets/javascripts/nvd3/.git.sample/objects/pack/pack-babbb312d58dd7f03870b530a1b9a84c80918be3.pack +0 -0
  26. data/vendor/assets/javascripts/nvd3/.git.sample/packed-refs +0 -5
  27. data/vendor/assets/javascripts/nvd3/.git.sample/refs/heads/master +0 -1
  28. data/vendor/assets/javascripts/nvd3/.git.sample/refs/remotes/origin/HEAD +0 -1
  29. data/vendor/assets/javascripts/nvd3/build.bat +0 -6
  30. data/vendor/assets/javascripts/nvd3/deprecated/bar.html +0 -198
  31. data/vendor/assets/javascripts/nvd3/deprecated/bar.js +0 -250
  32. data/vendor/assets/javascripts/nvd3/deprecated/charts/cumulativeLineChart.js +0 -174
  33. data/vendor/assets/javascripts/nvd3/deprecated/charts/discreteBarChart.js +0 -157
  34. data/vendor/assets/javascripts/nvd3/deprecated/charts/lineChart.js +0 -159
  35. data/vendor/assets/javascripts/nvd3/deprecated/charts/lineChartDaily.js +0 -168
  36. data/vendor/assets/javascripts/nvd3/deprecated/charts/stackedAreaChart.js +0 -177
  37. data/vendor/assets/javascripts/nvd3/deprecated/cumulativeLine.html +0 -171
  38. data/vendor/assets/javascripts/nvd3/deprecated/cumulativeLine.js +0 -334
  39. data/vendor/assets/javascripts/nvd3/deprecated/discreteBarChartWithEnabledTooltip.html +0 -129
  40. data/vendor/assets/javascripts/nvd3/deprecated/discreteBarChartWithEnabledTooltip.js +0 -222
  41. data/vendor/assets/javascripts/nvd3/deprecated/discreteBarWithAxes.html +0 -172
  42. data/vendor/assets/javascripts/nvd3/deprecated/discreteBarWithAxes.js +0 -152
  43. data/vendor/assets/javascripts/nvd3/deprecated/lineChart-old.html +0 -83
  44. data/vendor/assets/javascripts/nvd3/deprecated/lineChartDaily.html +0 -109
  45. data/vendor/assets/javascripts/nvd3/deprecated/linePlusBar.html +0 -173
  46. data/vendor/assets/javascripts/nvd3/deprecated/linePlusBar.js +0 -250
  47. data/vendor/assets/javascripts/nvd3/deprecated/lineWithFocus.html +0 -137
  48. data/vendor/assets/javascripts/nvd3/deprecated/lineWithFocus.js +0 -354
  49. data/vendor/assets/javascripts/nvd3/deprecated/lineWithFourAxes.html +0 -144
  50. data/vendor/assets/javascripts/nvd3/deprecated/lineWithFourAxes.js +0 -218
  51. data/vendor/assets/javascripts/nvd3/deprecated/lineWithLegend.html +0 -142
  52. data/vendor/assets/javascripts/nvd3/deprecated/lineWithLegend.js +0 -176
  53. data/vendor/assets/javascripts/nvd3/deprecated/monthendAxis.html +0 -99
  54. data/vendor/assets/javascripts/nvd3/deprecated/multiBarHorizontalWithLegend.html +0 -258
  55. data/vendor/assets/javascripts/nvd3/deprecated/multiBarHorizontalWithLegend.js +0 -226
  56. data/vendor/assets/javascripts/nvd3/deprecated/multiBarWithLegend.html +0 -162
  57. data/vendor/assets/javascripts/nvd3/deprecated/multiBarWithLegend.js +0 -249
  58. data/vendor/assets/javascripts/nvd3/deprecated/pie.js +0 -263
  59. data/vendor/assets/javascripts/nvd3/deprecated/scatterChart.html +0 -110
  60. data/vendor/assets/javascripts/nvd3/deprecated/scatterChart.js +0 -294
  61. data/vendor/assets/javascripts/nvd3/deprecated/scatterFisheyeChart.js +0 -418
  62. data/vendor/assets/javascripts/nvd3/deprecated/scatterWithLegend.html +0 -167
  63. data/vendor/assets/javascripts/nvd3/deprecated/scatterWithLegend.js +0 -261
  64. data/vendor/assets/javascripts/nvd3/deprecated/stackedArea.js +0 -286
  65. data/vendor/assets/javascripts/nvd3/deprecated/stackedAreaChart.html +0 -183
  66. data/vendor/assets/javascripts/nvd3/deprecated/stackedAreaChart_old.html +0 -137
  67. data/vendor/assets/javascripts/nvd3/deprecated/stackedAreaWithLegend.html +0 -222
  68. data/vendor/assets/javascripts/nvd3/deprecated/stackedAreaWithLegend.js +0 -297
  69. data/vendor/assets/javascripts/nvd3/examples/bullet.html +0 -96
  70. data/vendor/assets/javascripts/nvd3/examples/bulletChart.html +0 -94
  71. data/vendor/assets/javascripts/nvd3/examples/crossfilter.html +0 -167
  72. data/vendor/assets/javascripts/nvd3/examples/crossfilterWithDimentions.html +0 -180
  73. data/vendor/assets/javascripts/nvd3/examples/crossfilterWithTables.html +0 -288
  74. data/vendor/assets/javascripts/nvd3/examples/cumulativeLineChart.html +0 -155
  75. data/vendor/assets/javascripts/nvd3/examples/discreteBarChart.html +0 -116
  76. data/vendor/assets/javascripts/nvd3/examples/dynamicTimeSeries.html +0 -148
  77. data/vendor/assets/javascripts/nvd3/examples/historicalBar.html +0 -157
  78. data/vendor/assets/javascripts/nvd3/examples/horizon.html +0 -163
  79. data/vendor/assets/javascripts/nvd3/examples/images/grey-minus.png +0 -0
  80. data/vendor/assets/javascripts/nvd3/examples/images/grey-plus.png +0 -0
  81. data/vendor/assets/javascripts/nvd3/examples/indentedtree.html +0 -126
  82. data/vendor/assets/javascripts/nvd3/examples/legend.html +0 -75
  83. data/vendor/assets/javascripts/nvd3/examples/line.html +0 -95
  84. data/vendor/assets/javascripts/nvd3/examples/lineChart.html +0 -112
  85. data/vendor/assets/javascripts/nvd3/examples/lineChartSVGResize.html +0 -151
  86. data/vendor/assets/javascripts/nvd3/examples/linePlusBarChart.html +0 -114
  87. data/vendor/assets/javascripts/nvd3/examples/linePlusBarWithFocusChart.html +0 -128
  88. data/vendor/assets/javascripts/nvd3/examples/lineTimeSeries.html +0 -142
  89. data/vendor/assets/javascripts/nvd3/examples/lineWithFisheyeChart.html +0 -101
  90. data/vendor/assets/javascripts/nvd3/examples/lineWithFocusChart.html +0 -87
  91. data/vendor/assets/javascripts/nvd3/examples/multiBar.html +0 -92
  92. data/vendor/assets/javascripts/nvd3/examples/multiBarChart.html +0 -93
  93. data/vendor/assets/javascripts/nvd3/examples/multiBarHorizontalChart.html +0 -388
  94. data/vendor/assets/javascripts/nvd3/examples/multiChart.html +0 -93
  95. data/vendor/assets/javascripts/nvd3/examples/nations.json +0 -1
  96. data/vendor/assets/javascripts/nvd3/examples/pie.html +0 -93
  97. data/vendor/assets/javascripts/nvd3/examples/pieChart.html +0 -114
  98. data/vendor/assets/javascripts/nvd3/examples/scatter.html +0 -95
  99. data/vendor/assets/javascripts/nvd3/examples/scatterChart.html +0 -115
  100. data/vendor/assets/javascripts/nvd3/examples/scatterPlusLineChart.html +0 -116
  101. data/vendor/assets/javascripts/nvd3/examples/sparkline.html +0 -62
  102. data/vendor/assets/javascripts/nvd3/examples/sparklinePlus.html +0 -67
  103. data/vendor/assets/javascripts/nvd3/examples/stackedArea.html +0 -155
  104. data/vendor/assets/javascripts/nvd3/examples/stackedAreaChart.html +0 -245
  105. data/vendor/assets/javascripts/nvd3/examples/stream_layers.js +0 -35
  106. data/vendor/assets/javascripts/nvd3/src/models/backup/bullet.js +0 -250
  107. data/vendor/assets/javascripts/nvd3/src/models/backup/bulletChart.js +0 -349
@@ -1,171 +0,0 @@
1
- <!DOCTYPE html>
2
- <meta charset="utf-8">
3
-
4
- <link href="../src/d3.css" rel="stylesheet" type="text/css">
5
-
6
- <style>
7
-
8
- body {
9
- overflow-y:scroll;
10
- }
11
-
12
- text {
13
- font: 12px sans-serif;
14
- }
15
-
16
- </style>
17
- <body>
18
-
19
- <div id="test1">
20
- <svg></svg>
21
- </div>
22
-
23
- <script src="../lib/d3.v2.js"></script>
24
- <script src="../nv.d3.js"></script>
25
- <script src="../src/tooltip.js"></script>
26
- <script src="../src/models/legend.js"></script>
27
- <script src="../src/models/axis.js"></script>
28
- <script src="../src/models/line.js"></script>
29
- <script src="../src/models/cumulativeLine.js"></script>
30
- <script>
31
-
32
-
33
-
34
- var cumulativeMonthEndTestData = [
35
- {
36
- key: "Long",
37
- values: [ [ 1025409600000 , 0] , [ 1028088000000 , -6.3382185140371] , [ 1030766400000 , -5.9507873460847] , [ 1033358400000 , -11.569146943813] , [ 1036040400000 , -5.4767332317425] , [ 1038632400000 , 0.50794682203014] , [ 1041310800000 , -5.5310285460542] , [ 1043989200000 , -5.7838296963382] , [ 1046408400000 , -7.3249341615649] , [ 1049086800000 , -6.7078630712489] , [ 1051675200000 , 0.44227126150934] , [ 1054353600000 , 7.2481659343222] , [ 1056945600000 , 9.2512381306992] , [ 1059624000000 , 11.341210982529] , [ 1062302400000 , 14.734820409020] , [ 1064894400000 , 12.387148007542] , [ 1067576400000 , 18.436471461827] , [ 1070168400000 , 19.830742266977] , [ 1072846800000 , 22.643205829887] , [ 1075525200000 , 26.743156781239] , [ 1078030800000 , 29.597478802228] , [ 1080709200000 , 30.831697585341] , [ 1083297600000 , 28.054068024708] , [ 1085976000000 , 29.294079423832] , [ 1088568000000 , 30.269264061274] , [ 1091246400000 , 24.934526898906] , [ 1093924800000 , 24.265982759406] , [ 1096516800000 , 27.217794897473] , [ 1099195200000 , 30.802601992077] , [ 1101790800000 , 36.331003758254] , [ 1104469200000 , 43.142498700060] , [ 1107147600000 , 40.558263931958] , [ 1109566800000 , 42.543622385800] , [ 1112245200000 , 41.683584710331] , [ 1114833600000 , 36.375367302328] , [ 1117512000000 , 40.719688980730] , [ 1120104000000 , 43.897963036919] , [ 1122782400000 , 49.797033975368] , [ 1125460800000 , 47.085993935989] , [ 1128052800000 , 46.601972859745] , [ 1130734800000 , 41.567784572762] , [ 1133326800000 , 47.296923737245] , [ 1136005200000 , 47.642969612080] , [ 1138683600000 , 50.781515820954] , [ 1141102800000 , 52.600229204305] , [ 1143781200000 , 55.599684490628] , [ 1146369600000 , 57.920388436633] , [ 1149048000000 , 53.503593218971] , [ 1151640000000 , 53.522973979964] , [ 1154318400000 , 49.846822298548] , [ 1156996800000 , 54.721341614650] , [ 1159588800000 , 58.186236223191] , [ 1162270800000 , 63.908065540997] , [ 1164862800000 , 69.767285129367] , [ 1167541200000 , 72.534013373592] , [ 1170219600000 , 77.991819436573] , [ 1172638800000 , 78.143584404990] , [ 1175313600000 , 83.702398665233] , [ 1177905600000 , 91.140859312418] , [ 1180584000000 , 98.590960607028] , [ 1183176000000 , 96.245634754228] , [ 1185854400000 , 92.326364432615] , [ 1188532800000 , 97.068765332230] , [ 1191124800000 , 105.81025556260] , [ 1193803200000 , 114.38348777791] , [ 1196398800000 , 103.59604949810] , [ 1199077200000 , 101.72488429307] , [ 1201755600000 , 89.840147735028] , [ 1204261200000 , 86.963597532664] , [ 1206936000000 , 84.075505208491] , [ 1209528000000 , 93.170105645831] , [ 1212206400000 , 103.62838083121] , [ 1214798400000 , 87.458241365091] , [ 1217476800000 , 85.808374141319] , [ 1220155200000 , 93.158054469193] , [ 1222747200000 , 65.973252382360] , [ 1225425600000 , 44.580686638224] , [ 1228021200000 , 36.418977140128] , [ 1230699600000 , 38.727678144761] , [ 1233378000000 , 36.692674173387] , [ 1235797200000 , 30.033022809480] , [ 1238472000000 , 36.707532162718] , [ 1241064000000 , 52.191457688389] , [ 1243742400000 , 56.357883979735] , [ 1246334400000 , 57.629002180305] , [ 1249012800000 , 66.650985790166] , [ 1251691200000 , 70.839243432186] , [ 1254283200000 , 78.731998491499] , [ 1256961600000 , 72.375528540349] , [ 1259557200000 , 81.738387881630] , [ 1262235600000 , 87.539792394232] , [ 1264914000000 , 84.320762662273] , [ 1267333200000 , 90.621278391889] , [ 1270008000000 , 102.47144881651] , [ 1272600000000 , 102.79320353429] , [ 1275278400000 , 90.529736050479] , [ 1277870400000 , 76.580859994531] , [ 1280548800000 , 86.548979376972] , [ 1283227200000 , 81.879653334089] , [ 1285819200000 , 101.72550015956] , [ 1288497600000 , 107.97964852260] , [ 1291093200000 , 106.16240630785] , [ 1293771600000 , 114.84268599533] , [ 1296450000000 , 121.60793322282] , [ 1298869200000 , 133.41437346605] , [ 1301544000000 , 125.46646042904] , [ 1304136000000 , 129.76784954301] , [ 1306814400000 , 128.15798861044] , [ 1309406400000 , 121.92388706072] , [ 1312084800000 , 116.70036100870] , [ 1314763200000 , 88.367701837033] , [ 1317355200000 , 59.159665765725] , [ 1320033600000 , 79.793568139753] , [ 1322629200000 , 75.903834028417] , [ 1325307600000 , 72.704218209157] , [ 1327986000000 , 84.936990804097] , [ 1330491600000 , 93.388148670744]]
38
- },
39
- {
40
- key: "Short",
41
- values: [ [ 1025409600000 , 0] , [ 1028088000000 , 0] , [ 1030766400000 , 0] , [ 1033358400000 , 0] , [ 1036040400000 , 0] , [ 1038632400000 , 0] , [ 1041310800000 , 0] , [ 1043989200000 , 0] , [ 1046408400000 , 0] , [ 1049086800000 , 0] , [ 1051675200000 , 0] , [ 1054353600000 , 0] , [ 1056945600000 , 0] , [ 1059624000000 , 0] , [ 1062302400000 , 0] , [ 1064894400000 , 0] , [ 1067576400000 , 0] , [ 1070168400000 , 0] , [ 1072846800000 , 0] , [ 1075525200000 , -0.049184266875945] , [ 1078030800000 , -0.10757569491991] , [ 1080709200000 , -0.075601531307242] , [ 1083297600000 , -0.061245277988149] , [ 1085976000000 , -0.068227316401169] , [ 1088568000000 , -0.11242758058502] , [ 1091246400000 , -0.074848439408270] , [ 1093924800000 , -0.11465623676497] , [ 1096516800000 , -0.24370633342416] , [ 1099195200000 , -0.21523268478893] , [ 1101790800000 , -0.37859370911822] , [ 1104469200000 , -0.41932884345151] , [ 1107147600000 , -0.45393735984802] , [ 1109566800000 , -0.50868179522598] , [ 1112245200000 , -0.48164396881207] , [ 1114833600000 , -0.41605962887194] , [ 1117512000000 , -0.48490348490240] , [ 1120104000000 , -0.55071036101311] , [ 1122782400000 , -0.67489170505394] , [ 1125460800000 , -0.74978070939342] , [ 1128052800000 , -0.86395050745343] , [ 1130734800000 , -0.78524898506764] , [ 1133326800000 , -0.99800440950854] , [ 1136005200000 , -1.1177951153878] , [ 1138683600000 , -1.4119975432964] , [ 1141102800000 , -1.2409959736465] , [ 1143781200000 , -1.3088936375431] , [ 1146369600000 , -1.5495785469683] , [ 1149048000000 , -1.1563414981293] , [ 1151640000000 , -0.87192471725994] , [ 1154318400000 , -0.84073995183442] , [ 1156996800000 , -0.88761892867370] , [ 1159588800000 , -0.81748513917485] , [ 1162270800000 , -1.2874081041274] , [ 1164862800000 , -1.9234702981339] , [ 1167541200000 , -1.8377768147648] , [ 1170219600000 , -2.7107654031830] , [ 1172638800000 , -2.6493268125418] , [ 1175313600000 , -3.0814553134551] , [ 1177905600000 , -3.8509837783574] , [ 1180584000000 , -5.2919167850718] , [ 1183176000000 , -5.2297750650773] , [ 1185854400000 , -3.9335668501451] , [ 1188532800000 , -2.3695525190114] , [ 1191124800000 , -2.3084243151854] , [ 1193803200000 , -3.0753680726738] , [ 1196398800000 , -2.2346609938962] , [ 1199077200000 , -3.0598810361615] , [ 1201755600000 , -1.8410154270386] , [ 1204261200000 , -1.6479442038620] , [ 1206936000000 , -1.9293858622780] , [ 1209528000000 , -3.0769590460943] , [ 1212206400000 , -4.2423933501421] , [ 1214798400000 , -2.6951491617768] , [ 1217476800000 , -2.8981825939957] , [ 1220155200000 , -2.9662727940324] , [ 1222747200000 , 0.21556750497498] , [ 1225425600000 , 2.6784995167088] , [ 1228021200000 , 4.1296711248958] , [ 1230699600000 , 3.7311068218734] , [ 1233378000000 , 4.7695330866954] , [ 1235797200000 , 5.1919133040990] , [ 1238472000000 , 4.1025856045660] , [ 1241064000000 , 2.8498939666225] , [ 1243742400000 , 2.8106017222851] , [ 1246334400000 , 2.8456526669963] , [ 1249012800000 , 0.65563070754298] , [ 1251691200000 , -0.30022343874633] , [ 1254283200000 , -1.1600358228964] , [ 1256961600000 , -0.26674408835052] , [ 1259557200000 , -1.4693389757812] , [ 1262235600000 , -2.7855421590594] , [ 1264914000000 , -1.2668244065703] , [ 1267333200000 , -2.5537804115548] , [ 1270008000000 , -4.9144552474502] , [ 1272600000000 , -6.0484408234831] , [ 1275278400000 , -3.3834349033750] , [ 1277870400000 , -0.46752826932523] , [ 1280548800000 , -1.8030186027963] , [ 1283227200000 , -0.99623230097881] , [ 1285819200000 , -3.3475370235594] , [ 1288497600000 , -3.8187026520342] , [ 1291093200000 , -4.2354146250353] , [ 1293771600000 , -5.6795404292885] , [ 1296450000000 , -6.2928665328172] , [ 1298869200000 , -6.8549277434419] , [ 1301544000000 , -6.9925308360918] , [ 1304136000000 , -8.3216548655839] , [ 1306814400000 , -7.7682867271435] , [ 1309406400000 , -6.9244213301058] , [ 1312084800000 , -5.7407624451404] , [ 1314763200000 , -2.1813149077927] , [ 1317355200000 , 2.9407596325999] , [ 1320033600000 , -1.1130607112134] , [ 1322629200000 , -2.0274822307752] , [ 1325307600000 , -1.8372559072154] , [ 1327986000000 , -4.0732815531148] , [ 1330491600000 , -6.4417038470291]]
42
- },
43
- {
44
- key: "Gross",
45
- values: [ [ 1025409600000 , 0] , [ 1028088000000 , -6.3382185140371] , [ 1030766400000 , -5.9507873460847] , [ 1033358400000 , -11.569146943813] , [ 1036040400000 , -5.4767332317425] , [ 1038632400000 , 0.50794682203014] , [ 1041310800000 , -5.5310285460542] , [ 1043989200000 , -5.7838296963382] , [ 1046408400000 , -7.3249341615649] , [ 1049086800000 , -6.7078630712489] , [ 1051675200000 , 0.44227126150934] , [ 1054353600000 , 7.2481659343222] , [ 1056945600000 , 9.2512381306992] , [ 1059624000000 , 11.341210982529] , [ 1062302400000 , 14.734820409020] , [ 1064894400000 , 12.387148007542] , [ 1067576400000 , 18.436471461827] , [ 1070168400000 , 19.830742266977] , [ 1072846800000 , 22.643205829887] , [ 1075525200000 , 26.693972514363] , [ 1078030800000 , 29.489903107308] , [ 1080709200000 , 30.756096054034] , [ 1083297600000 , 27.992822746720] , [ 1085976000000 , 29.225852107431] , [ 1088568000000 , 30.156836480689] , [ 1091246400000 , 24.859678459498] , [ 1093924800000 , 24.151326522641] , [ 1096516800000 , 26.974088564049] , [ 1099195200000 , 30.587369307288] , [ 1101790800000 , 35.952410049136] , [ 1104469200000 , 42.723169856608] , [ 1107147600000 , 40.104326572110] , [ 1109566800000 , 42.034940590574] , [ 1112245200000 , 41.201940741519] , [ 1114833600000 , 35.959307673456] , [ 1117512000000 , 40.234785495828] , [ 1120104000000 , 43.347252675906] , [ 1122782400000 , 49.122142270314] , [ 1125460800000 , 46.336213226596] , [ 1128052800000 , 45.738022352292] , [ 1130734800000 , 40.782535587694] , [ 1133326800000 , 46.298919327736] , [ 1136005200000 , 46.525174496692] , [ 1138683600000 , 49.369518277658] , [ 1141102800000 , 51.359233230659] , [ 1143781200000 , 54.290790853085] , [ 1146369600000 , 56.370809889665] , [ 1149048000000 , 52.347251720842] , [ 1151640000000 , 52.651049262704] , [ 1154318400000 , 49.006082346714] , [ 1156996800000 , 53.833722685976] , [ 1159588800000 , 57.368751084016] , [ 1162270800000 , 62.620657436870] , [ 1164862800000 , 67.843814831233] , [ 1167541200000 , 70.696236558827] , [ 1170219600000 , 75.281054033390] , [ 1172638800000 , 75.494257592448] , [ 1175313600000 , 80.620943351778] , [ 1177905600000 , 87.289875534061] , [ 1180584000000 , 93.299043821956] , [ 1183176000000 , 91.015859689151] , [ 1185854400000 , 88.392797582470] , [ 1188532800000 , 94.699212813219] , [ 1191124800000 , 103.50183124741] , [ 1193803200000 , 111.30811970524] , [ 1196398800000 , 101.36138850420] , [ 1199077200000 , 98.665003256909] , [ 1201755600000 , 87.999132307989] , [ 1204261200000 , 85.315653328802] , [ 1206936000000 , 82.146119346213] , [ 1209528000000 , 90.093146599737] , [ 1212206400000 , 99.385987481068] , [ 1214798400000 , 84.763092203314] , [ 1217476800000 , 82.910191547323] , [ 1220155200000 , 90.191781675161] , [ 1222747200000 , 66.188819887335] , [ 1225425600000 , 47.259186154933] , [ 1228021200000 , 40.548648265024] , [ 1230699600000 , 42.458784966634] , [ 1233378000000 , 41.462207260082] , [ 1235797200000 , 35.224936113579] , [ 1238472000000 , 40.810117767284] , [ 1241064000000 , 55.041351655012] , [ 1243742400000 , 59.168485702020] , [ 1246334400000 , 60.474654847301] , [ 1249012800000 , 67.306616497709] , [ 1251691200000 , 70.539019993440] , [ 1254283200000 , 77.571962668603] , [ 1256961600000 , 72.108784451998] , [ 1259557200000 , 80.269048905849] , [ 1262235600000 , 84.754250235173] , [ 1264914000000 , 83.053938255703] , [ 1267333200000 , 88.067497980334] , [ 1270008000000 , 97.556993569060] , [ 1272600000000 , 96.744762710807] , [ 1275278400000 , 87.146301147104] , [ 1277870400000 , 76.113331725206] , [ 1280548800000 , 84.745960774176] , [ 1283227200000 , 80.883421033110] , [ 1285819200000 , 98.377963136001] , [ 1288497600000 , 104.16094587057] , [ 1291093200000 , 101.92699168281] , [ 1293771600000 , 109.16314556604] , [ 1296450000000 , 115.31506669000] , [ 1298869200000 , 126.55944572261] , [ 1301544000000 , 118.47392959295] , [ 1304136000000 , 121.44619467743] , [ 1306814400000 , 120.38970188330] , [ 1309406400000 , 114.99946573061] , [ 1312084800000 , 110.95959856356] , [ 1314763200000 , 86.186386929240] , [ 1317355200000 , 62.100425398325] , [ 1320033600000 , 78.680507428540] , [ 1322629200000 , 73.876351797642] , [ 1325307600000 , 70.866962301942] , [ 1327986000000 , 80.863709250982] , [ 1330491600000 , 86.946444823715]]
46
- },
47
- {
48
- key: "S&P 1500",
49
- values: [ [ 1025409600000 , -7.0674410638835] , [ 1028088000000 , -14.663359292964] , [ 1030766400000 , -14.104393060540] , [ 1033358400000 , -23.114477037218] , [ 1036040400000 , -16.774256687841] , [ 1038632400000 , -11.902028464000] , [ 1041310800000 , -16.883038668422] , [ 1043989200000 , -19.104223676831] , [ 1046408400000 , -20.420523282736] , [ 1049086800000 , -19.660555051587] , [ 1051675200000 , -13.106911231646] , [ 1054353600000 , -8.2448460302143] , [ 1056945600000 , -7.0313058730976] , [ 1059624000000 , -5.1485118700389] , [ 1062302400000 , -3.0011028761469] , [ 1064894400000 , -4.1367265281467] , [ 1067576400000 , 1.5425209565025] , [ 1070168400000 , 2.7673533607299] , [ 1072846800000 , 7.7077114755360] , [ 1075525200000 , 9.7565015112434] , [ 1078030800000 , 11.396888609473] , [ 1080709200000 , 10.013964745578] , [ 1083297600000 , 8.0558890950562] , [ 1085976000000 , 9.6081966657458] , [ 1088568000000 , 11.918590426432] , [ 1091246400000 , 7.9945345523982] , [ 1093924800000 , 8.3201276776796] , [ 1096516800000 , 9.8283954846342] , [ 1099195200000 , 11.527125859650] , [ 1101790800000 , 16.413657596527] , [ 1104469200000 , 20.393798297928] , [ 1107147600000 , 17.456308413907] , [ 1109566800000 , 20.087778400999] , [ 1112245200000 , 17.988336990817] , [ 1114833600000 , 15.378490151331] , [ 1117512000000 , 19.474322935730] , [ 1120104000000 , 20.013851070354] , [ 1122782400000 , 24.749943726975] , [ 1125460800000 , 23.558710274826] , [ 1128052800000 , 24.558915040889] , [ 1130734800000 , 22.355860488034] , [ 1133326800000 , 27.138026265756] , [ 1136005200000 , 27.202220808591] , [ 1138683600000 , 31.219437344964] , [ 1141102800000 , 31.392355525125] , [ 1143781200000 , 33.373099232542] , [ 1146369600000 , 35.095277582309] , [ 1149048000000 , 30.923356507615] , [ 1151640000000 , 31.083717332561] , [ 1154318400000 , 31.290690671561] , [ 1156996800000 , 34.247769216679] , [ 1159588800000 , 37.411073177620] , [ 1162270800000 , 42.079177096411] , [ 1164862800000 , 44.978191659648] , [ 1167541200000 , 46.713271025310] , [ 1170219600000 , 49.203892437699] , [ 1172638800000 , 46.684723471826] , [ 1175313600000 , 48.385458973500] , [ 1177905600000 , 54.660197840305] , [ 1180584000000 , 60.311838415602] , [ 1183176000000 , 57.583282204682] , [ 1185854400000 , 52.425398898751] , [ 1188532800000 , 54.663538086985] , [ 1191124800000 , 60.181844325224] , [ 1193803200000 , 62.877219773621] , [ 1196398800000 , 55.760611512951] , [ 1199077200000 , 54.735280367784] , [ 1201755600000 , 45.495912959474] , [ 1204261200000 , 40.934919015876] , [ 1206936000000 , 40.303777633187] , [ 1209528000000 , 47.403740368773] , [ 1212206400000 , 49.951960898839] , [ 1214798400000 , 37.534590035098] , [ 1217476800000 , 36.405758293321] , [ 1220155200000 , 38.545373001858] , [ 1222747200000 , 26.106358664455] , [ 1225425600000 , 4.2658006768744] , [ 1228021200000 , -3.5517839867557] , [ 1230699600000 , -2.0878920761513] , [ 1233378000000 , -10.408879093829] , [ 1235797200000 , -19.924242196038] , [ 1238472000000 , -12.906491912782] , [ 1241064000000 , -3.9774866468346] , [ 1243742400000 , 1.0319171601402] , [ 1246334400000 , 1.3109350357718] , [ 1249012800000 , 9.1668309061935] , [ 1251691200000 , 13.121178985954] , [ 1254283200000 , 17.578680237511] , [ 1256961600000 , 14.971294355085] , [ 1259557200000 , 21.551327027338] , [ 1262235600000 , 24.592328423819] , [ 1264914000000 , 20.158087829555] , [ 1267333200000 , 24.135661929185] , [ 1270008000000 , 31.815205405903] , [ 1272600000000 , 34.389524768466] , [ 1275278400000 , 23.785555857522] , [ 1277870400000 , 17.082756649072] , [ 1280548800000 , 25.248007727100] , [ 1283227200000 , 19.415179069165] , [ 1285819200000 , 30.413636349327] , [ 1288497600000 , 35.357952964550] , [ 1291093200000 , 35.886413535859] , [ 1293771600000 , 45.003601951959] , [ 1296450000000 , 48.274893564020] , [ 1298869200000 , 53.562864914648] , [ 1301544000000 , 54.108274337412] , [ 1304136000000 , 58.618190111927] , [ 1306814400000 , 56.806793965598] , [ 1309406400000 , 54.135477252994] , [ 1312084800000 , 50.735258942442] , [ 1314763200000 , 42.208170945813] , [ 1317355200000 , 31.617916826724] , [ 1320033600000 , 46.492005006737] , [ 1322629200000 , 46.203116922145] , [ 1325307600000 , 47.541427643137] , [ 1327986000000 , 54.518998440993] , [ 1330491600000 , 61.099720234693]]
50
- }
51
- ].map(function(line) {
52
- line.values = line.values.map(function(d) { return {x: d[0], y: d[1]/100 }});
53
- return line;
54
- });
55
-
56
-
57
-
58
-
59
-
60
- nv.addGraph({
61
- generate: function() {
62
- var width = nv.utils.windowSize().width - 40,
63
- height = nv.utils.windowSize().height - 40;
64
-
65
- var chart = nv.models.cumulativeLine()
66
- .width(width)
67
- .height(height)
68
- .color(d3.scale.category10().range())
69
- //.margin({top: 20, right: 10, bottom: 50, left: 80})
70
-
71
- //chart.yAxis.axisLabel('Cumulative');
72
- //chart.xAxis.axisLabel('Date');
73
-
74
- //these are specific for a chart containing only month end data points
75
- chart.xAxis.scale(d3.time.scale());
76
- chart.xAxis.ticks(d3.time.monthEnds, 12); //need to figure out the best way to calculate the step here... preferably without knowledge of the data domain
77
-
78
- chart.yAxis.tickFormat(d3.format(',%'));
79
- chart.xAxis.tickFormat(function(d) {
80
- return d3.time.format('%x')(new Date(d))
81
- });
82
-
83
- //chart.xaxis.tickFormat(d3.format(".02f"))
84
-
85
- var svg = d3.select('#test1 svg')
86
- .attr('width', width)
87
- .attr('height', height)
88
- .datum(cumulativeMonthEndTestData)
89
-
90
- svg.transition().duration(500).call(chart);
91
-
92
- return chart;
93
- },
94
- callback: function(graph) {
95
-
96
- graph.dispatch.on('tooltipShow', function(e) {
97
- var offsetElement = document.getElementById("test1"),
98
- left = e.pos[0] + offsetElement.offsetLeft,
99
- top = e.pos[1] + offsetElement.offsetTop,
100
- formatterY = d3.format(",.2%"),
101
- formatterX = function(d) {
102
- return d3.time.format('%x')(new Date(d))
103
- };
104
-
105
- var content = '<h3>' + e.series.key + '</h3>' +
106
- '<p>' +
107
- formatterY(graph.y()(e.point)) + ' on ' + formatterX(graph.x()(e.point)) +
108
- '</p>';
109
-
110
- nv.tooltip.show([left, top], content);
111
- });
112
-
113
- graph.dispatch.on('tooltipHide', function(e) {
114
- nv.tooltip.cleanup();
115
- });
116
-
117
-
118
-
119
- window.onresize = function() {
120
- var width = nv.utils.windowSize().width - 40,
121
- height = nv.utils.windowSize().height - 40,
122
- margin = graph.margin();
123
-
124
-
125
- if (width < margin.left + margin.right + 20)
126
- width = margin.left + margin.right + 20;
127
-
128
- if (height < margin.top + margin.bottom + 20)
129
- height = margin.top + margin.bottom + 20;
130
-
131
-
132
- graph
133
- .width(width)
134
- .height(height);
135
-
136
- d3.select('#test1 svg')
137
- .attr('width', width)
138
- .attr('height', height)
139
- .call(graph);
140
-
141
- };
142
- }
143
- });
144
-
145
-
146
-
147
- function sinAndCos() {
148
- var sin = [],
149
- cos = [];
150
-
151
- for (var i = 0; i < 100; i++) {
152
- sin.push({x: i, y: Math.sin(i/10)});
153
- cos.push({x: i, y: .5 * Math.cos(i/10)});
154
- }
155
-
156
- return [
157
- {
158
- values: sin,
159
- key: "Sine Wave",
160
- color: "#ff7f0e"
161
- },
162
- {
163
- values: cos,
164
- key: "Cosine Wave",
165
- color: "#2ca02c"
166
- }
167
- ];
168
- }
169
-
170
-
171
- </script>
@@ -1,334 +0,0 @@
1
-
2
- nv.models.cumulativeLine = function() {
3
- var margin = {top: 30, right: 20, bottom: 30, left: 60},
4
- getWidth = function() { return 960 },
5
- getHeight = function() { return 500 },
6
- color = d3.scale.category20().range(),
7
- dotRadius = function() { return 2.5 },
8
- getX = function(d) { return d.x },
9
- getY = function(d) { return d.y },
10
- id = Math.floor(Math.random() * 10000), //Create semi-unique ID incase user doesn't select one
11
- showRescaleToggle = true,
12
- rescaleY = true;
13
-
14
- var x = d3.scale.linear(),
15
- dx = d3.scale.linear(),
16
- y = d3.scale.linear(),
17
- xAxis = nv.models.axis().scale(x).orient('bottom'),
18
- yAxis = nv.models.axis().scale(y).orient('left'),
19
- legend = nv.models.legend().height(30),
20
- controls = nv.models.legend().height(30),
21
- lines = nv.models.line(),
22
- dispatch = d3.dispatch('tooltipShow', 'tooltipHide'),
23
- index = {i: 0, x: 0};
24
-
25
- //TODO: let user select default
26
- var controlsData = [
27
- { key: 'Re-scale y-axis' }
28
- ];
29
-
30
- var indexDrag = d3.behavior.drag()
31
- .on('dragstart', dragStart)
32
- .on('drag', dragMove)
33
- .on('dragend', dragEnd);
34
-
35
- function dragStart(d,i) {}
36
-
37
- function dragMove(d,i) {
38
- d.x += d3.event.dx;
39
- d.i = Math.round(dx.invert(d.x));
40
-
41
- //d3.transition(d3.select('.chart-' + id)).call(chart);
42
- d3.select(this).attr("transform", "translate(" + dx(d.i) + ",0)");
43
- }
44
-
45
- function dragEnd(d,i) {
46
- d3.transition(d3.select('.chart-' + id)).call(chart);
47
- }
48
-
49
-
50
- function chart(selection) {
51
- selection.each(function(data) {
52
- var width = getWidth(),
53
- height = getHeight(),
54
- availableWidth = width - margin.left - margin.right,
55
- availableHeight = height - margin.top - margin.bottom;
56
-
57
- var series = indexify(index.i, data);
58
-
59
- var seriesData = series
60
- .filter(function(d) { return !rescaleY || !d.disabled }) // only filter out if rescaling y axis
61
- .map(function(d) { return d.values });
62
-
63
-
64
- x .domain(d3.extent(d3.merge(seriesData), function(d) { return d.x } ))
65
- .range([0, availableWidth]);
66
-
67
- dx .domain([0, data[0].values.length - 1]) //Assumes all series have same length
68
- .range([0, availableWidth])
69
- .clamp(true);
70
-
71
- y .domain(d3.extent(d3.merge(seriesData), function(d) { return d.y } ))
72
- .range([availableHeight, 0]);
73
-
74
-
75
- lines
76
- .width(availableWidth)
77
- .height(availableHeight)
78
- .color(data.map(function(d,i) {
79
- return d.color || color[i % color.length];
80
- }).filter(function(d,i) { return !data[i].disabled }))
81
-
82
-
83
- var wrap = d3.select(this).classed('chart-' + id, true).selectAll('g.wrap').data([series]);
84
- var gEnter = wrap.enter().append('g').attr('class', 'wrap nvd3 cumulativeLine').append('g');
85
-
86
- gEnter.append('g').attr('class', 'x axis');
87
- gEnter.append('g').attr('class', 'y axis');
88
- gEnter.append('g').attr('class', 'linesWrap');
89
- gEnter.append('g').attr('class', 'legendWrap');
90
- gEnter.append('g').attr('class', 'controlsWrap');
91
-
92
-
93
-
94
- //TODO: margins should be adjusted based on what components are used: axes, axis labels, legend
95
- margin.top = legend.height();
96
-
97
- var g = wrap.select('g')
98
- .attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
99
-
100
-
101
- legend.width(width/2 - margin.right);
102
-
103
- g.select('.legendWrap')
104
- .datum(data)
105
- .attr('transform', 'translate(' + (width/2 - margin.left) + ',' + (-margin.top) +')')
106
- .call(legend);
107
-
108
- if (showRescaleToggle) {
109
- controls.width(140).color(['#444', '#444', '#444']);
110
- g.select('.controlsWrap')
111
- .datum(controlsData)
112
- .attr('transform', 'translate(0,' + (-margin.top) +')')
113
- .call(controls);
114
- }
115
-
116
-
117
- var linesWrap = g.select('.linesWrap')
118
- .datum(series.filter(function(d) { return !d.disabled }))
119
-
120
-
121
- d3.transition(linesWrap).call(lines);
122
-
123
-
124
- var indexLine = linesWrap.selectAll('.indexLine')
125
- .data([index]);
126
- indexLine.enter().append('rect').attr('class', 'indexLine')
127
- .attr('width', 3)
128
- .attr('x', -2)
129
- .attr('fill', 'red')
130
- .attr('fill-opacity', .5)
131
- .call(indexDrag)
132
-
133
- indexLine
134
- .attr("transform", function(d) { return "translate(" + dx(d.i) + ",0)" })
135
- .attr('height', availableHeight)
136
-
137
-
138
- xAxis
139
- .domain(x.domain())
140
- .range(x.range())
141
- .ticks( width / 100 )
142
- .tickSize(-availableHeight, 0);
143
-
144
- g.select('.x.axis')
145
- .attr('transform', 'translate(0,' + y.range()[0] + ')');
146
- d3.transition(g.select('.x.axis'))
147
- .call(xAxis);
148
-
149
- yAxis
150
- .domain(y.domain())
151
- .range(y.range())
152
- .ticks( height / 36 )
153
- .tickSize(-availableWidth, 0);
154
-
155
- d3.transition(g.select('.y.axis'))
156
- .call(yAxis);
157
-
158
-
159
-
160
-
161
-
162
- // ********** EVENT LISTENERS **********
163
-
164
- legend.dispatch.on('legendClick', function(d,i) {
165
- d.disabled = !d.disabled;
166
-
167
- if (!data.filter(function(d) { return !d.disabled }).length) {
168
- data.map(function(d) {
169
- d.disabled = false;
170
- wrap.selectAll('.series').classed('disabled', false);
171
- return d;
172
- });
173
- }
174
-
175
- selection.transition().call(chart);
176
- });
177
-
178
- /*
179
- legend.dispatch.on('legendMouseover', function(d, i) {
180
- d.hover = true;
181
- selection.transition().call(chart)
182
- });
183
-
184
- legend.dispatch.on('legendMouseout', function(d, i) {
185
- d.hover = false;
186
- selection.transition().call(chart)
187
- });
188
- */
189
-
190
-
191
- controls.dispatch.on('legendClick', function(d,i) {
192
- d.disabled = !d.disabled;
193
- rescaleY = !d.disabled;
194
-
195
- //console.log(d,i,arguments);
196
-
197
- selection.transition().call(chart);
198
- });
199
-
200
-
201
-
202
-
203
- lines.dispatch.on('elementMouseover.tooltip', function(e) {
204
- dispatch.tooltipShow({
205
- point: e.point,
206
- series: e.series,
207
- pos: [e.pos[0] + margin.left, e.pos[1] + margin.top],
208
- seriesIndex: e.seriesIndex,
209
- pointIndex: e.pointIndex
210
- });
211
- });
212
-
213
- lines.dispatch.on('elementMouseout.tooltip', function(e) {
214
- dispatch.tooltipHide(e);
215
- });
216
-
217
-
218
- });
219
-
220
- return chart;
221
- }
222
-
223
-
224
-
225
- // ********** FUNCTIONS **********
226
-
227
- /* Normalize the data according to an index point. */
228
- function indexify(idx, data) {
229
- return data.map(function(line, i) {
230
- var v = getY(line.values[idx], idx);
231
-
232
- return {
233
- key: line.key,
234
- values: line.values.map(function(point, pointIndex) {
235
- return {'x': getX(point, pointIndex), 'y': (getY(point, pointIndex) - v) / (1 + v) };
236
- }),
237
- disabled: line.disabled,
238
- hover: line.hover
239
- /*
240
- if (v < -.9) {
241
- //if a series loses more than 100%, calculations fail.. anything close can cause major distortion (but is mathematically currect till it hits 100)
242
- }
243
- */
244
- };
245
- });
246
- };
247
-
248
-
249
-
250
-
251
- // ********** PUBLIC ACCESSORS **********
252
-
253
- chart.dispatch = dispatch;
254
-
255
- chart.x = function(_) {
256
- if (!arguments.length) return getX;
257
- getX = _;
258
- //lines.x(_);
259
- return chart;
260
- };
261
-
262
- chart.y = function(_) {
263
- if (!arguments.length) return getY;
264
- getY = _;
265
- //lines.y(_);
266
- return chart;
267
- };
268
-
269
- chart.margin = function(_) {
270
- if (!arguments.length) return margin;
271
- margin = _;
272
- return chart;
273
- };
274
-
275
- /*
276
- chart.width = function(_) {
277
- if (!arguments.length) return width;
278
- width = _;
279
- return chart;
280
- };
281
-
282
- chart.height = function(_) {
283
- if (!arguments.length) return height;
284
- height = _;
285
- return chart;
286
- };
287
- */
288
-
289
- chart.width = function(_) {
290
- if (!arguments.length) return getWidth;
291
- getWidth = d3.functor(_);
292
- return chart;
293
- };
294
-
295
- chart.height = function(_) {
296
- if (!arguments.length) return getHeight;
297
- getHeight = d3.functor(_);
298
- return chart;
299
- };
300
-
301
- chart.color = function(_) {
302
- if (!arguments.length) return color;
303
- color = _;
304
- legend.color(_);
305
- return chart;
306
- };
307
-
308
- chart.dotRadius = function(_) {
309
- if (!arguments.length) return dotRadius;
310
- dotRadius = d3.functor(_);
311
- lines.dotRadius = _;
312
- return chart;
313
- };
314
-
315
- chart.showRescaleToggle = function(_) {
316
- if (!arguments.length) return showRescaleToggle;
317
- showRescaleToggle = _;
318
- return chart;
319
- };
320
-
321
-
322
- // Expose the x-axis' tickFormat method.
323
- //chart.xAxis = {};
324
- //d3.rebind(chart.xAxis, xAxis, 'tickFormat');
325
- chart.xAxis = xAxis;
326
-
327
- // Expose the y-axis' tickFormat method.
328
- //chart.yAxis = {};
329
- //d3.rebind(chart.yAxis, yAxis, 'tickFormat');
330
- chart.yAxis = yAxis;
331
-
332
-
333
- return chart;
334
- }