-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathnvd3-multi-bar.html
115 lines (106 loc) · 2.04 KB
/
nvd3-multi-bar.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
<link rel="import" href="../polymer/polymer.html">
<link rel="import" href="nvd3-behavior.html">
<!--
An element to create multi bar chart using nvd3.
Example:
<nvd3-multi-bar
data="[[data]]"
height="100"
width="400"
auto-resize
show-legend></nvd3-multi-bar>
Data Format:
```
[{
"key": "Stream0",
"values": [{
"x": 0,
"y": 0.17657645842991837
}, {
"x": 1,
"y": 0.17056295930152043
}, {
"x": 2,
"y": 0.1673443365488047
}, {
"x": 3,
"y": 0.11723298445616456
}]
}, {
"key": "Stream1",
"values": [{
"x": 0,
"y": 1.2743446048854001
}, {
"x": 1,
"y": 0.22290307978708743
}, {
"x": 2,
"y": 0.11314237776897834
}, {
"x": 3,
"y": 0.13269772172547029
}]
}, {
"key": "Stream2",
"values": [{
"x": 0,
"y": 4.56961163175497
}, {
"x": 1,
"y": 0.6716892057759072
}, {
"x": 2,
"y": 0.1281580516020834
}, {
"x": 3,
"y": 0.1961314488771337
}]
}]
```
@group NVD3 Elements
@element nvd3-multi-bar
@demo demo/nvd3-multi-bar.html
@hero hero.svg
-->
<dom-module id="nvd3-multi-bar">
<template>
<style include="nvd3-shared-styles"></style>
<!-- We need to put svg tag inside a div to set correct margins -->
<div>
<svg id="svg"></svg>
</div>
</template>
<script>
Polymer({
is: 'nvd3-multi-bar',
behaviors: [NVD3.ChartBehavior],
properties: {
/**
* NVD3 chart object.
*/
_chart: {
type: Object,
value: function() {
return nv.models.multiBarChart();
}
},
/**
* Whether to display the legend or not
*/
showLegend: {
type: Boolean,
value: false
},
/**
* NVD3 components which are used in this chart.
* It's required for binding events.
*/
_components: {
type: Array,
value: ['multibar', 'legend', 'controls', 'xAxis', 'yAxis', 'tooltip']
}
}
});
</script>
</dom-module>