File tree Expand file tree Collapse file tree 5 files changed +103
-3
lines changed Expand file tree Collapse file tree 5 files changed +103
-3
lines changed Original file line number Diff line number Diff line change 27
27
- SortOptions
28
28
- CategoricalLegend
29
29
- ContinuousLegend
30
+ - Legend
30
31
- name : Data
31
32
- DataContainer
32
33
- name : History
Original file line number Diff line number Diff line change 126
126
:getStack =" getStack"
127
127
/>
128
128
129
-
130
129
<h3 >< ; BarPlot/> ; </h3 >
131
130
<PlotContainer
132
131
:pWidth =" 500"
@@ -919,6 +918,7 @@ import {
919
918
GenomeStackedBarPlot ,
920
919
CategoricalLegend ,
921
920
ContinuousLegend ,
921
+ Legend ,
922
922
// Classes
923
923
DataContainer ,
924
924
HistoryStack ,
@@ -1313,7 +1313,8 @@ export default {
1313
1313
GenomeMultiTrackPlot,
1314
1314
GenomeStackedBarPlot,
1315
1315
CategoricalLegend,
1316
- ContinuousLegend
1316
+ ContinuousLegend,
1317
+ Legend,
1317
1318
},
1318
1319
data () {
1319
1320
return {
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " vueplotlib" ,
3
- "version" : " 1.5.1 " ,
3
+ "version" : " 1.5.2 " ,
4
4
"private" : false ,
5
5
"scripts" : {
6
6
"serve" : " vue-cli-service serve --open ./examples-src/index.js" ,
Original file line number Diff line number Diff line change
1
+ <template >
2
+ <div >
3
+ <CategoricalLegend v-if =" legendType === 'categorical'"
4
+ :variable =" variable"
5
+ :lStyle =" lStyle"
6
+ :lWidth =" lWidth"
7
+ :lItemHeight =" lItemHeight"
8
+ :getScale =" getScale"
9
+ :getStack =" getStack"
10
+ :clickHandler =" clickHandler"
11
+ />
12
+ <ContinuousLegend v-if =" legendType === 'continuous'"
13
+ :variable =" variable"
14
+ :lWidth =" lWidth"
15
+ :lItemHeight =" lItemHeight"
16
+ :getScale =" getScale"
17
+ :getStack =" getStack"
18
+ />
19
+ </div >
20
+ </template >
21
+
22
+ <script >
23
+
24
+ import ContinuousLegend from ' ./ContinuousLegend.vue' ;
25
+ import CategoricalLegend from ' ./CategoricalLegend.vue' ;
26
+
27
+ import ContinuousScale from ' ../../scales/ContinuousScale' ;
28
+ import CategoricalScale from ' ../../scales/CategoricalScale' ;
29
+
30
+
31
+ let uuid = 0 ;
32
+ /**
33
+ * @prop {string} variable The legend variable key.
34
+ * Accepts any props that CategoricalLegend or ContinuousLegend accept and passes them on.
35
+ *
36
+ * @example
37
+ * < Legend
38
+ * variable= " y"
39
+ * : lWidth= " 500"
40
+ * : getScale= " getScale"
41
+ * : getStack= " getStack"
42
+ * / >
43
+ */
44
+ export default {
45
+ name: ' Legend' ,
46
+ components: {
47
+ ContinuousLegend,
48
+ CategoricalLegend
49
+ },
50
+ props: {
51
+ ' variable' : {
52
+ type: String
53
+ },
54
+ ' lStyle' : {
55
+ type: String
56
+ },
57
+ ' lWidth' : {
58
+ type: Number
59
+ },
60
+ ' lItemHeight' : {
61
+ type: Number ,
62
+ default: 20
63
+ },
64
+ ' getScale' : {
65
+ type: Function
66
+ },
67
+ ' getStack' : {
68
+ type: Function
69
+ },
70
+ ' clickHandler' : {
71
+ type: Function
72
+ }
73
+ },
74
+ data () {
75
+ return {
76
+ legendType: null
77
+ }
78
+ },
79
+ beforeCreate () {
80
+ this .uuid = this .$options .name + uuid .toString ();
81
+ uuid += 1 ;
82
+ },
83
+ created () {
84
+ // Set the scale variable
85
+ const varScale = this .getScale (this .variable );
86
+ if (varScale instanceof ContinuousScale) {
87
+ this .legendType = ' continuous' ;
88
+ } else if (varScale instanceof CategoricalScale) {
89
+ this .legendType = ' categorical' ;
90
+ }
91
+ }
92
+ }
93
+ </script >
94
+
95
+ <style >
96
+ </style >
Original file line number Diff line number Diff line change @@ -31,6 +31,7 @@ import GenomeStackedBarPlot from './components/plots/GenomeStackedBarPlot.vue';
31
31
// Legends
32
32
import CategoricalLegend from './components/legends/CategoricalLegend.vue' ;
33
33
import ContinuousLegend from './components/legends/ContinuousLegend.vue' ;
34
+ import Legend from './components/legends/Legend.vue' ;
34
35
35
36
// Classes
36
37
import DataContainer from './data/DataContainer' ;
@@ -74,6 +75,7 @@ export {
74
75
GenomeStackedBarPlot ,
75
76
CategoricalLegend ,
76
77
ContinuousLegend ,
78
+ Legend ,
77
79
// Classes
78
80
DataContainer ,
79
81
HistoryStack ,
You can’t perform that action at this time.
0 commit comments