1 nv.addGraph(function() {
2 var chart = nv.models.discreteBarChart()
3 .x(function(d) { return d.label })
4 .y(function(d) { return d.value })
5 .staggerLabels(true)
6 .tooltips(false)
7 .showValues(true)
8
9 d3.select('#chart svg')
10 .datum(exampleData())
11 .transition().duration(500)
12 .call(chart);
13
14 nv.utils.windowResize(chart.update);
15
16 return chart;
17 });
18
19
20
21
22
23
24
25 function exampleData() {
26 return [
27 {
28 key: "Cumulative Return",
29 values: [
30 {
31 "label" : "CDS / Options" ,
32 "value" : -29.765957771107
33 } ,
34 {
35 "label" : "Cash" ,
36 "value" : 0
37 } ,
38 {
39 "label" : "Corporate Bonds" ,
40 "value" : 32.807804682612
41 } ,
42 {
43 "label" : "Equity" ,
44 "value" : 196.45946739256
45 } ,
46 {
47 "label" : "Index Futures" ,
48 "value" : 0.19434030906893
49 } ,
50 {
51 "label" : "Options" ,
52 "value" : -98.079782601442
53 } ,
54 {
55 "label" : "Preferred" ,
56 "value" : -13.925743130903
57 } ,
58 {
59 "label" : "Not Available" ,
60 "value" : -5.1387322875705
61 }
62 ]
63 }
64 ];
65 }